Skip to content

armgit / ente

Public Imported from GitHub
0

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

Inline

Manav Rathi56a71c2cd8aa
diff --git a/web/apps/photos/src/components/Sidebar/DebugSection.tsx b/web/apps/photos/src/components/Sidebar/DebugSection.tsx
index e336374030..e69de29bb2 100644
--- a/web/apps/photos/src/components/Sidebar/DebugSection.tsx
+++ b/web/apps/photos/src/components/Sidebar/DebugSection.tsx
@@ -1,69 +0,0 @@
-import log from "@/next/log";
-import { savedLogs } from "@/next/log-web";
-import { downloadAsFile } from "@ente/shared/utils";
-import Typography from "@mui/material/Typography";
-import { EnteMenuItem } from "components/Menu/EnteMenuItem";
-import { t } from "i18next";
-import { AppContext } from "pages/_app";
-import { useContext, useEffect, useState } from "react";
-import { Trans } from "react-i18next";
-import { isInternalUser } from "utils/user";
-import { testUpload } from "../../../tests/upload.test";
-
-export default function DebugSection() {
- const appContext = useContext(AppContext);
- const [appVersion, setAppVersion] = useState<string | undefined>();
-
- const electron = globalThis.electron;
-
- useEffect(() => {
- electron?.appVersion().then((v) => setAppVersion(v));
- });
-
- const confirmLogDownload = () =>
- appContext.setDialogMessage({
- title: t("DOWNLOAD_LOGS"),
- content: <Trans i18nKey={"DOWNLOAD_LOGS_MESSAGE"} />,
- proceed: {
- text: t("DOWNLOAD"),
- variant: "accent",
- action: downloadLogs,
- },
- close: {
- text: t("CANCEL"),
- },
- });
-
- const downloadLogs = () => {
- log.info("Downloading logs");
- if (electron) electron.openLogDirectory();
- else downloadAsFile(`debug_logs_${Date.now()}.txt`, savedLogs());
- };
-
- return (
- <>
- <EnteMenuItem
- onClick={confirmLogDownload}
- variant="mini"
- label={t("DOWNLOAD_UPLOAD_LOGS")}
- />
- {appVersion && (
- <Typography
- py={"14px"}
- px={"16px"}
- color="text.muted"
- variant="mini"
- >
- {appVersion}
- </Typography>
- )}
- {isInternalUser() && (
- <EnteMenuItem
- variant="secondary"
- onClick={testUpload}
- label={"Test Upload"}
- />
- )}
- </>
- );
-}
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index a93eb23876..b3b672b47d 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -1,6 +1,5 @@
import { Divider, Stack } from "@mui/material";
import { CollectionSummaries } from "types/collection";
-import DebugSection from "./DebugSection";
import ExitSection from "./ExitSection";
import HeaderSection from "./Header";
import HelpSection from "./HelpSection";
@@ -8,6 +7,17 @@ import ShortcutSection from "./ShortcutSection";
import UtilitySection from "./UtilitySection";
import { DrawerSidebar } from "./styledComponents";
import UserDetailsSection from "./userDetailsSection";
+import log from "@/next/log";
+import { savedLogs } from "@/next/log-web";
+import { downloadAsFile } from "@ente/shared/utils";
+import Typography from "@mui/material/Typography";
+import { EnteMenuItem } from "components/Menu/EnteMenuItem";
+import { t } from "i18next";
+import { AppContext } from "pages/_app";
+import { useContext, useEffect, useState } from "react";
+import { Trans } from "react-i18next";
+import { isInternalUser } from "utils/user";
+import { testUpload } from "../../../tests/upload.test";
interface Iprops {
collectionSummaries: CollectionSummaries;
@@ -40,3 +50,61 @@ export default function Sidebar({
</DrawerSidebar>
);
}
+
+const DebugSection: React.FC = () => {
+ const appContext = useContext(AppContext);
+ const [appVersion, setAppVersion] = useState<string | undefined>();
+
+ const electron = globalThis.electron;
+
+ useEffect(() => {
+ electron?.appVersion().then((v) => setAppVersion(v));
+ });
+
+ const confirmLogDownload = () =>
+ appContext.setDialogMessage({
+ title: t("DOWNLOAD_LOGS"),
+ content: <Trans i18nKey={"DOWNLOAD_LOGS_MESSAGE"} />,
+ proceed: {
+ text: t("DOWNLOAD"),
+ variant: "accent",
+ action: downloadLogs,
+ },
+ close: {
+ text: t("CANCEL"),
+ },
+ });
+
+ const downloadLogs = () => {
+ log.info("Downloading logs");
+ if (electron) electron.openLogDirectory();
+ else downloadAsFile(`debug_logs_${Date.now()}.txt`, savedLogs());
+ };
+
+ return (
+ <>
+ <EnteMenuItem
+ onClick={confirmLogDownload}
+ variant="mini"
+ label={t("DOWNLOAD_UPLOAD_LOGS")}
+ />
+ {appVersion && (
+ <Typography
+ py={"14px"}
+ px={"16px"}
+ color="text.muted"
+ variant="mini"
+ >
+ {appVersion}
+ </Typography>
+ )}
+ {isInternalUser() && (
+ <EnteMenuItem
+ variant="secondary"
+ onClick={testUpload}
+ label={"Test Upload"}
+ />
+ )}
+ </>
+ );
+}