Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web/src/apps/amazon-operator/DashboardAdapter.tsx from fsanyoto/runloopable: direct link, hf CLI and curl.
- Browser
- Download file 2 kB
-
https://huggingface.co/spaces/fsanyoto/runloopable/resolve/main/web/src/apps/amazon-operator/DashboardAdapter.tsx
- Command line
-
hf download hf://spaces/fsanyoto/runloopable/web/src/apps/amazon-operator/DashboardAdapter.tsx
-
curl -L -o DashboardAdapter.tsx https://huggingface.co/spaces/fsanyoto/runloopable/resolve/main/web/src/apps/amazon-operator/DashboardAdapter.tsx
2 kB
| import { AppTabs } from "../AppTabs"; | |
| import { AppDashboard } from "../AppDashboard"; | |
| import { Kpi, KpiStrip, TrendChart } from "../../viz/kit"; | |
| import type { OperatorDashboardAdapter, OperatorDashboardProps, OperatorTabsProps } from "./AdsOverview"; | |
| function OperatorTabs({ tabs, value, onChange }: OperatorTabsProps) { | |
| return <AppTabs tabs={tabs.map(([id, label, count]) => ({ id, label, count }))} value={value} | |
| ariaLabel="Amazon operator" onChange={id => { | |
| const tab = tabs.find(([key]) => key === id); | |
| if (tab) onChange(tab[0]); | |
| }} />; | |
| } | |
| function OperatorDashboard({ figures, comparison, groups, start, end, comparisonLabel }: OperatorDashboardProps) { | |
| return <AppDashboard figures={figures} charts={[]} start={start} end={end}> | |
| {comparison.length > 0 && <section aria-label={comparisonLabel}> | |
| <h3>{comparisonLabel}</h3> | |
| <KpiStrip>{comparison.map(figure => <Kpi key={figure.id} label={figure.label} unit={figure.unit} | |
| value={figure.value} validated={figure.validated === true} reason={figure.reason} />)}</KpiStrip> | |
| </section>} | |
| {groups.map(group => { | |
| const current = figures.filter(figure => group.figures.includes(figure.id)); | |
| const previous = comparison.filter(figure => group.figures.includes(figure.id)); | |
| const series = [...current, ...previous].filter(figure => figure.validated === true).map(figure => ({ | |
| id: `${previous.includes(figure) ? "prior" : "current"}:${figure.id}`, | |
| label: `${figure.label}${previous.includes(figure) ? ` (${comparisonLabel})` : ""}`, | |
| points: figure.series, | |
| })); | |
| return <section key={group.id} aria-label={group.label}> | |
| <TrendChart label={group.label} unit={current[0]?.unit} series={series} | |
| period={`${start} to ${end}`} comparisonLabel={comparisonLabel} /> | |
| </section>; | |
| })} | |
| </AppDashboard>; | |
| } | |
| export const operatorDashboardAdapter: OperatorDashboardAdapter = { | |
| AppTabs: OperatorTabs, AppDashboard: OperatorDashboard, | |
| }; | |