Shared date select
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -44,5 +44,4 @@ export interface GalleryContextType {
|
||||
user: User;
|
||||
userIDToEmailMap: Map<number, string>;
|
||||
emailList: string[];
|
||||
selectedFile: SelectedState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user