* feat(desktop): add native host scaffold * feat(webui): track turns and usage in gateway * feat(webui): polish desktop chat experience * feat(apps): add ArcGIS and Joplin logos * feat(desktop): polish shell and shared surfaces * fix(webui): avoid preview chips for glob references * test: align CI expectations for token fallback * feat(webui): preview prompt rail entries * feat(webui): add prompt navigator drawer * style(webui): refine prompt navigator placement * style(webui): align prompt navigator with header actions * style(webui): simplify prompt navigator header * refactor(webui): clean thread resource refresh * feat(desktop): add native reply notifications * fix(webui): preserve desktop restart and replay state * fix(desktop): harden gateway proxy startup * fix(web): fall back when readability is unavailable * fix(desktop): hide window instead of closing on macos * fix(webui): unify desktop header actions * fix(webui): simplify prompt history rows * fix(desktop): log notification delivery failures * chore(desktop): clean source package artifacts * fix(cron): support one-time relative reminders * fix(webui): reveal scroll button in place * Revert "fix(cron): support one-time relative reminders" This reverts commit 4c4661da120a3c7283e0768412bae48604e7390b. * refactor(webui): extract token usage heatmap * docs(desktop): clarify contributor guides --------- Co-authored-by: chengyongru <2755839590@qq.com>
112 lines
2.9 KiB
TypeScript
112 lines
2.9 KiB
TypeScript
import { Menu, Moon, Sun } from "lucide-react";
|
|
import type { ReactNode } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
interface ThreadHeaderProps {
|
|
title: string;
|
|
onToggleSidebar: () => void;
|
|
theme: "light" | "dark";
|
|
onToggleTheme: () => void;
|
|
hideSidebarToggleForHostChrome?: boolean;
|
|
hostChromeTitleInset?: boolean;
|
|
hideThemeButton?: boolean;
|
|
minimal?: boolean;
|
|
promptNavigatorAction?: ReactNode;
|
|
sessionInfoAction?: ReactNode;
|
|
}
|
|
|
|
export function ThreadHeader({
|
|
title,
|
|
onToggleSidebar,
|
|
theme,
|
|
onToggleTheme,
|
|
hideSidebarToggleForHostChrome = false,
|
|
hostChromeTitleInset = false,
|
|
hideThemeButton = false,
|
|
minimal = false,
|
|
promptNavigatorAction,
|
|
sessionInfoAction,
|
|
}: ThreadHeaderProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
"relative z-10 flex items-center justify-between gap-3 px-3 py-2",
|
|
minimal && "h-11",
|
|
!minimal && hostChromeTitleInset && "lg:pl-[128px]",
|
|
)}
|
|
>
|
|
<div className="relative flex min-w-0 items-center gap-2">
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
aria-label={t("thread.header.toggleSidebar")}
|
|
onClick={onToggleSidebar}
|
|
className={cn(
|
|
"h-7 w-7 rounded-md text-muted-foreground hover:bg-accent/35 hover:text-foreground",
|
|
hideSidebarToggleForHostChrome && "lg:hidden",
|
|
)}
|
|
>
|
|
<Menu className="h-3.5 w-3.5" />
|
|
</Button>
|
|
{!minimal ? (
|
|
<div className="flex min-w-0 items-center rounded-md px-1.5 py-1 text-[12px] font-medium text-muted-foreground">
|
|
<span className="max-w-[min(60vw,32rem)] truncate">{title}</span>
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
|
|
<div className="ml-auto flex shrink-0 items-center gap-1">
|
|
{sessionInfoAction}
|
|
{promptNavigatorAction}
|
|
{!hideThemeButton ? (
|
|
<ThemeButton
|
|
theme={theme}
|
|
onToggleTheme={onToggleTheme}
|
|
label={t("thread.header.toggleTheme")}
|
|
/>
|
|
) : null}
|
|
</div>
|
|
|
|
{!minimal ? (
|
|
<div aria-hidden className="pointer-events-none absolute inset-x-0 top-full h-4" />
|
|
) : null}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function ThemeButton({
|
|
theme,
|
|
onToggleTheme,
|
|
label,
|
|
className,
|
|
}: {
|
|
theme: "light" | "dark";
|
|
onToggleTheme: () => void;
|
|
label: string;
|
|
className?: string;
|
|
}) {
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
aria-label={label}
|
|
onClick={onToggleTheme}
|
|
className={cn(
|
|
"host-no-drag h-8 w-8 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground",
|
|
className,
|
|
)}
|
|
>
|
|
{theme === "dark" ? (
|
|
<Sun className="h-4 w-4" />
|
|
) : (
|
|
<Moon className="h-4 w-4" />
|
|
)}
|
|
</Button>
|
|
);
|
|
}
|