swarm-ui: say 1 hit, not 1 hits, in a box's screen-reader label
This commit is contained in:
parent
404d8334aa
commit
81fd4466a5
1 changed files with 8 additions and 6 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Reference in a new issue