Skip to content

Commit

Permalink
Update dependencies (fix) (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH authored Feb 12, 2025
1 parent 8e27964 commit 568d23d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 24 deletions.
2 changes: 1 addition & 1 deletion demo/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
Typography,
} from '@mui/material';
import CommentIcon from '@mui/icons-material/Comment';
import { BrowserRouter, useLocation, useMatch, useNavigate } from 'react-router';
import { BrowserRouter, useLocation, useMatch, useNavigate } from 'react-router-dom';
import { IntlProvider, useIntl } from 'react-intl';
import { useCallback, useEffect, useRef, useState } from 'react';
import translations from './demo_intl';
Expand Down
35 changes: 28 additions & 7 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"react-papaparse": "^4.4.0",
"react-resizable": "^3.0.5",
"react-router": "^6.29.0",
"react-router-dom": "^6.29.0",
"ts-node": "^10.9.2",
"typescript": "~5.5.4",
"vite": "^5.4.14",
Expand Down
8 changes: 4 additions & 4 deletions src/components/checkBoxList/checkBoxList.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import type { ReactElement } from 'react';
import type { ReactElement, ReactNode } from 'react';
import type { DraggableProvided, DragStart, DropResult } from 'react-beautiful-dnd';
import type { SxProps, Theme } from '@mui/material';

Expand All @@ -31,7 +31,7 @@ type CheckBoxListItemSxProps<T> = CheckBoxListSx & {
export interface CheckBoxListItemProps<T> {
item: T;
sx?: CheckBoxListItemSx;
label: string;
label: ReactNode;
onClick: () => void;
secondaryAction?: (item: T, hover: string) => ReactElement | null;
getItemId: (item: T) => string;
Expand All @@ -52,7 +52,7 @@ export interface CheckBoxListItemsProps<T> {
selectedItems: T[];
onSelectionChange?: (selectedItems: T[]) => void;
getItemId: (item: T) => string;
getItemLabel?: (item: T) => string;
getItemLabel?: (item: T) => ReactNode;
secondaryAction?: (item: T, hover: boolean) => ReactElement | null;
isDisabled?: (item: T) => boolean;
addSelectAllCheckbox?: boolean;
Expand All @@ -72,7 +72,7 @@ export interface CheckboxListProps<T> extends CheckBoxListItemsProps<T> {

export interface ClickableCheckBoxItemProps {
sx?: CheckBoxListItemSx;
label: string;
label: ReactNode;
onClick: () => void;
disabled?: boolean;
checked: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/components/overflowableText/OverflowableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { ReactElement, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
import { ReactNode, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
import { Box, BoxProps, SxProps, Theme, Tooltip, styled } from '@mui/material';
import { Style } from 'node:util';

Expand Down Expand Up @@ -32,7 +32,7 @@ const multilineOverflowStyle = (numberOfLinesToDisplay?: number): SxProps => ({
});

export interface OverflowableTextProps extends BoxProps {
text?: ReactElement | string;
text?: ReactNode;
maxLineCount?: number;
tooltipStyle?: Style;
tooltipSx?: SxProps<Theme>;
Expand Down
19 changes: 9 additions & 10 deletions src/hooks/useModificationLabelComputer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ interface ModificationValues {
equipmentAttributeValue: string;
}

const getOperatingStatusModificationValues = (modification: ModificationValues, withFormat: boolean) => {
const getOperatingStatusModificationValues = (modification: ModificationValues, formatBold: boolean) => {
return {
action: modification.action,
energizedEnd: modification.energizedVoltageLevelId,
computedLabel: withFormat ? <strong>{modification.equipmentId}</strong> : modification.equipmentId,
computedLabel: formatBold ? <strong>{modification.equipmentId}</strong> : modification.equipmentId,
};
};
const getEquipmentAttributeModificationValues = (modification: ModificationValues, withFormat: boolean) => {

const getEquipmentAttributeModificationValues = (modification: ModificationValues, formatBold: boolean) => {
return {
equipmentAttributeName: modification.equipmentAttributeName,
equipmentAttributeValue: modification.equipmentAttributeValue,
computedLabel: withFormat ? <strong>{modification.equipmentId}</strong> : modification.equipmentId,
computedLabel: formatBold ? <strong>{modification.equipmentId}</strong> : modification.equipmentId,
};
};

Expand Down Expand Up @@ -85,18 +86,16 @@ export const useModificationLabelComputer = () => {
);

const computeLabel = useCallback(
(modif: NetworkModificationMetadata, withFormat = true) => {
(modif: NetworkModificationMetadata, formatBold = true) => {
const modificationValues = JSON.parse(modif.messageValues);

switch (modif.messageType) {
case MODIFICATION_TYPES.OPERATING_STATUS_MODIFICATION.type:
return getOperatingStatusModificationValues(modificationValues, withFormat);
return getOperatingStatusModificationValues(modificationValues, formatBold);
case MODIFICATION_TYPES.EQUIPMENT_ATTRIBUTE_MODIFICATION.type:
return getEquipmentAttributeModificationValues(modificationValues, withFormat);
return getEquipmentAttributeModificationValues(modificationValues, formatBold);
default:
return {
computedLabel: withFormat ? <strong>{getLabel(modif)}</strong> : getLabel(modif),
};
return { computedLabel: formatBold ? <strong>{getLabel(modif)}</strong> : getLabel(modif) };
}
},
[getLabel]
Expand Down

0 comments on commit 568d23d

Please sign in to comment.