Skip to content

Commit

Permalink
Merge branch 'main' into change-rule-abel
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneLt authored Jan 16, 2025
2 parents e8ee992 + 9f5ad33 commit 069fb42
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 147 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gridsuite/commons-ui",
"version": "0.77.1",
"version": "0.77.2",
"description": "common react components for gridsuite applications",
"engines": {
"npm": ">=9",
Expand Down
10 changes: 4 additions & 6 deletions src/components/filter/expert/ExpertFilterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import './stylesExpertFilter.css';
import { useFormContext, useWatch } from 'react-hook-form';
import * as yup from 'yup';
import { v4 as uuid4 } from 'uuid';
import { useIntl } from 'react-intl';
import { Box } from '@mui/material';
import { testQuery } from './expertFilterUtils';
import {
Expand All @@ -31,6 +30,7 @@ import { FilterType } from '../constants/FilterConstants';
import { CustomReactQueryBuilder } from '../../inputs/reactQueryBuilder/CustomReactQueryBuilder';
import { unscrollableDialogStyles } from '../../dialogs';
import { FieldType } from '../../../utils/types/fieldType';
import { useFormatLabelWithUnit } from '../../../hooks/useFormatLabelWithUnit';

yup.setLocale({
mixed: {
Expand Down Expand Up @@ -97,8 +97,6 @@ export function getExpertFilterEmptyFormData() {
}

export function ExpertFilterForm() {
const intl = useIntl();

const { getValues, setValue } = useFormContext();

const openConfirmationPopup = useCallback(() => {
Expand All @@ -115,15 +113,15 @@ export function ExpertFilterForm() {
const watchEquipmentType = useWatch({
name: FieldConstants.EQUIPMENT_TYPE,
});

const formatLabelWithUnit = useFormatLabelWithUnit();
const translatedFields = useMemo(() => {
return EXPERT_FILTER_FIELDS[watchEquipmentType]?.map((field) => {
return {
...field,
label: intl.formatMessage({ id: field.label }),
label: formatLabelWithUnit(field),
};
});
}, [intl, watchEquipmentType]);
}, [formatLabelWithUnit, watchEquipmentType]);

return (
<>
Expand Down
Loading

0 comments on commit 069fb42

Please sign in to comment.