SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.8 KB · 29 lines typescript
Raw Blame History
1import type { Lane } from '@/components/charts';2import type { ChangeEvent } from '@/lib/types';34/** Timeline 2.0 lanes: event `category` → lane. Colours are entity-type tokens (prices use the money accent). Server-safe. */5export const TIMELINE_LANES: (Lane & { categories: string[] })[] = [6  { key: 'models', label: 'Models', color: 'var(--type-model)', categories: ['model', 'update'] },7  { key: 'research', label: 'Research', color: 'var(--type-paper)', categories: ['paper'] },8  { key: 'prices', label: 'Prices', color: 'var(--accent-2)', categories: ['price'] },9  { key: 'benchmarks', label: 'Benchmarks', color: 'var(--type-benchmark)', categories: ['benchmark'] },10  { key: 'providers', label: 'Providers', color: 'var(--type-provider)', categories: ['provider'] },11  { key: 'hardware', label: 'Hardware', color: 'var(--type-hardware)', categories: ['hardware'] },12  { key: 'frameworks', label: 'Frameworks', color: 'var(--type-framework)', categories: ['framework', 'repository', 'tool'] },13  { key: 'companies', label: 'Companies', color: 'var(--type-company)', categories: ['company', 'release', 'announcement', 'regulation', 'incident'] },14  { key: 'other', label: 'Other', color: 'var(--type-tool)', categories: [] },15];16const BY_CATEGORY = new Map<string, string>();17for (const l of TIMELINE_LANES) for (const c of l.categories) BY_CATEGORY.set(c, l.key);1819export function laneOf(e: Pick<ChangeEvent, 'category'>): string {20  return BY_CATEGORY.get(e.category) ?? 'other';21}22export function laneColor(key: string): string {23  return TIMELINE_LANES.find((l) => l.key === key)?.color ?? 'var(--type-tool)';24}25/** When the event happened (1.1 `occurred_at`, else effective, else observed). */26export function occurredAt(e: ChangeEvent): string {27  return e.occurred_at ?? e.effective_at ?? e.observed_at;28}29