on master help sign in
feat: conditionally pluralize headers in Points.js
fdc3dabMatt Condon (shrugs)
src/views/Points.js+12−3
@@ -18,6 +18,7 @@ import FooterButton from 'components/FooterButton';
18import Blinky from 'components/Blinky';
18import Blinky from 'components/Blinky';
19import Passport from 'components/Passport';
19import Passport from 'components/Passport';
20import useRejectedIncomingPointTransfers from 'lib/useRejectedIncomingPointTransfers';
20import useRejectedIncomingPointTransfers from 'lib/useRejectedIncomingPointTransfers';
21+import pluralize from 'lib/pluralize';
21
22
22const getFromMaybe = (obj, key, defaultValue) =>
23const getFromMaybe = (obj, key, defaultValue) =>
23 obj.matchWith({
24 obj.matchWith({
@@ -139,7 +140,11 @@ export default function Points() {
139 {incomingPoints.length > 0 && (
140 {incomingPoints.length > 0 && (
140 <Grid.Item full as={Grid} gap={1} className="mb6">
141 <Grid.Item full as={Grid} gap={1} className="mb6">
141 <Grid.Item full as={H5}>
142 <Grid.Item full as={H5}>
143+ {pluralize(
144+ incomingPoints.length,
145+ 'Incoming Transfer',
142− Incoming Transfers
146+ 'Incoming Transfers'
147+ )}
143 </Grid.Item>
148 </Grid.Item>
144 <Grid.Item
149 <Grid.Item
145 full
150 full
@@ -172,7 +177,11 @@ export default function Points() {
172 {outgoingPoints.length > 0 && (
177 {outgoingPoints.length > 0 && (
173 <Grid.Item full as={Grid} gap={1} className="mb6">
178 <Grid.Item full as={Grid} gap={1} className="mb6">
174 <Grid.Item full as={H5}>
179 <Grid.Item full as={H5}>
180+ {pluralize(
181+ outgoingPoints.length,
182+ 'Outgoing Transfer',
175− Outgoing Transfers
183+ 'Outgoing Transfers'
184+ )}
176 </Grid.Item>
185 </Grid.Item>
177 <Grid.Item
186 <Grid.Item
178 full
187 full
@@ -200,7 +209,7 @@ export default function Points() {
200 {multipassPoints.length > 0 && (
209 {multipassPoints.length > 0 && (
201 <Grid.Item full as={Grid} gap={1}>
210 <Grid.Item full as={Grid} gap={1}>
202 <Grid.Item full as={H5}>
211 <Grid.Item full as={H5}>
203− Multipasses
212+ {pluralize(multipassPoints.length, 'Multipass', 'Multipasses')}
204 </Grid.Item>
213 </Grid.Item>
205 <Grid.Item full as={PointList} points={multipassPoints} />
214 <Grid.Item full as={PointList} points={multipassPoints} />
206 </Grid.Item>
215 </Grid.Item>