Skip to content

Commit 73ef076

Browse files
feat(settings): Improve settings UI and add new tabs (#817)
1 parent fe6e35d commit 73ef076

File tree

4 files changed

+82
-133
lines changed

4 files changed

+82
-133
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export * from "./main-sidebar";
2-
export * from "./settings-header";
31
export * from "./tab-icon";
42
export * from "./templates-sidebar";
53
export * from "./types";

apps/desktop/src/components/settings/components/main-sidebar.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

apps/desktop/src/components/settings/components/settings-header.tsx

Lines changed: 0 additions & 73 deletions
This file was deleted.

apps/desktop/src/routes/app.settings.tsx

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import { Trans, useLingui } from "@lingui/react/macro";
12
import { createFileRoute, useNavigate, useSearch } from "@tanstack/react-router";
23
import { zodValidator } from "@tanstack/zod-adapter";
34
import { z } from "zod";
45

5-
import { MainSidebar, SettingsHeader, type Tab, TABS } from "@/components/settings/components";
6+
import { TabIcon } from "@/components/settings/components/tab-icon";
7+
import { type Tab, TABS } from "@/components/settings/components/types";
68
import { Calendar, Feedback, General, Lab, LocalAI, Notifications, Sound } from "@/components/settings/views";
9+
import { cn } from "@hypr/ui/lib/utils";
710

811
const schema = z.object({
912
tab: z.enum(TABS.map(t => t.name) as [Tab, ...Tab[]]).default("general"),
@@ -18,29 +21,100 @@ export const Route = createFileRoute(PATH)({
1821
function Component() {
1922
const navigate = useNavigate();
2023
const search = useSearch({ from: PATH });
24+
const { t } = useLingui();
2125

2226
const handleClickTab = (tab: Tab) => {
2327
navigate({ to: PATH, search: { ...search, tab } });
2428
};
2529

30+
const getTabTitle = (tab: string) => {
31+
switch (tab) {
32+
case "general":
33+
return t`General`;
34+
case "profile":
35+
return t`Profile`;
36+
case "ai":
37+
return t`AI`;
38+
case "calendar":
39+
return t`Calendar`;
40+
case "notifications":
41+
return t`Notifications`;
42+
case "templates":
43+
return t`Templates`;
44+
case "extensions":
45+
return t`Extensions`;
46+
case "team":
47+
return t`Team`;
48+
case "billing":
49+
return t`Billing`;
50+
default:
51+
return tab;
52+
}
53+
};
54+
2655
return (
27-
<div className="relative flex h-screen w-screen overflow-hidden">
28-
<div className="flex h-full w-full flex-col overflow-hidden bg-background">
56+
<div className="flex h-full overflow-hidden">
57+
<div className="flex-1">
58+
{/* Sidebar */}
2959
<div className="flex h-full">
3060
<div className="w-60 border-r">
3161
<div
3262
data-tauri-drag-region
3363
className="flex items-center h-11 justify-end px-2"
3464
/>
3565

36-
<MainSidebar current={search.tab} onTabClick={handleClickTab} />
66+
<div className="flex h-full flex-col overflow-hidden">
67+
<div className="flex-1 overflow-y-auto p-2">
68+
<div className="space-y-1">
69+
{TABS.map((tab) => (
70+
<button
71+
key={tab.name}
72+
className={cn(
73+
"flex w-full items-center gap-2 rounded-lg p-2 text-sm text-neutral-600 hover:bg-neutral-100",
74+
search.tab === tab.name && "bg-neutral-100 font-medium",
75+
)}
76+
onClick={() => handleClickTab(tab.name)}
77+
>
78+
<TabIcon tab={tab.name} />
79+
<span>
80+
{tab.name === "general"
81+
? <Trans>General</Trans>
82+
: tab.name === "calendar"
83+
? <Trans>Calendar</Trans>
84+
: tab.name === "notifications"
85+
? <Trans>Notifications</Trans>
86+
: tab.name === "sound"
87+
? <Trans>Sound</Trans>
88+
: tab.name === "ai"
89+
? <Trans>AI</Trans>
90+
: tab.name === "lab"
91+
? <Trans>Lab</Trans>
92+
: tab.name === "feedback"
93+
? <Trans>Feedback</Trans>
94+
: null}
95+
</span>
96+
</button>
97+
))}
98+
</div>
99+
</div>
100+
</div>
37101
</div>
38102

103+
{/* Main Content */}
39104
<div className="flex-1 flex h-full w-full flex-col overflow-hidden">
40-
<SettingsHeader
41-
current={search.tab}
42-
/>
43-
<div className="flex-1 overflow-y-auto p-6">
105+
{/* Header */}
106+
<header data-tauri-drag-region className="h-11 w-full flex items-center justify-between border-b px-2">
107+
<div className="w-40" data-tauri-drag-region></div>
108+
109+
<h1 className="text-md font-semibold capitalize" data-tauri-drag-region>
110+
{getTabTitle(search.tab)}
111+
</h1>
112+
113+
<div className="w-40" data-tauri-drag-region></div>
114+
</header>
115+
116+
{/* Actual Content */}
117+
<div className="flex-1 overflow-y-auto p-6 w-full">
44118
{search.tab === "general" && <General />}
45119
{search.tab === "calendar" && <Calendar />}
46120
{search.tab === "notifications" && <Notifications />}

0 commit comments

Comments
 (0)