Skip to content

Commit

Permalink
[web] Migrate off deprecated dialog component (#3996)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnvr authored Nov 9, 2024
2 parents ae89637 + ce274e0 commit 53c258d
Show file tree
Hide file tree
Showing 41 changed files with 571 additions and 591 deletions.
370 changes: 182 additions & 188 deletions web/apps/photos/src/components/FixCreationTime.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const SelectedFileOptions = ({
<Stack spacing={2} direction="row" mr={2}>
{isInSearchMode ? (
<>
<Tooltip title={t("FIX_CREATION_TIME")}>
<Tooltip title={t("fix_creation_time")}>
<IconButton
onClick={handleFileOps(FILE_OPS_TYPE.FIX_TIME)}
>
Expand Down Expand Up @@ -328,7 +328,7 @@ const SelectedFileOptions = ({
</>
) : (
<>
<Tooltip title={t("FIX_CREATION_TIME")}>
<Tooltip title={t("fix_creation_time")}>
<IconButton
onClick={handleFileOps(FILE_OPS_TYPE.FIX_TIME)}
>
Expand Down
29 changes: 15 additions & 14 deletions web/apps/photos/src/pages/gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ import {
FilesDownloadProgress,
FilesDownloadProgressAttributes,
} from "components/FilesDownloadProgress";
import FixCreationTime, {
FixCreationTimeAttributes,
} from "components/FixCreationTime";
import { FixCreationTime } from "components/FixCreationTime";
import FullScreenDropZone from "components/FullScreenDropZone";
import GalleryEmptyState from "components/GalleryEmptyState";
import { LoadingOverlay } from "components/LoadingOverlay";
Expand Down Expand Up @@ -241,9 +239,6 @@ export default function Gallery() {
const [userIDToEmailMap, setUserIDToEmailMap] =
useState<Map<number, string>>(null);
const [emailList, setEmailList] = useState<string[]>(null);
const [fixCreationTimeView, setFixCreationTimeView] = useState(false);
const [fixCreationTimeAttributes, setFixCreationTimeAttributes] =
useState<FixCreationTimeAttributes>(null);

const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false);
const [uploadTypeSelectorIntent, setUploadTypeSelectorIntent] =
Expand Down Expand Up @@ -272,6 +267,11 @@ export default function Gallery() {
const [selectedSearchOption, setSelectedSearchOption] = useState<
SearchOption | undefined
>();
// If the fix creation time dialog is being shown, then the list of files on
// which it should act.
const [fixCreationTimeFiles, setFixCreationTimeFiles] = useState<
EnteFile[]
>([]);

const peopleState = usePeopleStateSnapshot();

Expand All @@ -295,6 +295,8 @@ export default function Gallery() {
useModalVisibility();
const { show: showWhatsNew, props: whatsNewVisibilityProps } =
useModalVisibility();
const { show: showFixCreationTime, props: fixCreationTimeVisibilityProps } =
useModalVisibility();

// TODO: Temp
const user = state.user;
Expand Down Expand Up @@ -426,9 +428,6 @@ export default function Gallery() {
useEffect(() => {
collectionNamerAttributes && setCollectionNamerView(true);
}, [collectionNamerAttributes]);
useEffect(() => {
fixCreationTimeAttributes && setFixCreationTimeView(true);
}, [fixCreationTimeAttributes]);

useEffect(() => {
if (typeof activeCollectionID === "undefined" || !router.isReady) {
Expand Down Expand Up @@ -495,8 +494,8 @@ export default function Gallery() {
uploadTypeSelectorView ||
openCollectionSelector ||
collectionNamerView ||
fixCreationTimeView ||
planSelectorVisibilityProps.open ||
fixCreationTimeVisibilityProps.open ||
exportModalView ||
authenticateUserModalView ||
isPhotoSwipeOpen ||
Expand Down Expand Up @@ -739,7 +738,10 @@ export default function Gallery() {
() => dispatch({ type: "clearTempDeleted" }),
(files) => dispatch({ type: "markTempHidden", files }),
() => dispatch({ type: "clearTempHidden" }),
setFixCreationTimeAttributes,
(files) => {
setFixCreationTimeFiles(files);
showFixCreationTime();
},
setFilesDownloadProgressAttributesCreator,
);
}
Expand Down Expand Up @@ -932,9 +934,8 @@ export default function Gallery() {
setAttributesList={setFilesDownloadProgressAttributesList}
/>
<FixCreationTime
isOpen={fixCreationTimeView}
hide={() => setFixCreationTimeView(false)}
attributes={fixCreationTimeAttributes}
{...fixCreationTimeVisibilityProps}
files={fixCreationTimeFiles}
/>

<NavbarBase
Expand Down
19 changes: 2 additions & 17 deletions web/apps/photos/src/utils/file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,7 @@ export const handleFileOps = async (
clearTempDeleted: () => void,
markTempHidden: (tempHiddenFiles: EnteFile[]) => void,
clearTempHidden: () => void,
setFixCreationTimeAttributes: (
fixCreationTimeAttributes:
| {
files: EnteFile[];
}
| ((prev: { files: EnteFile[] }) => { files: EnteFile[] }),
) => void,
fixCreationTime: (files: EnteFile[]) => void,
setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator,
) => {
switch (ops) {
Expand Down Expand Up @@ -583,7 +577,7 @@ export const handleFileOps = async (
break;
}
case FILE_OPS_TYPE.FIX_TIME:
fixTimeHelper(files, setFixCreationTimeAttributes);
fixCreationTime(files);
break;
case FILE_OPS_TYPE.ARCHIVE:
await changeFilesVisibility(files, ItemVisibility.archived);
Expand All @@ -596,12 +590,3 @@ export const handleFileOps = async (
break;
}
};

const fixTimeHelper = async (
selectedFiles: EnteFile[],
setFixCreationTimeAttributes: (fixCreationTimeAttributes: {
files: EnteFile[];
}) => void,
) => {
setFixCreationTimeAttributes({ files: selectedFiles });
};
20 changes: 10 additions & 10 deletions web/packages/base/locales/ar-SA/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "",
"name": "",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "",
"fix_creation_time_options": "",
"fix_creation_time_completed": "",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/be-BY/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "",
"name": "",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "",
"fix_creation_time_options": "",
"fix_creation_time_completed": "",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/bg-BG/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "",
"name": "",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "",
"fix_creation_time_options": "",
"fix_creation_time_completed": "",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/ca-ES/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "",
"name": "",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "",
"fix_creation_time_options": "",
"fix_creation_time_completed": "",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/da-DK/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "",
"name": "",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "",
"fix_creation_time_options": "",
"fix_creation_time_completed": "",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/de-DE/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "Ältestem",
"last_updated": "Zuletzt aktualisiert",
"name": "",
"FIX_CREATION_TIME": "Zeit reparieren",
"FIX_CREATION_TIME_IN_PROGRESS": "Zeit wird repariert",
"CREATION_TIME_UPDATED": "Datei-Zeit aktualisiert",
"UPDATE_CREATION_TIME_NOT_STARTED": "Wählen Sie die Option, die Sie verwenden möchten",
"UPDATE_CREATION_TIME_COMPLETED": "Alle Dateien erfolgreich aktualisiert",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "Aktualisierung der Dateizeit für einige Dateien fehlgeschlagen, bitte versuche es erneut",
"fix_creation_time": "Zeit reparieren",
"fix_creation_time_in_progress": "Zeit wird repariert",
"fix_creation_time_file_updated": "Datei-Zeit aktualisiert",
"fix_creation_time_options": "Wählen Sie die Option, die Sie verwenden möchten",
"fix_creation_time_completed": "Alle Dateien erfolgreich aktualisiert",
"fix_creation_time_completed_with_errors": "Aktualisierung der Dateizeit für einige Dateien fehlgeschlagen, bitte versuche es erneut",
"CAPTION_CHARACTER_LIMIT": "Maximal 5000 Zeichen",
"DATE_TIME_ORIGINAL": "Exif:DateTimeOriginal",
"DATE_TIME_DIGITIZED": "Exif:DateTimeDigitized",
"METADATA_DATE": "Exif:MetadataDate",
"CUSTOM_TIME": "Benutzerdefinierte Zeit",
"exif_date_time_original": "Exif:DateTimeOriginal",
"exif_date_time_digitized": "Exif:DateTimeDigitized",
"exif_metadata_date": "Exif:MetadataDate",
"custom_time": "Benutzerdefinierte Zeit",
"sharing_details": "Details teilen",
"modify_sharing": "Freigabe ändern",
"ADD_COLLABORATORS": "Bearbeiter hinzufügen",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/el-GR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "",
"last_updated": "Τελευταία ενημέρωση",
"name": "Όνομα",
"FIX_CREATION_TIME": "",
"FIX_CREATION_TIME_IN_PROGRESS": "",
"CREATION_TIME_UPDATED": "Ο χρόνος αρχείου ενημερώθηκε",
"UPDATE_CREATION_TIME_NOT_STARTED": "",
"UPDATE_CREATION_TIME_COMPLETED": "Επιτυχής ενημέρωση όλων των αρχείων",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "",
"fix_creation_time": "",
"fix_creation_time_in_progress": "",
"fix_creation_time_file_updated": "Ο χρόνος αρχείου ενημερώθηκε",
"fix_creation_time_options": "",
"fix_creation_time_completed": "Επιτυχής ενημέρωση όλων των αρχείων",
"fix_creation_time_completed_with_errors": "",
"CAPTION_CHARACTER_LIMIT": "",
"DATE_TIME_ORIGINAL": "",
"DATE_TIME_DIGITIZED": "",
"METADATA_DATE": "",
"CUSTOM_TIME": "",
"exif_date_time_original": "",
"exif_date_time_digitized": "",
"exif_metadata_date": "",
"custom_time": "",
"sharing_details": "",
"modify_sharing": "",
"ADD_COLLABORATORS": "",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "Oldest",
"last_updated": "Last updated",
"name": "Name",
"FIX_CREATION_TIME": "Fix time",
"FIX_CREATION_TIME_IN_PROGRESS": "Fixing time",
"CREATION_TIME_UPDATED": "File time updated",
"UPDATE_CREATION_TIME_NOT_STARTED": "Select the option you want to use",
"UPDATE_CREATION_TIME_COMPLETED": "Successfully updated all files",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "File time updation failed for some files, please retry",
"fix_creation_time": "Fix time",
"fix_creation_time_in_progress": "Fixing time",
"fix_creation_time_file_updated": "File time updated",
"fix_creation_time_completed": "Successfully updated all files",
"fix_creation_time_completed_with_errors": "File time updation failed for some files, please retry",
"fix_creation_time_options": "Select the option you want to use",
"exif_date_time_original": "Exif:DateTimeOriginal",
"exif_date_time_digitized": "Exif:DateTimeDigitized",
"exif_metadata_date": "Exif:MetadataDate",
"custom_time": "Custom time",
"CAPTION_CHARACTER_LIMIT": "5000 characters max",
"DATE_TIME_ORIGINAL": "Exif:DateTimeOriginal",
"DATE_TIME_DIGITIZED": "Exif:DateTimeDigitized",
"METADATA_DATE": "Exif:MetadataDate",
"CUSTOM_TIME": "Custom time",
"sharing_details": "Sharing details",
"modify_sharing": "Modify sharing",
"ADD_COLLABORATORS": "Add collaborators",
Expand Down
20 changes: 10 additions & 10 deletions web/packages/base/locales/es-ES/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@
"oldest": "Antiguo",
"last_updated": "Última actualización",
"name": "Nombre",
"FIX_CREATION_TIME": "Fijar hora",
"FIX_CREATION_TIME_IN_PROGRESS": "Fijar hora",
"CREATION_TIME_UPDATED": "Hora del archivo actualizada",
"UPDATE_CREATION_TIME_NOT_STARTED": "Seleccione la cartera que desea utilizar",
"UPDATE_CREATION_TIME_COMPLETED": "Todos los archivos se han actualizado correctamente",
"UPDATE_CREATION_TIME_COMPLETED_WITH_ERROR": "Fallo en la hora del archivo para algunos archivos, por favor inténtelo de nuevo",
"fix_creation_time": "Fijar hora",
"fix_creation_time_in_progress": "Fijar hora",
"fix_creation_time_file_updated": "Hora del archivo actualizada",
"fix_creation_time_options": "Seleccione la cartera que desea utilizar",
"fix_creation_time_completed": "Todos los archivos se han actualizado correctamente",
"fix_creation_time_completed_with_errors": "Fallo en la hora del archivo para algunos archivos, por favor inténtelo de nuevo",
"CAPTION_CHARACTER_LIMIT": "Máximo 5000 caracteres",
"DATE_TIME_ORIGINAL": "Exif: Fecha original",
"DATE_TIME_DIGITIZED": "Exif: Fecha Digitalizado",
"METADATA_DATE": "",
"CUSTOM_TIME": "Hora personalizada",
"exif_date_time_original": "Exif: Fecha original",
"exif_date_time_digitized": "Exif: Fecha Digitalizado",
"exif_metadata_date": "",
"custom_time": "Hora personalizada",
"sharing_details": "Compartir detalles",
"modify_sharing": "Modificar compartir",
"ADD_COLLABORATORS": "",
Expand Down
Loading

0 comments on commit 53c258d

Please sign in to comment.