From 88f975885cbe05cf9ce8a5a7e99c7c634befecad Mon Sep 17 00:00:00 2001
From: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Fri, 7 Nov 2025 22:39:56 -0700
Subject: [PATCH] update app info part to be at bottom of settings on mobile
---
src/pages/Settings.tsx | 4 +
src/pages/parts/settings/AppInfoPart.tsx | 123 +++++++++++++++++++++++
src/pages/parts/settings/SidebarPart.tsx | 119 ++--------------------
3 files changed, 133 insertions(+), 113 deletions(-)
create mode 100644 src/pages/parts/settings/AppInfoPart.tsx
diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx
index 4f209711..ddfded72 100644
--- a/src/pages/Settings.tsx
+++ b/src/pages/Settings.tsx
@@ -39,6 +39,7 @@ import { useSubtitleStore } from "@/stores/subtitles";
import { usePreviewThemeStore, useThemeStore } from "@/stores/theme";
import { SubPageLayout } from "./layouts/SubPageLayout";
+import { AppInfoPart } from "./parts/settings/AppInfoPart";
import { PreferencesPart } from "./parts/settings/PreferencesPart";
function SettingsLayout(props: {
@@ -106,6 +107,9 @@ function SettingsLayout(props: {
>
{props.children}
+
);
diff --git a/src/pages/parts/settings/AppInfoPart.tsx b/src/pages/parts/settings/AppInfoPart.tsx
new file mode 100644
index 00000000..30181832
--- /dev/null
+++ b/src/pages/parts/settings/AppInfoPart.tsx
@@ -0,0 +1,123 @@
+import { useTranslation } from "react-i18next";
+import { useNavigate } from "react-router-dom";
+import { useAsync } from "react-use";
+
+import { getBackendMeta } from "@/backend/accounts/meta";
+import { Button } from "@/components/buttons/Button";
+import { Icon, Icons } from "@/components/Icon";
+import { SidebarSection } from "@/components/layout/Sidebar";
+import { useBackendUrl } from "@/hooks/auth/useBackendUrl";
+import { conf } from "@/setup/config";
+import { useAuthStore } from "@/stores/auth";
+
+function SecureBadge(props: { url: string | null }) {
+ const { t } = useTranslation();
+ const secure = props.url ? props.url.startsWith("https://") : false;
+ return (
+
+
+ {t(
+ secure
+ ? "settings.sidebar.info.secure"
+ : "settings.sidebar.info.insecure",
+ )}
+
+ );
+}
+
+export function AppInfoPart() {
+ const { t } = useTranslation();
+ const { account } = useAuthStore();
+ // eslint-disable-next-line no-restricted-globals
+ const hostname = location.hostname;
+ const navigate = useNavigate();
+
+ const backendUrl = useBackendUrl();
+
+ const backendMeta = useAsync(async () => {
+ if (!backendUrl) return;
+ return getBackendMeta(backendUrl);
+ }, [backendUrl]);
+
+ return (
+
+
+ {/* Hostname */}
+
+
+ {t("settings.sidebar.info.hostname")}
+
+
{hostname}
+
+
+ {/* Backend URL */}
+
+
+
{t("settings.sidebar.info.backendUrl")}
+
+
+
+ {backendUrl?.replace(/https?:\/\//, "") ?? "—"}
+
+
+
+ {/* User ID */}
+
+
+ {t("settings.sidebar.info.userId")}
+
+
+ {account?.userId ?? t("settings.sidebar.info.notLoggedIn")}
+
+
+
+ {/* App version */}
+
+
+ {t("settings.sidebar.info.appVersion")}
+
+
+ {conf().APP_VERSION}
+
+
+
+ {/* Backend version */}
+
+
+ {t("settings.sidebar.info.backendVersion")}
+
+
+ {backendMeta.error ? (
+
+ ) : null}
+ {backendMeta.loading ? (
+
+ ) : (
+ backendMeta?.value?.version ||
+ t("settings.sidebar.info.unknownVersion")
+ )}
+
+
+
+
+
+ {t("settings.account.admin.title")}
+
+
+
+
+
+ );
+}
diff --git a/src/pages/parts/settings/SidebarPart.tsx b/src/pages/parts/settings/SidebarPart.tsx
index 36b496a6..ce91313b 100644
--- a/src/pages/parts/settings/SidebarPart.tsx
+++ b/src/pages/parts/settings/SidebarPart.tsx
@@ -1,44 +1,20 @@
import { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
-import { useNavigate } from "react-router-dom";
import Sticky from "react-sticky-el";
-import { useAsync } from "react-use";
-import { getBackendMeta } from "@/backend/accounts/meta";
-import { Button } from "@/components/buttons/Button";
-import { Icon, Icons } from "@/components/Icon";
+import { Icons } from "@/components/Icon";
import { SidebarLink, SidebarSection } from "@/components/layout/Sidebar";
import { Divider } from "@/components/utils/Divider";
-import { useBackendUrl } from "@/hooks/auth/useBackendUrl";
import { useIsMobile } from "@/hooks/useIsMobile";
-import { conf } from "@/setup/config";
-import { useAuthStore } from "@/stores/auth";
+
+import { AppInfoPart } from "./AppInfoPart";
const rem = 16;
-function SecureBadge(props: { url: string | null }) {
- const { t } = useTranslation();
- const secure = props.url ? props.url.startsWith("https://") : false;
- return (
-
-
- {t(
- secure
- ? "settings.sidebar.info.secure"
- : "settings.sidebar.info.insecure",
- )}
-
- );
-}
-
export function SidebarPart() {
const { t } = useTranslation();
const { isMobile } = useIsMobile();
- const { account } = useAuthStore();
- // eslint-disable-next-line no-restricted-globals
- const hostname = location.hostname;
const [activeLink, setActiveLink] = useState("");
- const navigate = useNavigate();
const settingLinks = [
{
@@ -68,13 +44,6 @@ export function SidebarPart() {
},
];
- const backendUrl = useBackendUrl();
-
- const backendMeta = useAsync(async () => {
- if (!backendUrl) return;
- return getBackendMeta(backendUrl);
- }, [backendUrl]);
-
useEffect(() => {
function recheck() {
const windowHeight =
@@ -143,85 +112,9 @@ export function SidebarPart() {
-
-
- {/* Hostname */}
-
-
- {t("settings.sidebar.info.hostname")}
-
-
{hostname}
-
-
- {/* Backend URL */}
-
-
-
{t("settings.sidebar.info.backendUrl")}
-
-
-
- {backendUrl?.replace(/https?:\/\//, "") ?? "—"}
-
-
-
- {/* User ID */}
-
-
- {t("settings.sidebar.info.userId")}
-
-
- {account?.userId ?? t("settings.sidebar.info.notLoggedIn")}
-
-
-
- {/* App version */}
-
-
- {t("settings.sidebar.info.appVersion")}
-
-
- {conf().APP_VERSION}
-
-
-
- {/* Backend version */}
-
-
- {t("settings.sidebar.info.backendVersion")}
-
-
- {backendMeta.error ? (
-
- ) : null}
- {backendMeta.loading ? (
-
- ) : (
- backendMeta?.value?.version ||
- t("settings.sidebar.info.unknownVersion")
- )}
-
-
-
-
-
- {t("settings.account.admin.title")}
-
-
-
-
-
+
);