import { useRef, useState } from 'react'; import { tr } from '../lib/i18n'; import type { CatalogModel } from '../lib/native-catalog'; import { FloatingMenu } from './FloatingMenu'; import { Icon } from './ui'; /** * The model family in the Models navbar: its icon, its name and a chevron. Opening it lists the families of the catalog (Qwen3.8-Flash-Next, * Qwen3.6-35B-A3B, and future ones) to switch between. One family still shows as the same control, so the page looks the same as families arrive. */ export function FamilySwitch({ families, selected, onPick }: { families: CatalogModel[]; selected?: string; onPick: (family: CatalogModel) => void }) { const shown = families.filter(f => f.sizes.length); const missing = families.filter(f => !f.sizes.length && f.available === false); // a model of the update feed this engine does not run: said, never offered const trigger = useRef(null); const [open, setOpen] = useState(false); if (!shown.length) return null; const current = shown.find(f => f.family === selected) ?? shown[0]; return <> {tr(open ? setOpen(false)}> { setOpen(false); if (f.family !== current.family) onPick(f); }}/> : null)} ; } /** The rows of the family menu: the families to pick, then (as notes, not choices) the models of the update feed this engine cannot use, each with the plain reason. */ export function FamilyMenuList({ shown, missing, current, onPick }: { shown: CatalogModel[]; missing: CatalogModel[]; current: CatalogModel; onPick: (family: CatalogModel) => void }) { return (
{shown.map(f => )} {missing.map(f =>
{f.title}{f.unavailable_reason}
)}
); }