council-nodes.tsx
1,788 bytes
| 1 | import { Gavel } from 'lucide-react'; |
|---|---|
| 2 | import { displayNameForModel, type Participant } from '@/core/types'; |
| 3 | import { participantColor, participantTag } from '@/lib/model-visuals'; |
| 4 | |
| 5 | /** |
| 6 | * The council as a row of colored nodes flowing into a chairman - a compact |
| 7 | * visual of the whole mechanism (members deliberate, a chairman decides). |
| 8 | */ |
| 9 | export function CouncilNodes({ |
| 10 | participants, |
| 11 | chairmanModel, |
| 12 | }: { |
| 13 | participants: Participant[]; |
| 14 | chairmanModel: string; |
| 15 | }) { |
| 16 | return ( |
| 17 | <div className="flex flex-wrap items-center justify-center gap-x-1.5 gap-y-3"> |
| 18 | {participants.map((p, i) => ( |
| 19 | <div key={p.id} className="flex items-center gap-1.5"> |
| 20 | {i > 0 && <Connector />} |
| 21 | <span className="flex items-center gap-1.5"> |
| 22 | <span |
| 23 | className="flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-bold text-white shadow-sm" |
| 24 | style={{ backgroundColor: participantColor(i) }} |
| 25 | > |
| 26 | {participantTag(i)} |
| 27 | </span> |
| 28 | <span className="hidden text-xs text-muted-foreground sm:inline">{p.displayName}</span> |
| 29 | </span> |
| 30 | </div> |
| 31 | ))} |
| 32 | <Connector /> |
| 33 | <span className="flex items-center gap-1.5"> |
| 34 | <span |
| 35 | className="flex h-6 w-6 items-center justify-center rounded-full text-white shadow-sm" |
| 36 | style={{ backgroundColor: 'hsl(var(--stage-synthesis))' }} |
| 37 | > |
| 38 | <Gavel className="h-3 w-3" /> |
| 39 | </span> |
| 40 | <span className="hidden text-xs text-muted-foreground sm:inline"> |
| 41 | {displayNameForModel(chairmanModel)} |
| 42 | </span> |
| 43 | </span> |
| 44 | </div> |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | function Connector() { |
| 49 | return <span className="h-px w-5 bg-gradient-to-r from-transparent via-border to-transparent sm:w-8" />; |
| 50 | } |
| 51 | |