Skip to content

armgit / ente

Public Imported from GitHub
0

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

Switch

Manav Rathid665a6a23ab4
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index c44fe8b77a..4dcbfd5192 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -8,6 +8,7 @@ import log from "@/base/log";
import { savedLogs } from "@/base/log-web";
import { customAPIHost } from "@/base/origins";
import { RecoveryKey } from "@/new/photos/components/RecoveryKey";
+import { downloadAppDialogAttributes } from "@/new/photos/components/utils/dialog";
import type { CollectionSummaries } from "@/new/photos/services/collection/ui";
import { AppContext, useAppContext } from "@/new/photos/types/context";
import { downloadString, initiateEmail, openURL } from "@/new/photos/utils/web";
@@ -74,7 +75,6 @@ import {
DUMMY_UNCATEGORIZED_COLLECTION,
TRASH_SECTION,
} from "utils/collection";
-import { getDownloadAppMessage } from "utils/ui";
import { isFamilyAdmin, isPartOfFamily } from "utils/user/family";
import { testUpload } from "../../../tests/upload.test";
import { MemberSubscriptionManage } from "../MemberSubscriptionManage";
@@ -461,13 +461,12 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({ closeSidebar }) => {
const redirectToDeduplicatePage = () => router.push(PAGES.DEDUPLICATE);
- const toggleTheme = () => {
+ const toggleTheme = () =>
setThemeColor(
themeColor === THEME_COLOR.DARK
? THEME_COLOR.LIGHT
: THEME_COLOR.DARK,
);
- };
return (
<>
@@ -501,7 +500,6 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({ closeSidebar }) => {
onClick={showTwoFactor}
label={t("TWO_FACTOR")}
/>
-
<EnteMenuItem
variant="secondary"
onClick={redirectToAccountsPage}
@@ -550,7 +548,7 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({ closeSidebar }) => {
};
const HelpSection: React.FC = () => {
- const { setDialogMessage } = useContext(AppContext);
+ const { showMiniDialog } = useContext(AppContext);
const { openExportModal } = useContext(GalleryContext);
const requestFeature = () =>
@@ -561,7 +559,7 @@ const HelpSection: React.FC = () => {
const handleExport = () =>
isDesktop
? openExportModal()
- : setDialogMessage(getDownloadAppMessage());
+ : showMiniDialog(downloadAppDialogAttributes());
return (
<>
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index b7c30ff0b7..5b09f6811c 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -4,6 +4,7 @@ import type { CollectionMapping, Electron, ZipItem } from "@/base/types/ipc";
import type { Collection } from "@/media/collection";
import { CollectionMappingChoiceDialog } from "@/new/photos/components/CollectionMappingChoiceDialog";
import type { CollectionSelectorAttributes } from "@/new/photos/components/CollectionSelector";
+import { downloadAppDialogAttributes } from "@/new/photos/components/utils/dialog";
import { exportMetadataDirectoryName } from "@/new/photos/services/export";
import type {
FileAndPath,
@@ -40,10 +41,7 @@ import watcher from "services/watch";
import { SetCollections, SetFiles, SetLoading } from "types/gallery";
import { getOrCreateAlbum } from "utils/collection";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
-import {
- getDownloadAppMessage,
- getRootLevelFileWithFolderNotAllowMessage,
-} from "utils/ui";
+import { getRootLevelFileWithFolderNotAllowMessage } from "utils/ui";
import { SetCollectionNamerAttributes } from "../Collections/CollectionNamer";
import UploadProgress from "./UploadProgress";
import {
@@ -705,7 +703,7 @@ export default function Uploader({
if (openZipFileSelector && electron) {
openZipFileSelector();
} else {
- appContext.setDialogMessage(getDownloadAppMessage());
+ appContext.showMiniDialog(downloadAppDialogAttributes());
}
}
};
diff --git a/web/apps/photos/src/utils/ui/index.tsx b/web/apps/photos/src/utils/ui/index.tsx
index 77d1879571..bfe8079f91 100644
--- a/web/apps/photos/src/utils/ui/index.tsx
+++ b/web/apps/photos/src/utils/ui/index.tsx
@@ -8,24 +8,6 @@ import { t } from "i18next";
import { Trans } from "react-i18next";
import { Subscription } from "types/billing";
-export const getDownloadAppMessage = (): DialogBoxAttributes => {
- return {
- title: t("download_app"),
- content: t("download_app_message"),
-
- proceed: {
- text: t("download"),
- action: downloadApp,
- variant: "accent",
- },
- close: {
- text: t("close"),
- },
- };
-};
-
-const downloadApp = () => openURL("https://ente.io/download/desktop");
-
export const getTrashFilesMessage = (
deleteFileHelper,
): DialogBoxAttributes => ({
@@ -71,6 +53,8 @@ export const getUpdateReadyToInstallMessage = ({
staticBackdrop: true,
});
+const downloadApp = () => openURL("https://ente.io/download/desktop");
+
export const getUpdateAvailableForDownloadMessage = ({
version,
}: AppUpdate): DialogBoxAttributes => ({
diff --git a/web/packages/new/photos/components/utils/dialog.ts b/web/packages/new/photos/components/utils/dialog.ts
new file mode 100644
index 0000000000..a2bb87a995
--- /dev/null
+++ b/web/packages/new/photos/components/utils/dialog.ts
@@ -0,0 +1,18 @@
+import type { MiniDialogAttributes } from "@/base/components/MiniDialog";
+import { openURL } from "@/new/photos/utils/web";
+import { t } from "i18next";
+
+export const downloadAppDialogAttributes = (): MiniDialogAttributes => {
+ return {
+ title: t("download_app"),
+ message: t("download_app_message"),
+
+ continue: {
+ text: t("download"),
+ action: downloadApp,
+ },
+ cancel: t("close"),
+ };
+};
+
+const downloadApp = () => openURL("https://ente.io/download/desktop");