hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB4e0a329Burak Boduroğlu2 months ago537 commits
| 1 | import { Link, useNavigate } from "@tanstack/solid-router"; |
| 2 | import { Button } from "@/components/ui/button"; |
| 3 | import { IconLogout, IconShieldCheck } from "@/components/ui/icons"; |
| 4 | import { useBuilder } from "@/stores/builder-context"; |
| 5 | import { useT } from "@/stores/preferences-context"; |
| 6 | |
| 7 | /** The operator strip over every builder page: where you are, who you are, the way out. */ |
| 8 | export function BuilderHeader() { |
| 9 | const session = useBuilder(); |
| 10 | const navigate = useNavigate(); |
| 11 | const t = useT(); |
| 12 | |
| 13 | const logout = async () => { |
| 14 | await session.logout(); |
| 15 | void navigate({ to: "/builder/login" }); |
| 16 | }; |
| 17 | |
| 18 | return ( |
| 19 | <div class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border-line bg-surface-base px-4 py-2.5"> |
| 20 | <Link to="/builder" class="flex min-w-0 items-center gap-2 text-sm font-semibold text-text-strong"> |
| 21 | <IconShieldCheck class="h-4 w-4 shrink-0 text-primary" /> |
| 22 | <span class="truncate">{t("builder.console")}</span> |
| 23 | </Link> |
| 24 | <div class="flex min-w-0 items-center gap-3"> |
| 25 | <span class="truncate text-sm text-text-subtle">@{session.builder()?.username}</span> |
| 26 | <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => void logout()}> |
| 27 | <IconLogout class="h-4 w-4" /> |
| 28 | {t("builder.logout")} |
| 29 | </Button> |
| 30 | </div> |
| 31 | </div> |
| 32 | ); |
| 33 | } |