Shared date select

This commit is contained in:
Manav Rathi
2025-06-26 09:44:50 +05:30
parent 67c3375ace
commit b785fe69f4
3 changed files with 4 additions and 9 deletions

View File

@@ -677,10 +677,10 @@ export const FileList: React.FC<FileListProps> = ({
useEffect(() => {
// Nothing to do here if nothing is selected.
if (!galleryContext.selectedFile) return;
if (!selected) return;
const notSelectedFiles = (annotatedFiles ?? []).filter(
(item) => !galleryContext.selectedFile[item.file.id],
(item) => !selected[item.file.id],
);
const unselectedDates = new Set(
@@ -706,7 +706,7 @@ export const FileList: React.FC<FileListProps> = ({
localSelectedDates.forEach((date) => checked.add(date));
return checked;
});
}, [galleryContext.selectedFile]);
}, [selected]);
const handleSelectMulti = handleSelectCreatorMulti(
setSelected,
@@ -847,9 +847,7 @@ export const FileList: React.FC<FileListProps> = ({
listItem: TimeStampListItem,
isScrolling: boolean,
) => {
// Enhancement: This logic doesn't work on the shared album screen, the
// galleryContext.selectedFile is always null there.
const haveSelection = (galleryContext.selectedFile?.count ?? 0) > 0;
const haveSelection = (selected.count ?? 0) > 0;
switch (listItem.tag) {
case "date":
return listItem.dates ? (

View File

@@ -135,7 +135,6 @@ const defaultGalleryContext: GalleryContextType = {
user: null,
userIDToEmailMap: null,
emailList: null,
selectedFile: null,
};
export const GalleryContext = createContext<GalleryContextType>(
@@ -881,7 +880,6 @@ const Page: React.FC = () => {
// TODO(RE): Rename
userIDToEmailMap: state.emailByUserID,
emailList: state.shareSuggestionEmails,
selectedFile: selected,
}}
>
<FullScreenDropZone

View File

@@ -44,5 +44,4 @@ export interface GalleryContextType {
user: User;
userIDToEmailMap: Map<number, string>;
emailList: string[];
selectedFile: SelectedState;
}