Skip to content

Commit

Permalink
fix: updated variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Aug 8, 2024
1 parent 80e8cfb commit 288a26a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 27 deletions.
12 changes: 6 additions & 6 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: 2024-06-18T22:47:46.585Z\n"
"PO-Revision-Date: 2024-06-18T22:47:46.585Z\n"
"POT-Creation-Date: 2024-08-08T11:49:13.423Z\n"
"PO-Revision-Date: 2024-08-08T11:49:13.423Z\n"

msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
Expand Down Expand Up @@ -826,11 +826,11 @@ msgid "Registered events"
msgstr "Registered events"

msgid ""
"The category is not valid for the selected organisation unit. Please select "
"a valid combination."
"The category option is not valid for the selected organisation unit. Please "
"select a valid combination."
msgstr ""
"The category is not valid for the selected organisation unit. Please select "
"a valid combination."
"The category option is not valid for the selected organisation unit. Please "
"select a valid combination."

msgid "Please select {{category}}."
msgstr "Please select {{category}}."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const InvalidCategoryCombinationForOrgUnitMessagePlain = ({ classes }: {|
<div className={classes.incompleteMessageContainer}>
<IncompleteSelectionsMessage>
{i18n.t(
'The category is not valid for the selected organisation unit. Please select a valid combination.',
'The category option is not valid for the selected organisation unit. Please select a valid combination.',
)}
</IncompleteSelectionsMessage>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ const handleChangeTemplateUrl = ({ programId, orgUnitId, selectedTemplateId, sho
}
};

const useMainPageStatus = ({ programId, selectedProgram, categories, orgUnitId, showAllAccessible, isInvalid }) => {
const useMainPageStatus = ({
programId,
selectedProgram,
categories,
orgUnitId,
showAllAccessible,
categoryOptionIsInvalidForOrgUnit,
}) => {
const withoutOrgUnit = useMemo(() => !orgUnitId && !showAllAccessible, [orgUnitId, showAllAccessible]);

return useMemo(() => {
Expand All @@ -45,7 +52,7 @@ const useMainPageStatus = ({ programId, selectedProgram, categories, orgUnitId,
if (withoutOrgUnit) {
return MainPageStatuses.WITHOUT_ORG_UNIT_SELECTED;
}
if (programCategories && isInvalid) {
if (programCategories && categoryOptionIsInvalidForOrgUnit) {
return MainPageStatuses.CATEGORY_OPTION_INVALID_FOR_ORG_UNIT;
}
return MainPageStatuses.SHOW_WORKING_LIST;
Expand All @@ -56,7 +63,7 @@ const useMainPageStatus = ({ programId, selectedProgram, categories, orgUnitId,
}

return MainPageStatuses.SHOW_WORKING_LIST;
}, [programId, selectedProgram, withoutOrgUnit, categories, isInvalid]);
}, [programId, selectedProgram, withoutOrgUnit, categories, categoryOptionIsInvalidForOrgUnit]);
};

const useSelectorMainPage = () =>
Expand Down Expand Up @@ -99,7 +106,7 @@ const MainPageContainer = () => {
error,
ready,
} = useSelectorMainPage();
const { isInvalid } = useCategoryOptionIsValidForOrgUnit({ selectedOrgUnitId: orgUnitId });
const { categoryOptionIsInvalidForOrgUnit } = useCategoryOptionIsValidForOrgUnit({ selectedOrgUnitId: orgUnitId });

const selectedProgram = programCollection.get(programId);
// $FlowFixMe[prop-missing]
Expand All @@ -111,7 +118,7 @@ const MainPageContainer = () => {
categories,
orgUnitId,
showAllAccessible,
isInvalid,
categoryOptionIsInvalidForOrgUnit,
});

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const newPageActionTypes = {
NEW_PAGE_OPEN: 'NewPage.NewPageOpen',
NEW_PAGE_WITHOUT_ORG_UNIT_SELECTED_VIEW: 'NewPage.WithoutOrgUnitSelectedView',
NEW_PAGE_WITHOUT_PROGRAM_CATEGORY_SELECTED_VIEW: 'NewPage.WithoutProgramComboSelectedView',
NEW_PAGE_INVALID_CATEGORY_OPTION_SELECTED_VIEW: 'NewPage.InvalidCategoryOptionSelectedView',
NEW_PAGE_CATEGORY_OPTION_INVALID_FOR_ORG_UNIT_VIEW: 'NewPage.InvalidCategoryOptionSelectedView',
NEW_PAGE_DEFAULT_VIEW: 'NewPage.DefaultView',
CLEAN_UP_DATA_ENTRY: 'NewPage.DataEntryCleanUp',
CATEGORY_OPTION_SET: 'NewPage.CategoryOptionSet',
Expand All @@ -21,7 +21,7 @@ export const showMessageToSelectProgramCategoryOnNewPage = () =>
actionCreator(newPageActionTypes.NEW_PAGE_WITHOUT_PROGRAM_CATEGORY_SELECTED_VIEW)();

export const showMessageThatCategoryOptionIsInvalidForOrgUnit = () =>
actionCreator(newPageActionTypes.NEW_PAGE_INVALID_CATEGORY_OPTION_SELECTED_VIEW)();
actionCreator(newPageActionTypes.NEW_PAGE_CATEGORY_OPTION_INVALID_FOR_ORG_UNIT_VIEW)();

export const showDefaultViewOnNewPage = () => actionCreator(newPageActionTypes.NEW_PAGE_DEFAULT_VIEW)();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const NewPagePlain = ({
newPageStatus,
writeAccess,
programCategorySelectionIncomplete,
categoryComboIsInvalid,
categoryOptionIsInvalidForOrgUnit,
missingCategoriesInProgramSelection,
orgUnitSelectionIncomplete,
isUserInteractionInProgress,
Expand All @@ -55,7 +55,7 @@ const NewPagePlain = ({
showMessageToSelectOrgUnitOnNewPage();
} else if (programCategorySelectionIncomplete) {
showMessageToSelectProgramCategoryOnNewPage();
} else if (categoryComboIsInvalid) {
} else if (categoryOptionIsInvalidForOrgUnit) {
showMessageThatCategoryOptionIsInvalidForOrgUnit();
} else {
showDefaultViewOnNewPage();
Expand All @@ -67,7 +67,7 @@ const NewPagePlain = ({
showMessageToSelectOrgUnitOnNewPage,
showMessageToSelectProgramCategoryOnNewPage,
showDefaultViewOnNewPage,
categoryComboIsInvalid,
categoryOptionIsInvalidForOrgUnit,
showMessageThatCategoryOptionIsInvalidForOrgUnit,
]);
const orgUnitId = useSelector(({ currentSelections }) => currentSelections.orgUnitId);
Expand Down Expand Up @@ -142,10 +142,10 @@ const NewPagePlain = ({
}

{
newPageStatus === newPageStatuses.INVALID_CATEGORY_OPTION_SELECTED && (
newPageStatus === newPageStatuses.CATEGORY_OPTION_INVALID_FOR_ORG_UNIT && (
<IncompleteSelectionsMessage>
{i18n.t(
'The category is not valid for the selected organisation unit. Please select a valid combination.',
'The category option is not valid for the selected organisation unit. Please select a valid combination.',
)}
</IncompleteSelectionsMessage>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const newPageStatuses = {
ERROR: 'ERROR',
WITHOUT_ORG_UNIT_SELECTED: 'WITHOUT_ORG_UNIT_SELECTED',
WITHOUT_PROGRAM_CATEGORY_SELECTED: 'WITHOUT_PROGRAM_CATEGORY_SELECTED',
INVALID_CATEGORY_OPTION_SELECTED: 'INVALID_CATEGORY_OPTION_SELECTED',
CATEGORY_OPTION_INVALID_FOR_ORG_UNIT: 'CATEGORY_OPTION_INVALID_FOR_ORG_UNIT',
};

export const NEW_TEI_DATA_ENTRY_ID = 'newPageDataEntryId';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const NewPage: ComponentType<{||}> = () => {
const history = useHistory();
const { orgUnitId, programId, teiId } = useLocationQuery();
const program = programId && programCollection.get(programId);
const { isInvalid: categoryComboIsInvalid } = useCategoryOptionIsValidForOrgUnit({
const { categoryOptionIsInvalidForOrgUnit } = useCategoryOptionIsValidForOrgUnit({
selectedOrgUnitId: orgUnitId,
});
const { trackedEntityInstanceAttributes } = useTrackedEntityInstances(teiId, programId);
Expand Down Expand Up @@ -118,7 +118,7 @@ export const NewPage: ComponentType<{||}> = () => {
orgUnitSelectionIncomplete={orgUnitSelectionIncomplete}
programCategorySelectionIncomplete={programSelectionIsIncomplete}
missingCategoriesInProgramSelection={missingCategories}
categoryComboIsInvalid={categoryComboIsInvalid}
categoryOptionIsInvalidForOrgUnit={categoryOptionIsInvalidForOrgUnit}
writeAccess={writeAccess}
newPageStatus={newPageStatus}
error={error}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type ContainerProps = $ReadOnly<{|
showMessageToSelectOrgUnitOnNewPage: ()=>void,
showMessageToSelectProgramCategoryOnNewPage: ()=>void,
showMessageThatCategoryOptionIsInvalidForOrgUnit: ()=>void,
categoryComboIsInvalid: boolean,
categoryOptionIsInvalidForOrgUnit: boolean,
showDefaultViewOnNewPage: ()=>void,
handleMainPageNavigation: ()=>void,
currentScopeId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useCategoryOptionIsValidForOrgUnit = ({
},
);

const isInvalid = useMemo(() => {
const categoryOptionIsInvalidForOrgUnit = useMemo(() => {
if (!data || !data.length) {
return false;
}
Expand All @@ -43,7 +43,7 @@ export const useCategoryOptionIsValidForOrgUnit = ({
}, [data, selectedOrgUnitId]);

return {
isInvalid,
categoryOptionIsInvalidForOrgUnit,
isLoading,
isError,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export const newPageDesc = createReducerDescription(
...state,
newPageStatus: newPageStatuses.WITHOUT_PROGRAM_CATEGORY_SELECTED,
}),
[newPageActionTypes.NEW_PAGE_INVALID_CATEGORY_OPTION_SELECTED_VIEW]: state => ({
[newPageActionTypes.NEW_PAGE_CATEGORY_OPTION_INVALID_FOR_ORG_UNIT_VIEW]: state => ({
...state,
newPageStatus: newPageStatuses.INVALID_CATEGORY_OPTION_SELECTED,
newPageStatus: newPageStatuses.CATEGORY_OPTION_INVALID_FOR_ORG_UNIT,
}),
[registrationFormActionTypes.NEW_TRACKED_ENTITY_INSTANCE_WITH_ENROLLMENT_SAVE_START]: (state, action) => {
const { uid } = action.payload;
Expand Down

0 comments on commit 288a26a

Please sign in to comment.