QualificationsPage: pluralize words using the lib "polish-plurals", increase the max length of a qualification name (100 -> 200)
This commit is contained in:
parent
5645d4e9f3
commit
c6723e05d4
|
@ -8,6 +8,7 @@ import {
|
|||
withDefault,
|
||||
} from 'use-query-params';
|
||||
import { useSnackbar } from 'notistack';
|
||||
import { polishPlurals } from 'polish-plurals';
|
||||
import SortParam, { decodeSort } from 'libs/serialize-query-params/SortParam';
|
||||
import { useScrollToElement } from 'libs/hooks';
|
||||
import useQualifications from './QualificationsPage.useQualifications';
|
||||
|
@ -210,7 +211,12 @@ const QualificationsPage = () => {
|
|||
<Snackbar
|
||||
open={selectedQualifications.length > 0}
|
||||
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
||||
message={`Wybrane kwalifikacje: ${selectedQualifications.length}`}
|
||||
message={`Wybrano ${selectedQualifications.length} ${polishPlurals(
|
||||
'kwalifikację',
|
||||
'kwalifikacje',
|
||||
'kwalifikacji',
|
||||
selectedQualifications.length
|
||||
)}`}
|
||||
action={
|
||||
<>
|
||||
<Button onClick={handleDeleteQualifications} color="secondary">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { useEffect } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import { omit, pick } from 'lodash';
|
||||
import { polishPlurals } from 'polish-plurals';
|
||||
import useProfessionAutocomplete from './FormDialog.useProfessionAutocomplete.js';
|
||||
import { FORMULAS, MAX_NAME_LENGTH } from './constants';
|
||||
import { Maybe, Qualification, QualificationInput } from 'libs/graphql/types';
|
||||
|
@ -100,7 +101,12 @@ const Form = ({ onClose, qualification, onSubmit }: FormDialogProps) => {
|
|||
required: 'Te pole jest wymagane.',
|
||||
maxLength: {
|
||||
value: MAX_NAME_LENGTH,
|
||||
message: `Maksymalna długość nazwy kwalifikacji to ${MAX_NAME_LENGTH} znaki.`,
|
||||
message: `Maksymalna długość nazwy kwalifikacji to ${MAX_NAME_LENGTH} ${polishPlurals(
|
||||
'znak',
|
||||
'znaki',
|
||||
'znaków',
|
||||
MAX_NAME_LENGTH
|
||||
)}.`,
|
||||
},
|
||||
})}
|
||||
error={!!errors.name?.message}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export const MAX_NAME_LENGTH = 100;
|
||||
export const MAX_NAME_LENGTH = 200;
|
||||
export const FORMULAS = ['Formuła 2012', 'Formuła 2017', 'Formuła 2019'];
|
||||
|
|
Reference in New Issue