Backend fixes: - Fix totalTokens defaulting to 0 when API omits totalTokenCount (now computes prompt+completion) - Fix streaming metadata extraction: unwrap response wrapper in Anthropic/Gemini handlers - Fix Zod schemas: handle SQL SUM(null) with nullable().transform() - Add is_estimated column migration to token_usage table Frontend redesign: - Rewrite Usage page with area charts (nivo/line), horizontal bar model ranking - StatCard: add trend indicators (% vs previous period) and inline SVG sparklines - Premium color palette, prompt/completion ratio bar, top models mini-list - Live indicator with 15s auto-refresh Design system migration: - Standardize all components on Gemini Nexus tokens (rounded-xl, border-white/[0.06]) - Refine UI components, proxy tabs, cloud account list, provider groups
31 lines
985 B
TypeScript
31 lines
985 B
TypeScript
import * as React from 'react';
|
|
import { cn } from '@/lib/utils';
|
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
|
const badgeVariants = cva(
|
|
'inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring/30',
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: 'bg-accent/15 text-accent border border-accent/20',
|
|
secondary: 'bg-secondary text-secondary-foreground border border-white/[0.06]',
|
|
destructive: 'bg-destructive/15 text-red-400 border border-destructive/20',
|
|
outline: 'border border-white/[0.1] text-muted-foreground',
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: 'default',
|
|
},
|
|
},
|
|
);
|
|
|
|
function Badge({
|
|
className,
|
|
variant,
|
|
...props
|
|
}: React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof badgeVariants>) {
|
|
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
}
|
|
|
|
export { Badge, badgeVariants };
|