8058
Ir
irvc / files
irvc / web / src / ui / Misc.tsx
1.7 KB
1import type { ReactNode } from "react"; 2import { HeadphoneOff, MicOff } from "lucide-react"; 3import { cn } from "cn"; 4 5// Dot is the shared presence/speaking indicator. 6export function Dot({ on, className }: { on: boolean; className?: string }) { 7 return ( 8 <span 9 className={cn( 10 "size-2 shrink-0 rounded-full transition-colors", 11 on ? "bg-accent" : "bg-faint/50", 12 className, 13 )} 14 /> 15 ); 16} 17 18// VoiceMarks is the dim "cannot hear me" marker next to a name in every voice 19// roster: microphone muted, deafened, or both. 20export function VoiceMarks({ 21 muted, 22 deafened, 23 className, 24}: { 25 muted: boolean; 26 deafened: boolean; 27 className?: string; 28}) { 29 if (!muted && !deafened) return null; 30 return ( 31 <span className={cn("flex shrink-0 items-center gap-1 text-faint", className)}> 32 {muted && <MicOff role="img" aria-label="microphone muted" className="size-3" />} 33 {deafened && <HeadphoneOff role="img" aria-label="deafened" className="size-3" />} 34 </span> 35 ); 36} 37 38export function Section({ 39 label, 40 className, 41 children, 42}: { 43 label: string; 44 className?: string; 45 children: ReactNode; 46}) { 47 return ( 48 <section className={cn("space-y-2", className)}> 49 <h2 className="section-label px-0">{label}</h2> 50 <div className="space-y-1">{children}</div> 51 </section> 52 ); 53} 54 55export function Spinner({ className }: { className?: string }) { 56 return ( 57 <span 58 className={cn( 59 "inline-block size-4 animate-spin rounded-full border-2 border-line border-t-accent", 60 className, 61 )} 62 /> 63 ); 64} 65 66export function Centered({ children }: { children: ReactNode }) { 67 return ( 68 <div className="grid flex-1 place-items-center p-6 text-sm text-muted">{children}</div> 69 ); 70}