Skip to content

Commit

Permalink
- Fix changes label
Browse files Browse the repository at this point in the history
- Fix field highlights issue for new local unit
  • Loading branch information
shreeyash07 authored and samshara committed Dec 23, 2024
1 parent 08c1d9a commit 1624014
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,21 +650,6 @@ function LocalUnitsForm(props: Props) {
[revertChanges, setShowRevertChangesModalFalse],
);

const latestChangesFormFields = useMemo(() => {
if (isDefined(localUnitDetailsResponse) && isDefined(previousData)) {
return getLatestChangesFormFields(
localUnitDetailsResponse,
previousData,
);
}
return undefined;
}, [localUnitDetailsResponse, previousData]);

const baseMapFormFieldsChanges = useMemo(() => ({
lat: latestChangesFormFields?.['location_json.lat'],
lng: latestChangesFormFields?.['location_json.lng'],
}), [latestChangesFormFields]);

const onDoneButtonClick = useCallback(
() => {
const result = validate();
Expand Down Expand Up @@ -745,6 +730,24 @@ function LocalUnitsForm(props: Props) {
return false;
}, [previousData]);

const latestChangesFormFields = useMemo(() => {
if (isNewLocalUnit) {
return undefined;
}
if (isDefined(localUnitDetailsResponse) && isDefined(previousData)) {
return getLatestChangesFormFields(
localUnitDetailsResponse,
previousData,
);
}
return undefined;
}, [localUnitDetailsResponse, previousData, isNewLocalUnit]);

const baseMapFormFieldsChanges = useMemo(() => ({
lat: latestChangesFormFields?.['location_json.lat'],
lng: latestChangesFormFields?.['location_json.lng'],
}), [latestChangesFormFields]);

return (
<div className={styles.localUnitsForm}>
{isDefined(localUnitDetailsResponse)
Expand Down Expand Up @@ -1187,7 +1190,7 @@ function LocalUnitsForm(props: Props) {
/>
<TextInput
inputSectionClassName={_cs(
latestChangesFormFields?.city_cn
latestChangesFormFields?.city_en
&& styles.changes,
)}
label={strings.localityEn}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function useLocalUnitFormFieldLabels(props: Props) {
address_loc: strings.addressLocal,
city_en: strings.localityEn,
city_loc: strings.localityLocal,
postCode: strings.postCode,
postcode: strings.postCode,
phone: strings.phone,
email: strings.email,
link: strings.website,
Expand Down

0 comments on commit 1624014

Please sign in to comment.