import { useState } from 'react'; import { Link, NavLink } from 'react-router'; import { Menu } from 'lucide-react'; import { EditableTitle } from '@/components/EditableTitle'; // import { Menu, Terminal } from 'lucide-react'; // Terminal used by the commented-out web inspector button import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import type { DockItem } from '../Dock'; import { useIsTouch } from '../useIsTouch'; import { UserMenu } from './UserMenu'; import { JobsIndicator } from './JobsIndicator'; import { ThemeSwitcher } from './ThemeSwitcher'; import { RescanButton } from '../Rescan/RescanButton'; import { usePageTitle } from '@/state/usePageTitle'; import { useAuth } from 'hooks/useAuth'; import { useThemeAsset } from '@/components/ui/ThemeProvider'; import { useTranslation } from '@/lib/i18n'; // import { BugReportButton } from '../BugReport/BugReportButton'; // Center title: click to rename this browser tab. The name is kept in sessionStorage, so it survives a // refresh and navigation and dies with the tab — see usePageTitle. `allowEmpty` is what makes clearing // the field hand the tab back to the route's own name. function EditablePageTitle() { const [title, rename] = usePageTitle(); const { t } = useTranslation(); return ( ); } type HeaderProps = { dockItems?: DockItem[]; /** * Stand down for a panel that has taken the whole window. `display: none` rather than an unmount: the * header holds a half-typed tab rename and its own popovers, and a panel going fullscreen is not a * reason to throw those away. It is `fixed`, so hiding it costs no layout shift either. */ hidden?: boolean; }; export function Header({ dockItems, hidden }: HeaderProps) { const [open, setOpen] = useState(false); const isTouch = useIsTouch(); const { user } = useAuth(); const { t } = useTranslation(); // The mark comes from the theme — a white-labelled build replaces it without touching this file. const logo = useThemeAsset('--logo-src'); return (
{/* Centered, editable page title */}
{isTouch && dockItems && ( )} {/* A background-image, not an ``: CSS cannot set a `src`, and a white-labelled build must be able to replace the mark from its theme rather than by editing this file. `role` and `aria-label` keep it announced now that it is not an image element. */}
{/* Web inspector (eruda dev console) — hidden */} {/* Bug Report — hidden */} {/* */} {/* Owner only, and tidiness rather than access control — /jobs stays reachable and the rescan endpoint is gated server-side, because a hidden button is not a permission. */} {user?.role === 'Super Admin' && ( <> )}
{isTouch && dockItems && ( {t('header.navigation')} )}
); }