π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
extract
Manav Rathibe4536ac30c4
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 5d54327925..5680a796bb 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -275,58 +275,21 @@ export default function PublicCollectionGallery() {main();}, []);- const downloadEnabled = useMemo(- () => publicCollection?.publicURLs?.[0]?.enableDownload ?? true,- [publicCollection],- );-- const downloadAllFiles = async () => {- try {- if (!downloadEnabled) {- return;- }- const setFilesDownloadProgressAttributes =- setFilesDownloadProgressAttributesCreator(- publicCollection.name,- publicCollection.id,- isHiddenCollection(publicCollection),- );- await downloadCollectionFiles(- publicCollection.name,- publicFiles,- setFilesDownloadProgressAttributes,- );- } catch (e) {- log.error("failed to downloads shared album all files", e);- }- };+ const downloadEnabled =+ publicCollection?.publicURLs?.[0]?.enableDownload ?? true;useEffect(() => {publicCollection &&publicFiles &&setPhotoListHeader({item: (- <GalleryItemsHeaderAdapter>- <SpaceBetweenFlex>- <GalleryItemsSummary- name={publicCollection.name}- fileCount={publicFiles.length}- />- {downloadEnabled && (- <OverflowMenu- ariaControls={"collection-options"}- triggerButtonIcon={<MoreHoriz />}- >- <OverflowMenuOption- startIcon={<FileDownloadOutlinedIcon />}- onClick={downloadAllFiles}- >- {t("download_album")}- </OverflowMenuOption>- </OverflowMenu>- )}- </SpaceBetweenFlex>- </GalleryItemsHeaderAdapter>+ <ListHeader+ {...{+ publicCollection,+ publicFiles,+ setFilesDownloadProgressAttributesCreator,+ }}+ />),itemType: ITEM_TYPE.HEADER,height: 68,@@ -733,3 +696,56 @@ const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({</SelectionBar>);};++interface ListHeaderProps {+ publicCollection: Collection;+ publicFiles: EnteFile[];+ setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;+}++const ListHeader: React.FC<ListHeaderProps> = ({+ publicCollection,+ publicFiles,+ setFilesDownloadProgressAttributesCreator,+}) => {+ const downloadEnabled =+ publicCollection.publicURLs?.[0]?.enableDownload ?? true;++ const downloadAllFiles = async () => {+ const setFilesDownloadProgressAttributes =+ setFilesDownloadProgressAttributesCreator(+ publicCollection.name,+ publicCollection.id,+ isHiddenCollection(publicCollection),+ );+ await downloadCollectionFiles(+ publicCollection.name,+ publicFiles,+ setFilesDownloadProgressAttributes,+ );+ };++ return (+ <GalleryItemsHeaderAdapter>+ <SpaceBetweenFlex>+ <GalleryItemsSummary+ name={publicCollection.name}+ fileCount={publicFiles.length}+ />+ {downloadEnabled && (+ <OverflowMenu+ ariaControls={"collection-options"}+ triggerButtonIcon={<MoreHoriz />}+ >+ <OverflowMenuOption+ startIcon={<FileDownloadOutlinedIcon />}+ onClick={downloadAllFiles}+ >+ {t("download_album")}+ </OverflowMenuOption>+ </OverflowMenu>+ )}+ </SpaceBetweenFlex>+ </GalleryItemsHeaderAdapter>+ );+};