Files
Kaname/src/components/hub-state-badge.tsx
T
Pascal LinxweilerandClaude Opus 5.5 3603742637 Flag models deleted from the Hub; tag picker, tags in settings, account menu
- Worker checks each model's repo and pinned commit on the Hub every
  UPDATE_CHECK_INTERVAL_HOURS and after failed downloads; missing repos or
  commits are flagged (badge, banner, Status filter) and block new
  downloads. Local files are never touched. "Check now" on the model page.
- Tag picker dropdown ("Create new tag…" first, then existing tags) on the
  model page and in Add model.
- Settings: separate File labels and Tags pages; create tags there. Unused
  tags are no longer deleted automatically.
- Header: app icon, nav with active state, account menu with the OIDC
  profile picture, theme switch and sign out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 22:53:57 +02:00

33 lines
1.2 KiB
TypeScript

import { TriangleAlertIcon } from "lucide-react";
import type { HubState } from "@/lib/db/schema";
import { cn } from "@/lib/utils";
export const HUB_STATE_LABEL: Record<Exclude<HubState, "available">, { label: string; title: string }> = {
repo_missing: {
label: "deleted on Hub",
title: "The repo is no longer on Hugging Face (deleted, or made private). Your local files are kept.",
},
commit_missing: {
label: "commit deleted on Hub",
title: "The pinned commit is no longer on Hugging Face (history rewritten). Your local files are kept.",
},
};
/** Warning badge when a model's repo or pinned commit disappeared from the Hub; nothing otherwise. */
export function HubStateBadge({ state, className }: { state: HubState | null; className?: string }) {
if (!state || state === "available") return null;
const { label, title } = HUB_STATE_LABEL[state];
return (
<span
title={title}
className={cn(
"inline-flex h-5 shrink-0 items-center gap-1 rounded-4xl border border-amber-500/30 bg-amber-500/10 px-2 text-xs font-medium whitespace-nowrap text-amber-700 dark:text-amber-300",
className,
)}
>
<TriangleAlertIcon className="size-3" />
{label}
</span>
);
}