forked from hoarder-app/hoarder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(web): Introduce a new sticky navbar. Fixes 520 (hoarder-app#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>
- Loading branch information
1 parent
e2644eb
commit 1f768be
Showing
12 changed files
with
116 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
import React from "react"; | ||
import Bookmarks from "@/components/dashboard/bookmarks/Bookmarks"; | ||
import GlobalActions from "@/components/dashboard/GlobalActions"; | ||
import { SearchInput } from "@/components/dashboard/search/SearchInput"; | ||
|
||
export default async function BookmarksPage() { | ||
return ( | ||
<div> | ||
<div className="flex gap-2"> | ||
<SearchInput /> | ||
<GlobalActions /> | ||
</div> | ||
<div className="my-4"> | ||
<Bookmarks query={{ archived: false }} showEditorCard={true} /> | ||
</div> | ||
<Bookmarks query={{ archived: false }} showEditorCard={true} /> | ||
</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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from "react"; | ||
import Link from "next/link"; | ||
import { redirect } from "next/navigation"; | ||
import GlobalActions from "@/components/dashboard/GlobalActions"; | ||
import ProfileOptions from "@/components/dashboard/header/ProfileOptions"; | ||
import { SearchInput } from "@/components/dashboard/search/SearchInput"; | ||
import HoarderLogo from "@/components/HoarderIcon"; | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipTrigger, | ||
} from "@/components/ui/tooltip"; | ||
import { getServerAuthSession } from "@/server/auth"; | ||
import { Settings, Shield } from "lucide-react"; | ||
|
||
export default async function Header() { | ||
const session = await getServerAuthSession(); | ||
if (!session) { | ||
redirect("/"); | ||
} | ||
|
||
const adminItem = | ||
session.user.role == "admin" | ||
? [ | ||
{ | ||
name: "Admin", | ||
icon: <Shield size={18} />, | ||
path: "/dashboard/admin", | ||
}, | ||
] | ||
: []; | ||
|
||
const headerItems = [ | ||
...adminItem, | ||
{ | ||
name: "Settings", | ||
icon: <Settings size={18} />, | ||
path: "/dashboard/settings", | ||
}, | ||
]; | ||
|
||
return ( | ||
<header className="sticky left-0 right-0 top-0 z-50 flex h-16 items-center justify-between overflow-x-auto overflow-y-hidden bg-background p-4 shadow"> | ||
<div className="hidden items-center sm:flex"> | ||
<Link href={"/dashboard/bookmarks"} className="w-56"> | ||
<HoarderLogo height={20} gap="8px" /> | ||
</Link> | ||
</div> | ||
<div className="flex w-full gap-2"> | ||
<SearchInput className="min-w-40 bg-muted" /> | ||
<GlobalActions /> | ||
</div> | ||
<div className="hidden items-center sm:flex"> | ||
{headerItems.map((item) => ( | ||
<Tooltip key={item.name} delayDuration={0}> | ||
<TooltipTrigger asChild> | ||
<Button variant="ghost"> | ||
<Link href={item.path} className="flex items-center"> | ||
{item.icon} | ||
</Link> | ||
</Button> | ||
</TooltipTrigger> | ||
<TooltipContent side="bottom">{item.name}</TooltipContent> | ||
</Tooltip> | ||
))} | ||
<ProfileOptions /> | ||
</div> | ||
</header> | ||
); | ||
} |
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
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