fix issues
This commit is contained in:
parent
d258d58e5e
commit
864ac8fa1f
2 changed files with 15 additions and 11 deletions
|
@ -218,6 +218,12 @@ export default function PreviewCard(props: IProps) {
|
|||
const galleryContext = useContext(GalleryContext);
|
||||
const deduplicateContext = useContext(DeduplicateContext);
|
||||
|
||||
const longPressCallback = () => {
|
||||
onSelect(!selected);
|
||||
};
|
||||
|
||||
const longPress = useLongPress(longPressCallback, 500);
|
||||
|
||||
const {
|
||||
file,
|
||||
onClick,
|
||||
|
@ -289,9 +295,6 @@ export default function PreviewCard(props: IProps) {
|
|||
}
|
||||
};
|
||||
|
||||
const longPressCallback = () => {
|
||||
onSelect(!selected);
|
||||
};
|
||||
const handleHover = () => {
|
||||
if (isRangeSelectActive) {
|
||||
onHover();
|
||||
|
@ -304,7 +307,7 @@ export default function PreviewCard(props: IProps) {
|
|||
onClick={handleClick}
|
||||
onMouseEnter={handleHover}
|
||||
disabled={!file?.msrc && !imgSrc}
|
||||
{...(selectable ? useLongPress(longPressCallback, 500) : {})}>
|
||||
{...(selectable ? longPress : {})}>
|
||||
{selectable && (
|
||||
<Check
|
||||
type="checkbox"
|
||||
|
|
|
@ -507,6 +507,13 @@ export default function PublicCollectionGallery() {
|
|||
}
|
||||
}
|
||||
|
||||
const clearSelection = () => {
|
||||
if (!selected?.count) {
|
||||
return;
|
||||
}
|
||||
setSelected({ ownCount: 0, count: 0, collectionID: 0 });
|
||||
};
|
||||
|
||||
const downloadFilesHelper = async () => {
|
||||
try {
|
||||
const selectedFiles = getSelectedFiles(selected, publicFiles);
|
||||
|
@ -518,18 +525,12 @@ export default function PublicCollectionGallery() {
|
|||
selectedFiles,
|
||||
setFilesDownloadProgressAttributes
|
||||
);
|
||||
clearSelection();
|
||||
} catch (e) {
|
||||
logError(e, 'failed to download selected files');
|
||||
}
|
||||
};
|
||||
|
||||
const clearSelection = () => {
|
||||
if (!selected?.count) {
|
||||
return;
|
||||
}
|
||||
setSelected({ ownCount: 0, count: 0, collectionID: 0 });
|
||||
};
|
||||
|
||||
return (
|
||||
<PublicCollectionGalleryContext.Provider
|
||||
value={{
|
||||
|
|
Loading…
Add table
Reference in a new issue