hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { Show, createMemo } from "solid-js"; |
| 2 | import { Link } from "@tanstack/solid-router"; |
| 3 | import { IconMessage } from "@/components/ui/icons"; |
| 4 | import { useShellFeed } from "@/stores/shell-feed-context"; |
| 5 | import { useT } from "@/stores/preferences-context"; |
| 6 | |
| 7 | export function ShellMessagesButton() { |
| 8 | const feed = useShellFeed(); |
| 9 | const t = useT(); |
| 10 | const unread = createMemo(() => feed.unreadMessages().total); |
| 11 | |
| 12 | return ( |
| 13 | <Link |
| 14 | to="/messages" |
| 15 | class="topbar-control relative flex h-9 w-9 items-center justify-center rounded-xl focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" |
| 16 | aria-label={`${t("nav.messages")}${unread() ? `: ${unread()} ${t("rightPanel.unreadBadge")}` : ""}`} |
| 17 | title={t("nav.messages")} |
| 18 | > |
| 19 | <IconMessage class="h-4 w-4" /> |
| 20 | <Show when={unread() > 0}> |
| 21 | <span |
| 22 | class="absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[11px] font-bold text-destructive-foreground ring-2 ring-background" |
| 23 | aria-hidden="true" |
| 24 | > |
| 25 | {unread() > 9 ? "9+" : unread()} |
| 26 | </span> |
| 27 | </Show> |
| 28 | </Link> |
| 29 | ); |
| 30 | } |