diff options
| author | Md Saban <45597394+mdsaban@users.noreply.github.com> | 2024-10-12 18:37:20 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-12 14:07:20 +0100 |
| commit | 1f768be0485bbfa6b542dd24183fe8389acb9355 (patch) | |
| tree | b803eefba19cddfad988b3bd1979b693fbc0f694 /apps/web/components/dashboard/sidebar | |
| parent | e2644ebc11e9521ece054a846f8c993c322a8332 (diff) | |
| download | karakeep-1f768be0485bbfa6b542dd24183fe8389acb9355.tar.zst | |
feature(web): Introduce a new sticky navbar. Fixes 520 (#515)
* ui: add global header
* fix: design fixes
* fix: tests
* fix navbar background, hide y scrollbar and change sidebar footer to show version
---------
Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'apps/web/components/dashboard/sidebar')
4 files changed, 9 insertions, 103 deletions
diff --git a/apps/web/components/dashboard/sidebar/AllLists.tsx b/apps/web/components/dashboard/sidebar/AllLists.tsx index 15bed88a..b6cadea9 100644 --- a/apps/web/components/dashboard/sidebar/AllLists.tsx +++ b/apps/web/components/dashboard/sidebar/AllLists.tsx @@ -47,12 +47,6 @@ export default function AllLists({ path={`/dashboard/favourites`} linkClassName="py-0.5" /> - <SidebarItem - logo={<span className="text-lg">🗄️</span>} - name="Archive" - path={`/dashboard/archive`} - linkClassName="py-0.5" - /> { <CollapsibleBookmarkLists diff --git a/apps/web/components/dashboard/sidebar/ModileSidebar.tsx b/apps/web/components/dashboard/sidebar/ModileSidebar.tsx index 635f63bd..1117dd61 100644 --- a/apps/web/components/dashboard/sidebar/ModileSidebar.tsx +++ b/apps/web/components/dashboard/sidebar/ModileSidebar.tsx @@ -1,8 +1,8 @@ +import ProfileOptions from "@/components/dashboard/header/ProfileOptions"; import HoarderLogoIcon from "@/public/icons/logo-icon.svg"; import { ClipboardList, Search, Settings, Tag } from "lucide-react"; import MobileSidebarItem from "./ModileSidebarItem"; -import SidebarProfileOptions from "./SidebarProfileOptions"; export default async function MobileSidebar() { return ( @@ -16,7 +16,7 @@ export default async function MobileSidebar() { <MobileSidebarItem logo={<ClipboardList />} path="/dashboard/lists" /> <MobileSidebarItem logo={<Tag />} path="/dashboard/tags" /> <MobileSidebarItem logo={<Settings />} path="/dashboard/settings" /> - <SidebarProfileOptions /> + <ProfileOptions /> </ul> </aside> ); diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx index 84a10d2d..13260e07 100644 --- a/apps/web/components/dashboard/sidebar/Sidebar.tsx +++ b/apps/web/components/dashboard/sidebar/Sidebar.tsx @@ -1,16 +1,13 @@ -import Link from "next/link"; import { redirect } from "next/navigation"; -import HoarderLogo from "@/components/HoarderIcon"; import { Separator } from "@/components/ui/separator"; import { api } from "@/server/api/client"; import { getServerAuthSession } from "@/server/auth"; -import { Home, Search, Settings, Shield, Tag } from "lucide-react"; +import { Archive, Home, Search, Tag } from "lucide-react"; import serverConfig from "@hoarder/shared/config"; import AllLists from "./AllLists"; import SidebarItem from "./SidebarItem"; -import SidebarProfileOptions from "./SidebarProfileOptions"; export default async function Sidebar() { const session = await getServerAuthSession(); @@ -30,17 +27,6 @@ export default async function Sidebar() { ] : []; - const adminItem = - session.user.role == "admin" - ? [ - { - name: "Admin", - icon: <Shield size={18} />, - path: "/dashboard/admin", - }, - ] - : []; - const menu: { name: string; icon: JSX.Element; @@ -58,19 +44,14 @@ export default async function Sidebar() { path: "/dashboard/tags", }, { - name: "Settings", - icon: <Settings size={18} />, - path: "/dashboard/settings", + name: "Archive", + icon: <Archive size={18} />, + path: "/dashboard/archive", }, - ...adminItem, ]; return ( - <aside className="flex h-screen w-60 flex-col gap-5 border-r p-4"> - <Link href={"/dashboard/bookmarks"}> - <HoarderLogo height={20} gap="8px" /> - </Link> - <Separator /> + <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"> {menu.map((item) => ( @@ -85,9 +66,8 @@ export default async function Sidebar() { </div> <Separator /> <AllLists initialData={lists} /> - <div className="mt-auto flex justify-between justify-self-end"> - <div className="my-auto"> {session.user.name} </div> - <SidebarProfileOptions /> + <div className="mt-auto flex items-center border-t pt-2"> + Hoarder v{serverConfig.serverVersion} </div> </aside> ); diff --git a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx b/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx deleted file mode 100644 index af3f1548..00000000 --- a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx +++ /dev/null @@ -1,68 +0,0 @@ -"use client"; - -import Link from "next/link"; -import { useToggleTheme } from "@/components/theme-provider"; -import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; -import { LogOut, Moon, MoreHorizontal, Paintbrush, Sun } from "lucide-react"; -import { signOut } from "next-auth/react"; -import { useTheme } from "next-themes"; - -function DarkModeToggle() { - const { theme } = useTheme(); - - if (theme == "dark") { - return ( - <> - <Sun className="mr-2 size-4" /> - <span>Light Mode</span> - </> - ); - } else { - return ( - <> - <Moon className="mr-2 size-4" /> - <span>Dark Mode</span> - </> - ); - } -} - -export default function SidebarProfileOptions() { - const toggleTheme = useToggleTheme(); - return ( - <DropdownMenu> - <DropdownMenuTrigger asChild> - <Button variant="ghost"> - <MoreHorizontal /> - </Button> - </DropdownMenuTrigger> - <DropdownMenuContent className="w-fit"> - <DropdownMenuItem asChild> - <Link href="/dashboard/cleanups"> - <Paintbrush className="mr-2 size-4" /> - Cleanups - </Link> - </DropdownMenuItem> - <DropdownMenuItem onClick={toggleTheme}> - <DarkModeToggle /> - </DropdownMenuItem> - <DropdownMenuItem - onClick={() => - signOut({ - callbackUrl: "/", - }) - } - > - <LogOut className="mr-2 size-4" /> - <span>Sign Out</span> - </DropdownMenuItem> - </DropdownMenuContent> - </DropdownMenu> - ); -} |
