Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: say 1 hit, not 1 hits, in a box's screen-reader label

This commit is contained in:
iris 2026-10-25 02:16:39 +02:00 • committed by mara
commit 81fd4466a5

View file

@ -13,6 +13,11 @@ const PAD = 10;
// The long kind name would run into the aside beside it.
const SHORT_KIND: Record<string, string> = { request_reviewer: "reviewer" };
// "1 hit", "0 hits": how the box says how many events reached it.
export function hitsText(hits: number): string {
return `${hits} ${hits === 1 ? "hit" : "hits"}`;
}
export function BoxFace({
kind,
text,
@ -26,10 +31,7 @@ export function BoxFace({
// The events of the last dry run that reached the node, when one covers it.
hits?: number;
}) {
const aside = [
order,
hits === undefined ? undefined : `${hits} ${hits === 1 ? "hit" : "hits"}`,
]
const aside = [order, hits === undefined ? undefined : hitsText(hits)]
.filter((part) => part !== undefined)
.join(" · ");
return (