This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree 2 files changed +15
-3
lines changed
routes/WorkPeriods/components/PeriodsSelectionMessage
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
11
11
} from "store/selectors/workPeriods" ;
12
12
import { toggleWorkingPeriodsAll } from "store/actions/workPeriods" ;
13
13
import styles from "./styles.module.scss" ;
14
- import { formatPlural } from "utils/formatters" ;
14
+ import { formatIsAre , formatPlural } from "utils/formatters" ;
15
15
16
16
/**
17
17
* Displays messages about the number of selected periods and selection controls.
@@ -37,11 +37,13 @@ const PeriodsSelectionMessage = ({ className }) => {
37
37
{ isSelectedVisible && totalCount > pageSize && (
38
38
< span className = { styles . message } >
39
39
{ isSelectedAll
40
- ? `All ${ formatPlural ( totalCount , "record" ) } are selected. `
40
+ ? `All ${ formatPlural ( totalCount , "record" ) } ${ formatIsAre (
41
+ totalCount
42
+ ) } selected. `
41
43
: `${ selectedCount < pageSize ? "" : "All" } ${ formatPlural (
42
44
selectedCount ,
43
45
"record"
44
- ) } on this page are selected. `}
46
+ ) } on this page ${ formatIsAre ( selectedCount ) } selected. `}
45
47
< span
46
48
className = { styles . button }
47
49
onClick = { onBtnClick }
Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ export function formatPlural(count, baseWord) {
83
83
return `${ count } ${ baseWord } ${ count > 1 ? "s" : "" } ` ;
84
84
}
85
85
86
+ /**
87
+ * Returns "is" or "are" for singular/plural phrases.
88
+ *
89
+ * @param {number } count
90
+ * @returns {string } "is" or "are"
91
+ */
92
+ export function formatIsAre ( count ) {
93
+ return count > 1 ? "are" : "is" ;
94
+ }
95
+
86
96
/**
87
97
* Formats user handle link.
88
98
*
You can’t perform that action at this time.
0 commit comments