aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/sidebar
diff options
context:
space:
mode:
authorMd Saban <45597394+mdsaban@users.noreply.github.com>2024-06-23 17:39:40 +0530
committerGitHub <noreply@github.com>2024-06-23 13:09:40 +0100
commita63713032ff6b15b80348f724246e7abea40c8a4 (patch)
tree159801228f4702104feb827c3e78236253a79cff /apps/web/components/dashboard/sidebar
parent1071095435ceb7030955bfdd9fc594e1a43c121b (diff)
downloadkarakeep-a63713032ff6b15b80348f724246e7abea40c8a4.tar.zst
ui: Changes for user settings page (#251)
* fix: ui refactoring for user settings page * fix: type error * fix: pr comments
Diffstat (limited to 'apps/web/components/dashboard/sidebar')
-rw-r--r--apps/web/components/dashboard/sidebar/Sidebar.tsx74
1 files changed, 51 insertions, 23 deletions
diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx
index 08ad2936..84a10d2d 100644
--- a/apps/web/components/dashboard/sidebar/Sidebar.tsx
+++ b/apps/web/components/dashboard/sidebar/Sidebar.tsx
@@ -20,6 +20,51 @@ export default async function Sidebar() {
const lists = await api.lists.list();
+ const searchItem = serverConfig.meilisearch
+ ? [
+ {
+ name: "Search",
+ icon: <Search size={18} />,
+ path: "/dashboard/search",
+ },
+ ]
+ : [];
+
+ const adminItem =
+ session.user.role == "admin"
+ ? [
+ {
+ name: "Admin",
+ icon: <Shield size={18} />,
+ path: "/dashboard/admin",
+ },
+ ]
+ : [];
+
+ const menu: {
+ name: string;
+ icon: JSX.Element;
+ path: string;
+ }[] = [
+ {
+ name: "Home",
+ icon: <Home size={18} />,
+ path: "/dashboard/bookmarks",
+ },
+ ...searchItem,
+ {
+ name: "Tags",
+ icon: <Tag size={18} />,
+ path: "/dashboard/tags",
+ },
+ {
+ name: "Settings",
+ icon: <Settings size={18} />,
+ path: "/dashboard/settings",
+ },
+ ...adminItem,
+ ];
+
return (
<aside className="flex h-screen w-60 flex-col gap-5 border-r p-4">
<Link href={"/dashboard/bookmarks"}>
@@ -28,31 +73,14 @@ export default async function Sidebar() {
<Separator />
<div>
<ul className="space-y-2 text-sm font-medium">
- <SidebarItem
- logo={<Home />}
- name="Home"
- path="/dashboard/bookmarks"
- />
- {serverConfig.meilisearch && (
- <SidebarItem
- logo={<Search />}
- name="Search"
- path="/dashboard/search"
- />
- )}
- <SidebarItem logo={<Tag />} name="Tags" path="/dashboard/tags" />
- <SidebarItem
- logo={<Settings />}
- name="Settings"
- path="/dashboard/settings"
- />
- {session.user.role == "admin" && (
+ {menu.map((item) => (
<SidebarItem
- logo={<Shield />}
- name="Admin"
- path="/dashboard/admin"
+ key={item.name}
+ logo={item.icon}
+ name={item.name}
+ path={item.path}
/>
- )}
+ ))}
</ul>
</div>
<Separator />