Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix dialog

Manav Rathi1548bcd37808
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx
index e08aacb3f5..f2ef890b40 100644
--- a/web/apps/accounts/src/pages/_app.tsx
+++ b/web/apps/accounts/src/pages/_app.tsx
@@ -6,10 +6,7 @@ import { accountLogout } from "@ente/accounts/services/logout";
import { APPS, APP_TITLES } from "@ente/shared/apps/constants";
import { Overlay } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
-import type {
- DialogBoxAttributesV2,
- SetDialogBoxAttributesV2,
-} from "@ente/shared/components/DialogBoxV2/types";
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { AppNavbar } from "@ente/shared/components/Navbar/app";
import { useLocalState } from "@ente/shared/hooks/useLocalState";
@@ -28,7 +25,7 @@ import "styles/global.css";
interface AppContextProps {
isMobile: boolean;
showNavBar: (show: boolean) => void;
- setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
+ setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
logout: () => void;
}
@@ -39,8 +36,9 @@ export default function App({ Component, pageProps }: AppProps) {
const [showNavbar, setShowNavBar] = useState(false);
- const [dialogBoxAttributeV2, setDialogBoxAttributesV2] =
- useState<DialogBoxAttributesV2>();
+ const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState<
+ DialogBoxAttributesV2 | undefined
+ >();
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
@@ -106,8 +104,7 @@ export default function App({ Component, pageProps }: AppProps) {
value={{
isMobile,
showNavBar,
- setDialogBoxAttributesV2:
- setDialogBoxAttributesV2 as any,
+ setDialogBoxAttributesV2,
logout,
}}
>
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index bf1167ee27..a01b8fb8d1 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -12,10 +12,7 @@ import {
} from "@ente/shared/apps/constants";
import { Overlay } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
-import type {
- DialogBoxAttributesV2,
- SetDialogBoxAttributesV2,
-} from "@ente/shared/components/DialogBoxV2/types";
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { MessageContainer } from "@ente/shared/components/MessageContainer";
import { AppNavbar } from "@ente/shared/components/Navbar/app";
@@ -43,7 +40,7 @@ type AppContextType = {
themeColor: THEME_COLOR;
setThemeColor: (themeColor: THEME_COLOR) => void;
somethingWentWrong: () => void;
- setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
+ setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
logout: () => void;
};
@@ -59,8 +56,9 @@ export default function App({ Component, pageProps }: AppProps) {
const [showNavbar, setShowNavBar] = useState(false);
const isLoadingBarRunning = useRef<boolean>(false);
const loadingBar = useRef<LoadingBarRef>(null);
- const [dialogBoxAttributeV2, setDialogBoxAttributesV2] =
- useState<DialogBoxAttributesV2>({});
+ const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState<
+ DialogBoxAttributesV2 | undefined
+ >();
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
const isMobile = useMediaQuery("(max-width:428px)");
const [themeColor, setThemeColor] = useLocalState(
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index d9df703b7a..0c8084c59b 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -18,10 +18,7 @@ import {
SetDialogBoxAttributes,
} from "@ente/shared/components/DialogBox/types";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
-import type {
- DialogBoxAttributesV2,
- SetDialogBoxAttributesV2,
-} from "@ente/shared/components/DialogBoxV2/types";
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { MessageContainer } from "@ente/shared/components/MessageContainer";
import { AppNavbar } from "@ente/shared/components/Navbar/app";
@@ -96,7 +93,7 @@ type AppContextType = {
themeColor: THEME_COLOR;
setThemeColor: (themeColor: THEME_COLOR) => void;
somethingWentWrong: () => void;
- setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
+ setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
isCFProxyDisabled: boolean;
setIsCFProxyDisabled: (disabled: boolean) => void;
logout: () => void;
@@ -118,8 +115,9 @@ export default function App({ Component, pageProps }: AppProps) {
const isLoadingBarRunning = useRef(false);
const loadingBar = useRef(null);
const [dialogMessage, setDialogMessage] = useState<DialogBoxAttributes>();
- const [dialogBoxAttributeV2, setDialogBoxAttributesV2] =
- useState<DialogBoxAttributesV2>();
+ const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState<
+ DialogBoxAttributesV2 | undefined
+ >();
useState<DialogBoxAttributes>(null);
const [messageDialogView, setMessageDialogView] = useState(false);
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
diff --git a/web/packages/shared/apps/types.ts b/web/packages/shared/apps/types.ts
index 4c189ee0e3..6c6e4fe1a4 100644
--- a/web/packages/shared/apps/types.ts
+++ b/web/packages/shared/apps/types.ts
@@ -1,12 +1,12 @@
import { TwoFactorType } from "@ente/accounts/constants/twofactor";
-import type { SetDialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import { APPS } from "./constants";
export interface PageProps {
appContext: {
showNavBar: (show: boolean) => void;
isMobile: boolean;
- setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
+ setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
logout: () => void;
};
appName: APPS;
diff --git a/web/packages/shared/components/DialogBoxV2/index.tsx b/web/packages/shared/components/DialogBoxV2/index.tsx
index a0e226c87f..aa01731568 100644
--- a/web/packages/shared/components/DialogBoxV2/index.tsx
+++ b/web/packages/shared/components/DialogBoxV2/index.tsx
@@ -15,7 +15,7 @@ import type { DialogBoxAttributesV2 } from "./types";
type IProps = React.PropsWithChildren<
Omit<DialogProps, "onClose"> & {
onClose: () => void;
- attributes: DialogBoxAttributesV2;
+ attributes?: DialogBoxAttributesV2;
}
>;
diff --git a/web/packages/shared/components/DialogBoxV2/types.ts b/web/packages/shared/components/DialogBoxV2/types.ts
index dbb5b11a26..f2ac31f0b1 100644
--- a/web/packages/shared/components/DialogBoxV2/types.ts
+++ b/web/packages/shared/components/DialogBoxV2/types.ts
@@ -39,7 +39,3 @@ export interface DialogBoxAttributesV2 {
}[];
buttonDirection?: "row" | "column";
}
-
-export type SetDialogBoxAttributesV2 = React.Dispatch<
- React.SetStateAction<DialogBoxAttributesV2>
->;