Skip to content

armgit / ente

Public Imported from GitHub
0

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

uncontext

Manav Rathif92db38ca177
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index ccfc3da12d..fbf948abb7 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -10,8 +10,7 @@ import { EnteFile } from "@/media/file";
import { moveToTrash, TRASH_SECTION } from "@/new/photos/services/collection";
import { styled } from "@mui/material";
import { t } from "i18next";
-import { GalleryContext } from "pages/gallery";
-import { useCallback, useContext, useMemo, useState } from "react";
+import { useCallback, useMemo, useState } from "react";
import AutoSizer from "react-virtualized-auto-sizer";
import {
addToFavorites,
@@ -26,19 +25,6 @@ import {
type FileListProps,
} from "./FileList";
-const Container = styled("div")`
- display: block;
- flex: 1;
- width: 100%;
- flex-wrap: wrap;
- margin: 0 auto;
- overflow: hidden;
- .pswp-thumbnail {
- display: inline-block;
- cursor: pointer;
- }
-`;
-
/**
* An {@link EnteFile} augmented with various in-memory state used for
* displaying it in the photo viewer.
@@ -130,6 +116,7 @@ export type FileListWithViewerProps = {
> &
Pick<
FileViewerProps,
+ | "user"
| "isInIncomingSharedCollection"
| "isInHiddenSection"
| "fileCollectionIDs"
@@ -146,6 +133,7 @@ export type FileListWithViewerProps = {
export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
mode,
modePlus,
+ user,
files,
enableDownload,
showAppDownloadBanner,
@@ -167,8 +155,6 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
onSelectCollection,
onSelectPerson,
}) => {
- const galleryContext = useContext(GalleryContext);
-
const [openFileViewer, setOpenFileViewer] = useState(false);
const [currentIndex, setCurrentIndex] = useState(0);
@@ -263,11 +249,11 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
<FileViewer
open={openFileViewer}
onClose={handleCloseFileViewer}
- user={galleryContext.user ?? undefined}
initialIndex={currentIndex}
disableDownload={!enableDownload}
isInTrashSection={activeCollectionID === TRASH_SECTION}
{...{
+ user,
files,
isInHiddenSection,
isInIncomingSharedCollection,
@@ -287,6 +273,19 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
);
};
+const Container = styled("div")`
+ display: block;
+ flex: 1;
+ width: 100%;
+ flex-wrap: wrap;
+ margin: 0 auto;
+ overflow: hidden;
+ .pswp-thumbnail {
+ display: inline-block;
+ cursor: pointer;
+ }
+`;
+
/**
* See: [Note: Timeline date string]
*/
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 85d3b59345..0e0140d5f6 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -96,7 +96,7 @@ import CollectionNamer, {
import { GalleryBarAndListHeader } from "components/Collections/GalleryBarAndListHeader";
import { Export } from "components/Export";
import { ITEM_TYPE, TimeStampListItem } from "components/FileList";
-import {FileListWithViewer} from "components/FileListWithViewer";
+import { FileListWithViewer } from "components/FileListWithViewer";
import {
FilesDownloadProgress,
FilesDownloadProgressAttributes,
@@ -1050,18 +1050,19 @@ const Page: React.FC = () => {
<FileListWithViewer
mode={barMode}
modePlus={isInSearchMode ? "search" : barMode}
+ user={user}
files={filteredFiles}
- setSelected={setSelected}
+ enableDownload={true}
+ showAppDownloadBanner={
+ files.length < 30 && !isInSearchMode
+ }
+ selectable={true}
selected={selected}
- favoriteFileIDs={state.favoriteFileIDs}
+ setSelected={setSelected}
activeCollectionID={activeCollectionID}
activePersonID={activePerson?.id}
- enableDownload={true}
fileCollectionIDs={state.fileCollectionIDs}
allCollectionsNameByID={state.allCollectionsNameByID}
- showAppDownloadBanner={
- files.length < 30 && !isInSearchMode
- }
isInIncomingSharedCollection={
collectionSummaries.get(activeCollectionID)?.type ==
"incomingShareCollaborator" ||
@@ -1069,10 +1070,10 @@ const Page: React.FC = () => {
"incomingShareViewer"
}
isInHiddenSection={barMode == "hidden-albums"}
+ favoriteFileIDs={state.favoriteFileIDs}
setFilesDownloadProgressAttributesCreator={
setFilesDownloadProgressAttributesCreator
}
- selectable={true}
onMarkUnsyncedFavoriteUpdate={
handleMarkUnsyncedFavoriteUpdate
}
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 7566a280b4..bb887c5977 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -511,17 +511,17 @@ export default function PublicCollectionGallery() {
<FileListWithViewer
files={publicFiles}
- onSyncWithRemote={handleSyncWithRemote}
- setSelected={setSelected}
+ enableDownload={downloadEnabled}
+ selectable={downloadEnabled}
selected={selected}
+ setSelected={setSelected}
activeCollectionID={ALL_SECTION}
- enableDownload={downloadEnabled}
fileCollectionIDs={undefined}
allCollectionsNameByID={undefined}
setFilesDownloadProgressAttributesCreator={
setFilesDownloadProgressAttributesCreator
}
- selectable={downloadEnabled}
+ onSyncWithRemote={handleSyncWithRemote}
/>
{blockingLoad && <TranslucentLoadingOverlay />}
<Upload