Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web/src/sheet/SheetStatusBar.tsx from fsanyoto/runloopable: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/spaces/fsanyoto/runloopable/resolve/main/web/src/sheet/SheetStatusBar.tsx
- Command line
-
hf download hf://spaces/fsanyoto/runloopable/web/src/sheet/SheetStatusBar.tsx
-
curl -L -o SheetStatusBar.tsx https://huggingface.co/spaces/fsanyoto/runloopable/resolve/main/web/src/sheet/SheetStatusBar.tsx
1.79 kB
| // --------------------------------------------------------------------------------------------- | |
| // sheet/SheetStatusBar.tsx — S72-T65 (instruction 27, ruling R108 g). | |
| // | |
| // The strip under the grid that shows Average, Count and Sum for two or more selected cells, at | |
| // its right end, in Excel's order. The strip keeps its height when it is empty, so selecting | |
| // cells never resizes the canvas above it. It matches `customer-grid/summary/SummaryBar.tsx`'s | |
| // look (height, type size, muted label, tabular value) and does not import it. | |
| // --------------------------------------------------------------------------------------------- | |
| import { formatStat } from "./sheetSelectionStats"; | |
| import type { SelectionStats } from "./sheetSelectionStats"; | |
| import "../styles/sdlc72/sheet-status.css"; | |
| interface SheetStatusBarProps { | |
| /** Null when fewer than two cells are selected. */ | |
| stats: SelectionStats | null; | |
| } | |
| export default function SheetStatusBar({ stats }: SheetStatusBarProps) { | |
| const items: { label: string; value: string }[] = []; | |
| if (stats && stats.count > 0) { | |
| if (stats.average !== null) items.push({ label: "Average", value: formatStat(stats.average, stats.formatCell) }); | |
| items.push({ label: "Count", value: formatStat(stats.count, null) }); | |
| if (stats.average !== null) items.push({ label: "Sum", value: formatStat(stats.sum, stats.formatCell) }); | |
| } | |
| return ( | |
| <div className="sheet-status" role="status" aria-label="Selection summary" aria-atomic="true"> | |
| {items.map((item) => ( | |
| <span key={item.label} className="sheet-status-item" data-stat={item.label}> | |
| <span className="sheet-status-label">{item.label}</span> | |
| <span className="sheet-status-value">{item.value}</span> | |
| </span> | |
| ))} | |
| </div> | |
| ); | |
| } | |