PlaceBar
A bar of where a namespace's code runs.
import type { PlaceMix } from "#codebase/tcmts/share"; export function PlaceBar({ mix }: { mix: PlaceMix }) { const total = mix.server + mix.anywhere + mix.browser; const pct = (n: number) => Math.round((n / (total || 1)) * 100); return ( <span className="place" title={total ? `server ${pct(mix.server)}% · anywhere ${pct(mix.anywhere)}% · browser ${pct(mix.browser)}%` : "no code"}> {mix.server > 0 && <span className="srv" style={{ flex: mix.server }} />} {mix.anywhere > 0 && <span className="any" style={{ flex: mix.anywhere }} />} {mix.browser > 0 && <span className="brw" style={{ flex: mix.browser }} />} </span> ); }