Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix issues

Abhinav864ac8fa1ff7
diff --git a/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index 8bc49d0ae9..4e0ac402ec 100644
--- a/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -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"
diff --git a/apps/photos/src/pages/shared-albums/index.tsx b/apps/photos/src/pages/shared-albums/index.tsx
index 7987db23cb..1344c85767 100644
--- a/apps/photos/src/pages/shared-albums/index.tsx
+++ b/apps/photos/src/pages/shared-albums/index.tsx
@@ -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={{