- {categories.map((category) => (
-
-
{category}
- {settingsNavigation
- .filter((page) => page.category === category)
- .map((page) => (
-
- ))}
-
- ))}
-
-
-
-
- );
-}
diff --git a/packages/settings/src/manifest.ts b/packages/settings/src/manifest.ts
index 41fe14a..1afdd5a 100644
--- a/packages/settings/src/manifest.ts
+++ b/packages/settings/src/manifest.ts
@@ -8,46 +8,24 @@ import Profile from "./pages/profile";
import Security from "./pages/security";
import Theme from "./pages/theme";
import Hotkeys from "./pages/hotkeys";
+import { settingsNavigation } from "./navigation";
+
+const pageComponents = {
+ profile: Profile,
+ security: Security,
+ chat: Chat,
+ call: Call,
+ cache: Cache,
+ theme: Theme,
+ accessibility: Accessibility,
+ hotkeys: Hotkeys,
+ licenses: Licenses,
+} as const;
export const settingsPages = [
{ path: "/", component: Index },
- {
- category: "account",
- path: "profile",
- label: "Profile",
- component: Profile,
- },
- {
- category: "account",
- path: "security",
- label: "Security",
- component: Security,
- },
- { category: "general", path: "chat", label: "Chat", component: Chat },
- { category: "general", path: "call", label: "Call", component: Call },
- { category: "application", path: "cache", label: "Cache", component: Cache },
- { category: "application", path: "theme", label: "Theme", component: Theme },
- {
- category: "application",
- path: "accessibility",
- label: "Accessibility",
- component: Accessibility,
- },
- {
- category: "application",
- path: "hotkeys",
- label: "Hotkeys",
- component: Hotkeys,
- },
- {
- category: "application",
- path: "licenses",
- label: "Licenses",
- component: Licenses,
- },
+ ...settingsNavigation.map((page) => ({
+ ...page,
+ component: pageComponents[page.path],
+ })),
] as const;
-
-export const settingsNavigation = settingsPages.filter(
- (page): page is Exclude<(typeof settingsPages)[number], { path: "/" }> =>
- page.path !== "/",
-);
diff --git a/packages/settings/src/navigation.ts b/packages/settings/src/navigation.ts
new file mode 100644
index 0000000..b47fae9
--- /dev/null
+++ b/packages/settings/src/navigation.ts
@@ -0,0 +1,31 @@
+export const settingsNavigation = [
+ {
+ category: "account",
+ path: "profile",
+ label: "Profile",
+ },
+ {
+ category: "account",
+ path: "security",
+ label: "Security",
+ },
+ { category: "general", path: "chat", label: "Chat" },
+ { category: "general", path: "call", label: "Call" },
+ { category: "application", path: "cache", label: "Cache" },
+ { category: "application", path: "theme", label: "Theme" },
+ {
+ category: "application",
+ path: "accessibility",
+ label: "Accessibility",
+ },
+ {
+ category: "application",
+ path: "hotkeys",
+ label: "Hotkeys",
+ },
+ {
+ category: "application",
+ path: "licenses",
+ label: "Licenses",
+ },
+] as const;
diff --git a/packages/settings/src/pages/index.tsx b/packages/settings/src/pages/index.tsx
index 803a0c1..b5d04e3 100644
--- a/packages/settings/src/pages/index.tsx
+++ b/packages/settings/src/pages/index.tsx
@@ -1,4 +1,4 @@
-import { SettingsSidebar } from "../layout";
+import { SettingsSidebar } from "../sidebar";
export default function Page() {
return (
diff --git a/packages/settings/src/sidebar.tsx b/packages/settings/src/sidebar.tsx
new file mode 100644
index 0000000..3a2155e
--- /dev/null
+++ b/packages/settings/src/sidebar.tsx
@@ -0,0 +1,48 @@
+import { Button, ClearStorageButton, cn } from "@methanium/ui";
+import { useNavigate } from "@tanstack/react-router";
+
+import { settingsNavigation } from "./navigation";
+
+export function SettingsSidebar({
+ mobile = false,
+ className,
+}: {
+ mobile?: boolean;
+ className?: string;
+}) {
+ const navigate = useNavigate();
+ const categories = [
+ ...new Set(settingsNavigation.map((page) => page.category)),
+ ];
+
+ return (
+
+ {categories.map((category) => (
+
+
{category}
+ {settingsNavigation
+ .filter((page) => page.category === category)
+ .map((page) => (
+
+ ))}
+
+ ))}
+
+
+
+
+ );
+}
diff --git a/packages/user/src/context.tsx b/packages/user/src/context.tsx
index 423661c..8c41aa4 100644
--- a/packages/user/src/context.tsx
+++ b/packages/user/src/context.tsx
@@ -9,13 +9,12 @@ import {
useState,
useSyncExternalStore,
} from "react";
-import { useMTP, type ProtocolMessage } from "@tensamin/mtp";
+import { useMTP } from "@tensamin/mtp";
import {
clientUserStateSchema,
mtp as schemas,
publicUserStateSchema,
- userStateEntrySchema,
} from "@tensamin/shared/data";
import type z from "zod";
import { createCache } from "@tensamin/cache";
@@ -89,7 +88,7 @@ export default function UserProvider(props: { children: ReactNode }) {
);
const revisionsRef = useRef(new Map