From fdc54432b529ed83a1e05b1d60f10fdc77877105 Mon Sep 17 00:00:00 2001 From: Sbragul26 Date: Sat, 21 Feb 2026 12:43:52 +0530 Subject: [PATCH 1/2] feat: migrate YamlDialog component to Sistent Signed-off-by: Sbragul26 --- src/custom/YamlDialog/YamlDialog.tsx | 109 +++++++++++++++++++++++++++ src/custom/YamlDialog/index.tsx | 1 + src/custom/YamlDialog/style.tsx | 19 +++++ src/custom/index.tsx | 2 + 4 files changed, 131 insertions(+) create mode 100644 src/custom/YamlDialog/YamlDialog.tsx create mode 100644 src/custom/YamlDialog/index.tsx create mode 100644 src/custom/YamlDialog/style.tsx diff --git a/src/custom/YamlDialog/YamlDialog.tsx b/src/custom/YamlDialog/YamlDialog.tsx new file mode 100644 index 00000000..9ef2c9dc --- /dev/null +++ b/src/custom/YamlDialog/YamlDialog.tsx @@ -0,0 +1,109 @@ +import React from 'react'; +import { + Dialog, + DialogActions, + DialogContent, + Divider, + IconButton, + Tooltip +} from '../../base'; +import FullscreenExitIcon from '@mui/icons-material/FullscreenExit'; +import DeleteIcon from '@mui/icons-material/Delete'; +import FullscreenIcon from '@mui/icons-material/Fullscreen'; +import SaveIcon from '@mui/icons-material/Save'; +import { YamlDialogTitleText, StyledCodeMirrorWrapper } from './style'; + +interface YamlDialogProps { + name: string; + open: boolean; + fullScreen?: boolean; + config_file: string; + isReadOnly?: boolean; + onClose: () => void; + onToggleFullScreen: () => void; + onYamlChange: (value: string) => void; + onUpdate?: () => void; + onDelete?: () => void; + editorComponent?: React.ReactNode; +} + +const YamlDialog = React.forwardRef( + ( + { + name, + open, + fullScreen = false, + config_file, + isReadOnly = false, + onClose, + onToggleFullScreen, + onYamlChange, + onUpdate, + onDelete, + editorComponent + }, + ref + ) => { + return ( + +
+ {name} + + + {fullScreen ? : } + + +
+ + + {editorComponent} + + + {!isReadOnly && ( + + + + + + + + + + + + + )} +
+ ); + } +); + +YamlDialog.displayName = 'YamlDialog'; + +export default YamlDialog; diff --git a/src/custom/YamlDialog/index.tsx b/src/custom/YamlDialog/index.tsx new file mode 100644 index 00000000..b6a6b4a6 --- /dev/null +++ b/src/custom/YamlDialog/index.tsx @@ -0,0 +1 @@ +export { default as YamlDialog } from './YamlDialog'; diff --git a/src/custom/YamlDialog/style.tsx b/src/custom/YamlDialog/style.tsx new file mode 100644 index 00000000..3a2edb9d --- /dev/null +++ b/src/custom/YamlDialog/style.tsx @@ -0,0 +1,19 @@ +import { styled } from '@mui/material'; +import { DialogTitle } from '../../base/DialogTitle'; + +export const YamlDialogTitleText = styled(DialogTitle)(({ theme }) => ({ + fontWeight: 600, + fontSize: '1.25rem', + flex: 1 +})); + +export const StyledCodeMirrorWrapper = styled('div')<{ fullScreen?: boolean }>( + ({ fullScreen }) => ({ + height: fullScreen ? '100vh' : '400px', + overflow: 'auto', + '& .CodeMirror': { + height: '100%', + fontFamily: 'monospace' + } + }) +); diff --git a/src/custom/index.tsx b/src/custom/index.tsx index a7d300d9..d41df9a7 100644 --- a/src/custom/index.tsx +++ b/src/custom/index.tsx @@ -52,6 +52,7 @@ import { TransferListProps } from './TransferModal/TransferList/TransferList'; import UniversalFilter, { UniversalFilterProps } from './UniversalFilter'; import { UserTableAvatarInfo, UsersTable } from './UsersTable'; import { VisibilityChipMenu } from './VisibilityChipMenu'; +import { YamlDialog } from './YamlDialog'; export { CatalogCard } from './CatalogCard'; export { CatalogFilterSidebar } from './CatalogFilterSection'; export type { FilterListType } from './CatalogFilterSection'; @@ -75,6 +76,7 @@ export { Terminal } from './Terminal'; export { TOC } from './TOCChapter'; export { TOCLearning } from './TOCLearning'; export { UserSearchField } from './UserSearchField'; +export { YamlDialog } from './YamlDialog'; export { ActionButton, From f54676086369c7f7b797443f76cc5e9a59be2857 Mon Sep 17 00:00:00 2001 From: Sbragul26 Date: Sat, 21 Feb 2026 15:24:26 +0530 Subject: [PATCH 2/2] fix: Lint issue Signed-off-by: Sbragul26 --- src/custom/YamlDialog/YamlDialog.tsx | 2 -- src/custom/YamlDialog/style.tsx | 2 +- src/icons/Description/DescriptionIcon.tsx | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/custom/YamlDialog/YamlDialog.tsx b/src/custom/YamlDialog/YamlDialog.tsx index 9ef2c9dc..04e0c2ca 100644 --- a/src/custom/YamlDialog/YamlDialog.tsx +++ b/src/custom/YamlDialog/YamlDialog.tsx @@ -33,11 +33,9 @@ const YamlDialog = React.forwardRef( name, open, fullScreen = false, - config_file, isReadOnly = false, onClose, onToggleFullScreen, - onYamlChange, onUpdate, onDelete, editorComponent diff --git a/src/custom/YamlDialog/style.tsx b/src/custom/YamlDialog/style.tsx index 3a2edb9d..81152212 100644 --- a/src/custom/YamlDialog/style.tsx +++ b/src/custom/YamlDialog/style.tsx @@ -1,7 +1,7 @@ import { styled } from '@mui/material'; import { DialogTitle } from '../../base/DialogTitle'; -export const YamlDialogTitleText = styled(DialogTitle)(({ theme }) => ({ +export const YamlDialogTitleText = styled(DialogTitle)(() => ({ fontWeight: 600, fontSize: '1.25rem', flex: 1 diff --git a/src/icons/Description/DescriptionIcon.tsx b/src/icons/Description/DescriptionIcon.tsx index 0bfd51aa..67de472d 100644 --- a/src/icons/Description/DescriptionIcon.tsx +++ b/src/icons/Description/DescriptionIcon.tsx @@ -1,4 +1,4 @@ -import { KEPPEL_GREEN_FILL, DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_FILL_NONE } from '../../constants/constants'; +import { DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_FILL_NONE } from '../../constants/constants'; import { IconProps } from '../types'; const DescriptionIcon = ({