Download frontend/src/components/AlertBanner.tsx from devrup404/sadar: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/devrup404/sadar/resolve/main/frontend/src/components/AlertBanner.tsx
- Command line
-
hf download hf://spaces/devrup404/sadar/frontend/src/components/AlertBanner.tsx
-
curl -L -o AlertBanner.tsx https://huggingface.co/spaces/devrup404/sadar/resolve/main/frontend/src/components/AlertBanner.tsx
1.03 kB
| import { useT } from "../i18n"; | |
| interface Props { | |
| scores: number[]; | |
| stepThreshold: number; | |
| latency?: number | null; | |
| } | |
| export default function AlertBanner({ scores, stepThreshold, latency }: Props) { | |
| const t = useT(); | |
| const peak = scores.length ? Math.max(...scores) : 0; | |
| const alert = peak >= stepThreshold; | |
| return ( | |
| <div | |
| className="panel" | |
| style={{ | |
| padding: "14px 18px", | |
| borderColor: alert ? "var(--alert)" : "var(--normal)", | |
| display: "flex", | |
| justifyContent: "space-between", | |
| alignItems: "center", | |
| }} | |
| > | |
| <span | |
| className={alert ? "status-alert" : "status-normal"} | |
| style={{ fontSize: 18, letterSpacing: "0.24em" }} | |
| > | |
| {alert ? t.alert.alert : t.alert.nominal} | |
| </span> | |
| <span className="label"> | |
| {t.alert.peak} {peak.toFixed(3)} / {t.alert.threshold} {stepThreshold.toFixed(3)} | |
| {alert && latency != null ? ` / ${t.alert.latency} ${latency.toFixed(0)}s` : ""} | |
| </span> | |
| </div> | |
| ); | |
| } | |