π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Reuse mobile confirmation illustrations
AswinAsokde8ee10c11de
diff --git a/web/apps/photos/public/images/warning-grey.png b/web/apps/photos/public/images/warning-grey.pngnew file mode 100644index 0000000000..df21e1522aBinary files /dev/null and b/web/apps/photos/public/images/warning-grey.png differdiff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsxindex 1ac1775670..da32e3a779 100644--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx@@ -1,4 +1,5 @@import type { RemotePullOpts } from "@/components/gallery";+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import { downloadAndSaveCollectionFiles } from "@/services/save";import {CleanIcon,@@ -195,6 +196,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({if (hasAlbumFiles) {showMiniDialog({title: t("delete_album_title"),+ illustration: <DialogWarningIllustration />,message: (<Transi18nKey={"delete_album_message"}@@ -224,6 +226,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({showMiniDialog({title: t("delete_album_title"),+ illustration: <DialogWarningIllustration />,message: (<Transi18nKey={"delete_album_message_no_photos"}@@ -260,6 +263,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({const confirmEmptyTrash = () =>showMiniDialog({title: t("empty_trash_title"),+ illustration: <DialogWarningIllustration color="red" />,message: t("empty_trash_message"),continue: {text: t("empty_trash"),diff --git a/web/apps/photos/src/components/Collections/EditAlbumDetailsDialog.tsx b/web/apps/photos/src/components/Collections/EditAlbumDetailsDialog.tsxindex c6eb64f832..05e43fbd36 100644--- a/web/apps/photos/src/components/Collections/EditAlbumDetailsDialog.tsx+++ b/web/apps/photos/src/components/Collections/EditAlbumDetailsDialog.tsx@@ -1,3 +1,4 @@+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import CloseIcon from "@mui/icons-material/Close";import {Box,@@ -113,6 +114,7 @@ export const EditAlbumDetailsDialog: React.FC<EditAlbumDetailsDialogProps> = ({if (hasChanges) {showMiniDialog({title: t("discard_changes"),+ illustration: <DialogWarningIllustration color="red" />,message: t("discard_changes_confirm_message"),continue: {text: t("discard"),diff --git a/web/apps/photos/src/components/Collections/useDeleteEmptyAlbums.ts b/web/apps/photos/src/components/Collections/useDeleteEmptyAlbums.tsindex 4a9f727cd5..787f6dfd13 100644--- a/web/apps/photos/src/components/Collections/useDeleteEmptyAlbums.ts+++ b/web/apps/photos/src/components/Collections/useDeleteEmptyAlbums.ts@@ -16,7 +16,9 @@ import {} from "ente-new/photos/services/photos-fdb";import { usePhotosAppContext } from "ente-new/photos/types/context";import { t } from "i18next";+import { createElement } from "react";import { trashFilesDialogAttributes } from "../utils/dialog-attributes";+import { DialogWarningIllustration } from "../utils/DialogWarningIllustration";export const useDeleteEmptyAlbums = (collectionSummaries: CollectionSummary[],@@ -106,6 +108,7 @@ export const useDeleteEmptyAlbums = (showMiniDialog({...attributes,title: t("delete_empty_albums_title"),+ illustration: createElement(DialogWarningIllustration),message: t("delete_empty_albums_message", {count: candidateIDs.length,}),diff --git a/web/apps/photos/src/components/SelectedFileOptions.tsx b/web/apps/photos/src/components/SelectedFileOptions.tsxindex f4e31004b4..5fccdfa458 100644--- a/web/apps/photos/src/components/SelectedFileOptions.tsx+++ b/web/apps/photos/src/components/SelectedFileOptions.tsx@@ -1,5 +1,6 @@import type { CollectionSelectorAttributes } from "@/components/CollectionSelector";import type { GalleryBarMode } from "@/components/gallery/reducer";+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import {getAvailableFileActions,type FileContextAction,@@ -114,6 +115,7 @@ export const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({const handleDeletePermanently = () =>showMiniDialog({title: t("delete_files_title"),+ illustration: <DialogWarningIllustration color="red" />,message: t("delete_files_message"),continue: {text: t("delete"),diff --git a/web/apps/photos/src/components/gallery/PeopleHeader.tsx b/web/apps/photos/src/components/gallery/PeopleHeader.tsxindex 9d54172c9c..b50d3e927f 100644--- a/web/apps/photos/src/components/gallery/PeopleHeader.tsx+++ b/web/apps/photos/src/components/gallery/PeopleHeader.tsx@@ -1,3 +1,4 @@+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";import AddIcon from "@mui/icons-material/Add";import CheckIcon from "@mui/icons-material/Check";@@ -617,6 +618,7 @@ const SuggestionsDialog: React.FC<SuggestionsDialogProps> = ({if (hasUnsavedChanges) {showMiniDialog({message: t("discard_changes_confirm_message"),+ illustration: <DialogWarningIllustration color="red" />,continue: {text: t("discard_changes"),color: "critical",diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsxindex fb9829cf9f..6c77ffafa0 100644--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx@@ -1,4 +1,5 @@import { Export } from "@/components/Export";+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import { downloadAppDialogAttributes } from "@/components/utils/download";import exportService from "@/services/export";import { performSidebarAction as performSidebarRegistryAction } from "@/services/search/sidebar-search-registry";@@ -176,6 +177,7 @@ export const Sidebar: React.FC<SidebarProps> = ({() =>showMiniDialog({message: t("logout_message"),+ illustration: <DialogWarningIllustration />,continue: {text: t("logout"),color: "critical",diff --git a/web/apps/photos/src/components/sidebar/account/SessionsSettings.tsx b/web/apps/photos/src/components/sidebar/account/SessionsSettings.tsxindex 003f79c5b5..21e77c3565 100644--- a/web/apps/photos/src/components/sidebar/account/SessionsSettings.tsx+++ b/web/apps/photos/src/components/sidebar/account/SessionsSettings.tsx@@ -1,3 +1,4 @@+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import CheckIcon from "@mui/icons-material/Check";import DevicesIcon from "@mui/icons-material/Devices";import RefreshIcon from "@mui/icons-material/Refresh";@@ -119,6 +120,7 @@ const SessionsSettingsContents: React.FC<SessionsSettingsContentsProps> = ({showMiniDialog({title: t("terminate_session"),+ illustration: <DialogWarningIllustration />,message: isCurrentDevice ? (t("terminate_session_confirm_message_self")) : (@@ -150,6 +152,9 @@ const SessionsSettingsContents: React.FC<SessionsSettingsContentsProps> = ({} else {showMiniDialog({title: t("error"),+ illustration: (+ <DialogWarningIllustration />+ ),message: t("terminate_session_failed"),});}diff --git a/web/apps/photos/src/components/utils/DialogWarningIllustration.tsx b/web/apps/photos/src/components/utils/DialogWarningIllustration.tsxnew file mode 100644index 0000000000..174a213e56--- /dev/null+++ b/web/apps/photos/src/components/utils/DialogWarningIllustration.tsx@@ -0,0 +1,12 @@+import { Box } from "@mui/material";++export const DialogWarningIllustration: React.FC<{+ color?: "grey" | "red";+}> = ({ color = "grey" }) => (+ <Box+ component="img"+ src={`/images/warning-${color}.png`}+ alt=""+ sx={{ width: 68, height: 64, objectFit: "contain", display: "block" }}+ />+);diff --git a/web/apps/photos/src/components/utils/dialog-attributes.tsx b/web/apps/photos/src/components/utils/dialog-attributes.tsxindex 4ee4f42d8b..a4fb1c27d1 100644--- a/web/apps/photos/src/components/utils/dialog-attributes.tsx+++ b/web/apps/photos/src/components/utils/dialog-attributes.tsx@@ -1,7 +1,7 @@import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";-import { Box } from "@mui/material";import type { MiniDialogAttributes } from "ente-base/components/MiniDialog";import { t } from "i18next";+import { DialogWarningIllustration } from "./DialogWarningIllustration";export const trashFilesDialogAttributes = (count: number,@@ -19,19 +19,7 @@ export const trashFilesDialogAttributes = (count === 1 ? "trash_file_message" : "trash_files_message",),}),- illustration: (- <Box- component="img"- src="/images/warning-red.png"- alt=""- sx={{- width: 68,- height: 64,- objectFit: "contain",- display: "block",- }}- />- ),+ illustration: <DialogWarningIllustration color="red" />,continue: {text: t("move_to_trash"),color: "critical",diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex ede279c3a6..6b30a6fb27 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -1,6 +1,7 @@import { authPageConfig } from "@/auth-page-config";import { AppLockReauthenticationDialog } from "@/components/app-lock/AppLockReauthenticationDialog";import { AppLockSetupError } from "@/components/app-lock/LockScreenContents";+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";import {updateAvailableForDownloadDialogAttributes,updateReadyToInstallDialogAttributes,@@ -170,7 +171,11 @@ const App: React.FC<PhotosAppProps> = ({ Component, pageProps }) => {<CssBaseline enableColorScheme /><ThemedLoadingBar ref={loadingBarRef} />- <AttributedMiniDialog {...miniDialogProps} appearance="centered" />+ <AttributedMiniDialog+ {...miniDialogProps}+ appearance="centered"+ errorIllustration={<DialogWarningIllustration />}+ /><Notification {...notificationProps} />{isDesktop && (diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex c067ca1847..4d197f0eff 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -1,3 +1,4 @@+import { DialogWarningIllustration } from "@/components/utils/DialogWarningIllustration";// TODO: Audit this file (the code here is mostly fine, but needs revisiting// the file it depends on have been audited and their interfaces fixed)./* eslint-disable react-hooks/exhaustive-deps */@@ -1811,6 +1812,7 @@ const Page: React.FC = () => {case "deletePermanently":showMiniDialog({title: t("delete_files_title"),+ illustration: <DialogWarningIllustration color="red" />,message: t("delete_files_message"),continue: {text: t("delete"),diff --git a/web/packages/base/components/MiniDialog.tsx b/web/packages/base/components/MiniDialog.tsxindex 740c73b8d5..78053cd1d2 100644--- a/web/packages/base/components/MiniDialog.tsx+++ b/web/packages/base/components/MiniDialog.tsx@@ -18,6 +18,7 @@ import log from "../log";import { InlineErrorIndicator } from "./ErrorIndicator";export interface MiniDialogAttributes {+ kind?: "error";title?: React.ReactNode;icon?: React.ReactNode;illustration?: React.ReactNode;@@ -41,6 +42,7 @@ export interface MiniDialogAttributes {type MiniDialogProps = Pick<DialogProps, "open" | "sx"> & {appearance?: "default" | "centered";+ errorIllustration?: React.ReactNode;// A new request remounts the content to reset pending/error state.dialogID?: number;onClose: () => void;@@ -58,6 +60,7 @@ const MiniDialogContent: React.FC<React.PropsWithChildren<MiniDialogProps>> = ({children,sx,appearance = "default",+ errorIllustration,}) => {const titleID = useId();const messageID = useId();@@ -71,7 +74,10 @@ const MiniDialogContent: React.FC<React.PropsWithChildren<MiniDialogProps>> = ({const centered = appearance === "centered";const busy = phase === "loading" || phase === "secondary-loading";- const artwork = attributes.illustration ?? attributes.icon;+ const artwork =+ attributes.illustration ??+ (attributes.kind === "error" ? errorIllustration : undefined) ??+ attributes.icon;const resetPhaseAndClose = () => {setPhase(undefined);diff --git a/web/packages/base/components/utils/dialog.tsx b/web/packages/base/components/utils/dialog.tsxindex 221dac0253..5ec412ec05 100644--- a/web/packages/base/components/utils/dialog.tsx+++ b/web/packages/base/components/utils/dialog.tsx@@ -40,6 +40,7 @@ export const errorDialogAttributes = (const message = optionalMessage ?? messageOrTitle;return {+ kind: "error",title,icon: <ErrorOutlinedIcon />,message,