-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Redesign the settings page and move it to its own layout
- Loading branch information
1 parent
801ba36
commit eb7da99
Showing
23 changed files
with
165 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import AISettings from "@/components/settings/AISettings"; | ||
|
||
export default function AISettingsPage() { | ||
return <AISettings />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ApiKeySettings from "@/components/settings/ApiKeySettings"; | ||
|
||
export default async function ApiKeysPage() { | ||
return ( | ||
<div className="rounded-md border bg-background p-4"> | ||
<ApiKeySettings /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ImportExport from "@/components/settings/ImportExport"; | ||
|
||
export default function ImportSettingsPage() { | ||
return ( | ||
<div className="rounded-md border bg-background p-4"> | ||
<ImportExport /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ChangePassword } from "@/components/settings/ChangePassword"; | ||
import UserDetails from "@/components/settings/UserDetails"; | ||
|
||
export default async function InfoPage() { | ||
return ( | ||
<div className="rounded-md border bg-background p-4"> | ||
<UserDetails /> | ||
<ChangePassword /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Header from "@/components/dashboard/header/Header"; | ||
import DemoModeBanner from "@/components/DemoModeBanner"; | ||
import MobileSidebar from "@/components/settings/sidebar/ModileSidebar"; | ||
import Sidebar from "@/components/settings/sidebar/Sidebar"; | ||
import { Separator } from "@/components/ui/separator"; | ||
import ValidAccountCheck from "@/components/utils/ValidAccountCheck"; | ||
|
||
import serverConfig from "@hoarder/shared/config"; | ||
|
||
export default async function SettingsLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<div> | ||
<Header /> | ||
<div className="flex min-h-[calc(100vh-64px)] w-screen flex-col sm:h-[calc(100vh-64px)] sm:flex-row"> | ||
<ValidAccountCheck /> | ||
<div className="hidden flex-none sm:flex"> | ||
<Sidebar /> | ||
</div> | ||
<main className="flex-1 bg-muted sm:overflow-y-auto"> | ||
{serverConfig.demoMode && <DemoModeBanner />} | ||
<div className="block w-full sm:hidden"> | ||
<MobileSidebar /> | ||
<Separator /> | ||
</div> | ||
<div className="min-h-30 container p-4">{children}</div> | ||
</main> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { redirect } from "next/navigation"; | ||
|
||
export default function SettingsHomepage() { | ||
redirect("/settings/info"); | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import MobileSidebarItem from "@/components/shared/sidebar/ModileSidebarItem"; | ||
|
||
import { settingsSidebarItems } from "./items"; | ||
|
||
export default async function MobileSidebar() { | ||
return ( | ||
<aside className="w-full"> | ||
<ul className="flex justify-between space-x-2 border-b-black px-5 py-2 pt-5"> | ||
{settingsSidebarItems.map((item) => ( | ||
<MobileSidebarItem | ||
key={item.name} | ||
logo={item.icon} | ||
path={item.path} | ||
/> | ||
))} | ||
</ul> | ||
</aside> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { redirect } from "next/navigation"; | ||
import SidebarItem from "@/components/shared/sidebar/SidebarItem"; | ||
import { getServerAuthSession } from "@/server/auth"; | ||
|
||
import serverConfig from "@hoarder/shared/config"; | ||
|
||
import { settingsSidebarItems } from "./items"; | ||
|
||
export default async function Sidebar() { | ||
const session = await getServerAuthSession(); | ||
if (!session) { | ||
redirect("/"); | ||
} | ||
|
||
return ( | ||
<aside className="flex h-[calc(100vh-64px)] w-60 flex-col gap-5 border-r p-4 "> | ||
<div> | ||
<ul className="space-y-2 text-sm font-medium"> | ||
{settingsSidebarItems.map((item) => ( | ||
<SidebarItem | ||
key={item.name} | ||
logo={item.icon} | ||
name={item.name} | ||
path={item.path} | ||
/> | ||
))} | ||
</ul> | ||
</div> | ||
<div className="mt-auto flex items-center border-t pt-2 text-sm text-gray-400"> | ||
Hoarder v{serverConfig.serverVersion} | ||
</div> | ||
</aside> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
import { ArrowLeft, Download, KeyRound, Sparkles, User } from "lucide-react"; | ||
|
||
export const settingsSidebarItems: { | ||
name: string; | ||
icon: JSX.Element; | ||
path: string; | ||
}[] = [ | ||
{ | ||
name: "Back To App", | ||
icon: <ArrowLeft size={18} />, | ||
path: "/dashboard/bookmarks", | ||
}, | ||
{ | ||
name: "User Info", | ||
icon: <User size={18} />, | ||
path: "/settings/info", | ||
}, | ||
{ | ||
name: "AI Settings", | ||
icon: <Sparkles size={18} />, | ||
path: "/settings/ai", | ||
}, | ||
{ | ||
name: "Import / Export", | ||
icon: <Download size={18} />, | ||
path: "/settings/import", | ||
}, | ||
{ | ||
name: "API Keys", | ||
icon: <KeyRound size={18} />, | ||
path: "/settings/api-keys", | ||
}, | ||
]; |
File renamed without changes.
File renamed without changes.