Skip to content

armgit / ente

Public Imported from GitHub
0

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

Avoid a useEffect (eventually)

Manav Rathi8999c7045a8e
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index f71d370626..e39ba3562c 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -237,6 +237,11 @@ export default function App({ Component, pageProps }: AppProps) {
);
const closeDialogBoxV2 = () => setDialogBoxV2View(false);
+ const showMiniDialog = useCallback((attributes: MiniDialogAttributes) => {
+ setDialogBoxAttributesV2(attributes);
+ setDialogBoxV2View(true);
+ }, []);
+
// Use `onGenericError` instead.
const somethingWentWrong = useCallback(
() =>
@@ -277,6 +282,7 @@ export default function App({ Component, pageProps }: AppProps) {
setNotificationAttributes,
themeColor,
setThemeColor,
+ showMiniDialog,
somethingWentWrong,
onGenericError,
setDialogBoxAttributesV2,
diff --git a/web/packages/new/photos/types/context.ts b/web/packages/new/photos/types/context.ts
index 2235c35c11..4c11a9bb01 100644
--- a/web/packages/new/photos/types/context.ts
+++ b/web/packages/new/photos/types/context.ts
@@ -4,6 +4,7 @@ import type { SetDialogBoxAttributes } from "@ente/shared/components/DialogBox/t
import { THEME_COLOR } from "@ente/shared/themes/constants";
import { createContext, useContext } from "react";
import type { SetNotificationAttributes } from "./notification";
+import type { MiniDialogAttributes } from "@/base/components/MiniDialog";
/**
* The type of the React context available to all pages in the photos app.
@@ -17,6 +18,14 @@ export type AppContextT = AccountsContextT & {
* Hide the global activity indicator.
*/
finishLoading: () => void;
+ /**
+ * Show a "mini dialog" with the given attributes.
+ *
+ * Mini dialogs (see {@link AttributedMiniDialog}) are meant for simple
+ * confirmation or notication dialogs. Their appearance and functionality
+ * can be customized by providing relevant {@link MiniDialogAttributes}.
+ */
+ showMiniDialog: (attributes: MiniDialogAttributes) => void;
somethingWentWrong: () => void;
setDialogMessage: SetDialogBoxAttributes;
setNotificationAttributes: SetNotificationAttributes;