Skip to content

Commit

Permalink
fix: rename component and small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminic committed Jan 23, 2025
1 parent 5e3d37b commit 0533965
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-01-23T07:34:31.973Z\n"
"PO-Revision-Date: 2025-01-23T07:34:31.973Z\n"
"POT-Creation-Date: 2025-01-23T14:59:11.968Z\n"
"PO-Revision-Date: 2025-01-23T14:59:11.968Z\n"

msgid "schemas"
msgstr "schemas"
Expand Down Expand Up @@ -1298,9 +1298,6 @@ msgstr "Advanced options"
msgid "These options are used for advanced data set configurations."
msgstr "These options are used for advanced data set configurations."

msgid "Value should be bigger than 0"
msgstr "Value should be bigger than 0"

msgid "Configure data elements"
msgstr "Configure data elements"

Expand Down Expand Up @@ -1337,6 +1334,9 @@ msgstr "Close data entry a certain number of days after period end (expiry days)
msgid "Set up the basic information for this data set."
msgstr "Set up the basic information for this data set."

msgid "Value should be bigger than 0"
msgstr "Value should be bigger than 0"

msgid "Validation and limitations"
msgstr "Validation and limitations"

Expand Down
8 changes: 4 additions & 4 deletions src/pages/dataSetsWip/form/PeriodsFormContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '../../../components'
import { SectionedFormSection } from '../../../components/sectionedForm'
import { DEFAULT_CATEGORY_COMBO } from '../../../lib'
import { CheckboxControlledNumberInput } from './CheckboxControlledNumberInput'
import { ToggledNumberInput } from './ToggledNumberInput'
import { PeriodTypeField } from './PeriodTypeField'

Check failure on line 12 in src/pages/dataSetsWip/form/PeriodsFormContents.tsx

View workflow job for this annotation

GitHub Actions / lint

`./PeriodTypeField` import should occur before import of `./ToggledNumberInput`

export const PeriodsContents = ({ name }: { name: string }) => {
Expand All @@ -27,15 +27,15 @@ export const PeriodsContents = ({ name }: { name: string }) => {
<PeriodTypeField />
</StandardFormField>
<StandardFormField>
<CheckboxControlledNumberInput
<ToggledNumberInput
name="openFuturePeriods"
label={i18n.t('Allow data entry for future periods')}
uncheckedValue={0}
min={'1'}
/>
</StandardFormField>
<StandardFormField>
<CheckboxControlledNumberInput
<ToggledNumberInput
name="expiryDays"
label={i18n.t(
'Close data entry a certain number of days after period end (expiry days)'
Expand All @@ -45,7 +45,7 @@ export const PeriodsContents = ({ name }: { name: string }) => {
</StandardFormField>
{formValues?.categoryCombo.id !== DEFAULT_CATEGORY_COMBO.id && (
<StandardFormField>
<CheckboxControlledNumberInput
<ToggledNumberInput
name="openPeriodsAfterCoEndDate"
label={i18n.t(
`Close data entry after ${formValues?.categoryCombo.displayName.toLowerCase()} category option end date (if category option exist and has end date)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type HiddenInputFieldProps = InputFieldRestProps & {
uncheckedValue: number
}

export function CheckboxControlledNumberInput({
export function ToggledNumberInput({
name,
label,
uncheckedValue,
Expand Down Expand Up @@ -41,11 +41,10 @@ export function CheckboxControlledNumberInput({
useEffect(() => {
if (isChecked) {
input.onChange(undefined)
input.onBlur()
} else {
input.onChange(uncheckedValue.toString())
input.onBlur()
}
input.onBlur()
}, [isChecked])

return (
Expand Down

0 comments on commit 0533965

Please # to comment.