mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 03:20:02 +08:00
Ship folder-based workspaces and data migration, daily practice, redesigned provider and model settings, and streaming conversation improvements. Synchronize README translations and document the archive/permanent-delete upgrade behavior in assets/releases/ver1-6-9.md. Reduce initial JavaScript by deduplicating English resources and loading animation features after hydration. Keep the existing route size budgets. Update regression fixtures and browser audits for scoped URLs and the new settings and learning interfaces.
79 lines
2.6 KiB
TypeScript
79 lines
2.6 KiB
TypeScript
"use client";
|
|
|
|
import {
|
|
ResourceReuseControl,
|
|
useResourceReuse,
|
|
} from "@/components/chat/home/ResourceReuse";
|
|
import type { ResourceKind } from "@/lib/resource-reuse";
|
|
|
|
import { X, type LucideIcon } from "lucide-react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
/**
|
|
* Shared header for the fullscreen context pickers (History, Books, Memory,
|
|
* My Agents, Persona, Question Bank). Every picker used to hand-roll the same
|
|
* three-line header: an all-caps, wide-tracked "eyebrow" kind label, a title,
|
|
* and a subtitle.
|
|
*
|
|
* That eyebrow is a Latin-typography idiom — `uppercase` + `tracking-[0.14em]`
|
|
* reads as refined on English, but on CJK it just spreads the glyphs apart and
|
|
* looks loose/unkempt (uppercase is a no-op for Han characters). So this
|
|
* component drops the eyebrow entirely and conveys the "kind" through a tinted
|
|
* icon chip instead: cleaner, script-agnostic, and consistent across pickers.
|
|
*/
|
|
export default function PickerHeader({
|
|
icon: Icon,
|
|
titleId,
|
|
title,
|
|
subtitle,
|
|
onClose,
|
|
trailing,
|
|
resourceKind,
|
|
}: {
|
|
icon: LucideIcon;
|
|
/** id wired to the dialog's `aria-labelledby`. */
|
|
titleId: string;
|
|
/** Already-translated title string. */
|
|
title: string;
|
|
/** Already-translated subtitle string. */
|
|
subtitle: string;
|
|
onClose: () => void;
|
|
/** Optional control rendered between the title block and the close button. */
|
|
trailing?: React.ReactNode;
|
|
resourceKind?: ResourceKind;
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const reuse = useResourceReuse();
|
|
return (
|
|
<div className="flex items-start gap-3.5 border-b border-[var(--border)] px-5 py-4">
|
|
<div className="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--primary)]/10 text-[var(--primary)]">
|
|
<Icon className="h-[18px] w-[18px]" strokeWidth={1.8} />
|
|
</div>
|
|
<div className="min-w-0 flex-1">
|
|
<div className="flex flex-wrap items-center gap-x-3 gap-y-2">
|
|
<h2
|
|
id={titleId}
|
|
className="text-[15px] font-semibold leading-tight text-[var(--foreground)]"
|
|
>
|
|
{title}
|
|
</h2>
|
|
{resourceKind && reuse && (
|
|
<ResourceReuseControl kind={resourceKind} />
|
|
)}
|
|
</div>
|
|
<p className="mt-1 text-[13px] leading-snug text-[var(--muted-foreground)]">
|
|
{subtitle}
|
|
</p>
|
|
</div>
|
|
{trailing}
|
|
<button
|
|
onClick={onClose}
|
|
className="-mr-1 -mt-1 shrink-0 rounded-lg p-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
|
|
aria-label={t("Close")}
|
|
>
|
|
<X size={18} />
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|