diff --git a/src/App.tsx b/src/App.tsx index d3a1372..55d8fd3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,23 +8,33 @@ import { Suspense } from 'react'; import { Route, Routes } from 'react-router-dom'; import './App.css'; import ThemeHandler from './components/common/handler/ThemeHandler'; -import Navbar from './components/pegase/navbar/Navbar'; import PegaseStar from './components/pegase/star/PegaseStar'; import { UserContext } from '@/store/contexts/UserContext'; -import { PEGASE_NAVBAR_ID } from './shared/constants'; -import { THEME_COLOR } from './shared/types'; +import { THEME_COLOR } from '@/shared/types'; import { menuBottomData, menuTopData } from './routes'; import { PegaseToastContainer } from './shared/notification/containers'; import ProjectDetails from './pages/pegase/projects/projectDetails/ProjectDetails'; import StudyDetails from '@/pages/pegase/studies/studyDetails/studyDetails'; +import { RdsNavbar } from 'rte-design-system-react'; +import { navBarConfig } from '@/shared/const/navBarConfig'; +import { useTranslation } from 'react-i18next'; +import { translateMenuItemLabel } from '@/shared/utils/textUtils.ts'; function App() { + const { t } = useTranslation(); + return (
- +
diff --git a/src/components/common/layout/stdNavbar/StdNavbar.tsx b/src/components/common/layout/stdNavbar/StdNavbar.tsx deleted file mode 100644 index 2ea905c..0000000 --- a/src/components/common/layout/stdNavbar/StdNavbar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { MenuNavItem } from '@/shared/types'; -import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import StdNavbarController from './StdNavbarController'; -import StdNavbarHeader from './StdNavbarHeader'; -import StdNavbarMenu from './StdNavbarMenu'; -import { navbarClassBuilder } from './navbarClassBuilder'; -import { RdsDivider, useRdsId } from 'rte-design-system-react'; - -export type StdNavbarProps = { - topItems: MenuNavItem[]; - bottomItems: MenuNavItem[]; - appName: string; - appVersion: string; - headerLink: string; - id?: string; -}; - -const StdNavbar = ({ topItems, bottomItems, appName, appVersion, headerLink, id: propsId }: StdNavbarProps) => { - const [expanded, setExpanded] = useState(true); - const { t } = useTranslation(); - - const toggleExpanded = () => { - setExpanded((oldExpanded) => !oldExpanded); - }; - - const navbarClasses = navbarClassBuilder(expanded); - const id = useRdsId('navbar', propsId); - const controllerId = `${id}-controller`; - const headerId = `${id}-header`; - const controllerLabel = expanded ? t('components.navbar.@minimize') : t('components.navbar.@expand'); - - return ( - - ); -}; - -export default StdNavbar; diff --git a/src/components/common/layout/stdNavbar/StdNavbarController.tsx b/src/components/common/layout/stdNavbar/StdNavbarController.tsx deleted file mode 100644 index beaa174..0000000 --- a/src/components/common/layout/stdNavbar/StdNavbarController.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { navbarControllerClassBuilder } from './navbarClassBuilder'; -import { RdsIcon, RdsIconId, RdsTextTooltip } from 'rte-design-system-react'; - -type StdNavbarControllerProps = { - id: string; - label: string; - action: () => void; - expanded?: boolean; -}; - -const StdNavbarController = ({ label, id, action, expanded = true }: StdNavbarControllerProps) => { - const iconId = expanded ? RdsIconId.KeyboardDoubleArrowLeft : RdsIconId.KeyboardDoubleArrowRight; - const navbarControllerClasses = expanded ? navbarControllerClassBuilder(expanded) : undefined; - - return ( -
- -
- {expanded ? : } - {expanded && <>{label}} -
-
-
- ); -}; - -export default StdNavbarController; diff --git a/src/components/common/layout/stdNavbar/StdNavbarHeader.tsx b/src/components/common/layout/stdNavbar/StdNavbarHeader.tsx deleted file mode 100644 index e65dc0e..0000000 --- a/src/components/common/layout/stdNavbar/StdNavbarHeader.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { APP_LOGO_ID } from '@/shared/constants'; -import { classMerger } from '@/shared/utils/common/classes/classMerger'; -import { Link } from 'react-router-dom'; - -type StdNavbarHeaderProps = { - id: string; - appName: string; - version: string; - target: string; - expanded?: boolean; -}; - -const WRAPPER_COMMON_CLASSES = 'p-1 rounded flex items-center gap-1 w-24 py-2'; -const WRAPPER_BG_CLASSES = 'hover:bg-gray-200 dark:hover:bg-gray-700'; -const WRAPPER_FOCUS_CLASSES = - 'focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-0 focus-visible:outline-gray-900 dark:focus-visible:outline-gray-w '; - -const StdNavbarHeader = ({ appName, version, id, target, expanded = true }: StdNavbarHeaderProps) => ( - -
- {appName} - {appName} -
- {expanded && ( - <> -
- {appName} - {appName} - {appName} - {appName} -
-
{version}
- - )} - -); - -export default StdNavbarHeader; diff --git a/src/components/common/layout/stdNavbar/StdNavbarMenu.tsx b/src/components/common/layout/stdNavbar/StdNavbarMenu.tsx deleted file mode 100644 index beac9db..0000000 --- a/src/components/common/layout/stdNavbar/StdNavbarMenu.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { MenuNavItem } from '@/shared/types'; -import StdNavbarMenuItem from './StdNavbarMenuItem'; - -type StdNavbarMenuProps = { - menuItems: MenuNavItem[]; - expanded?: boolean; -}; - -const StdNavbarMenu = ({ menuItems, expanded = true }: StdNavbarMenuProps) => ( -
- {menuItems.map((item) => ( - - ))} -
-); - -export default StdNavbarMenu; diff --git a/src/components/common/layout/stdNavbar/StdNavbarMenuItem.tsx b/src/components/common/layout/stdNavbar/StdNavbarMenuItem.tsx deleted file mode 100644 index ebac153..0000000 --- a/src/components/common/layout/stdNavbar/StdNavbarMenuItem.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { MenuNavItem } from '@/shared/types'; -import { Link } from 'react-router-dom'; -import { navbarItemClassBuilder } from './navbarClassBuilder'; -import { useTranslation } from 'react-i18next'; -import { RdsIcon, RdsTextTooltip, useRdsId } from 'rte-design-system-react'; - -type StdNavbarMenuItemProps = { - item: MenuNavItem; - expanded?: boolean; - selected?: boolean; -}; - -const StdNavbarMenuItem = ({ item, expanded = true, selected = false }: StdNavbarMenuItemProps) => { - const id = useRdsId('navbar-item', item.id); - const { t } = useTranslation(); - const { path, key, icon, label } = item; - const navbarMenuItemClasses = navbarItemClassBuilder(selected, expanded); - - return ( - - - - {expanded && t(label)} - - - ); -}; - -export default StdNavbarMenuItem; diff --git a/src/components/common/layout/stdNavbar/navbarClassBuilder.ts b/src/components/common/layout/stdNavbar/navbarClassBuilder.ts deleted file mode 100644 index 87013fb..0000000 --- a/src/components/common/layout/stdNavbar/navbarClassBuilder.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { classMerger } from '@/shared/utils/common/classes/classMerger'; - -export const NAVBAR_BASE_CLASSES = - 'flex flex-col px-1 py-2 bg-gray-50 dark:bg-gray-800 border-r text-left gap-2 border-gray-300 h-screen transition-all ease-out duration-300'; - -export const NAVBAR_EXPANDED_CLASSES = 'w-28 px-1'; -export const NAVBAR_COLLAPSED_CLASSES = 'w-8 items-center'; - -export const NAVBAR_CONTROLLER_BASE_CLASSES = 'cursor-pointer mb-2'; - -export const navbarClassBuilder = (expanded: boolean) => - classMerger(NAVBAR_BASE_CLASSES, expanded ? NAVBAR_EXPANDED_CLASSES : NAVBAR_COLLAPSED_CLASSES); - -const NAVBAR_ITEM_BASE_CLASSES = - 'mx-1 flex items-center gap-1 truncate rounded p-1 text-button-s font-semibold text-gray-700 dark:text-gray-200'; -const NAVBAR_ITEM_STATUS_CLASSES = 'hover:bg-gray-200 hover:text-gray-900 active:bg-gray-300 active:text-gray-900'; -const DARK_NAVBAR_ITEM_STATUS_CLASSES = - 'dark:hover:bg-gray-700 dark:hover:text-gray-200 dark:active:bg-gray-600 dark:active:text-gray-200'; -const NAVBAR_ITEM_FOCUS_CLASSES = - 'focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-0 focus-visible:outline-gray-900 '; -const DARK_NAVBAR_ITEM_FOCUS_CLASSES = 'dark:focus-visible:outline-gray-w '; - -export const NAVBAR_ITEM_SELECTED_CLASSES = '[&]:bg-gray-300 [&]:text-gray-900 '; - -export const NAVBAR_ITEM_CLASSES = classMerger( - NAVBAR_ITEM_BASE_CLASSES, - NAVBAR_ITEM_STATUS_CLASSES, - DARK_NAVBAR_ITEM_STATUS_CLASSES, - NAVBAR_ITEM_FOCUS_CLASSES, - DARK_NAVBAR_ITEM_FOCUS_CLASSES, -); - -export const navbarItemClassBuilder = (selected: boolean, expanded: boolean) => { - const baseClasses = expanded ? NAVBAR_ITEM_CLASSES : classMerger(NAVBAR_ITEM_CLASSES, 'w-fit'); - return selected ? classMerger(baseClasses, NAVBAR_ITEM_SELECTED_CLASSES) : baseClasses; -}; - -export const navbarControllerClassBuilder = (expanded: boolean) => { - const baseClasses = expanded ? NAVBAR_ITEM_CLASSES : classMerger(NAVBAR_ITEM_CLASSES, 'w-fit'); - return classMerger(baseClasses, NAVBAR_CONTROLLER_BASE_CLASSES); -}; diff --git a/src/components/common/layout/stdNavbar/tests/StdNavbar.test.tsx b/src/components/common/layout/stdNavbar/tests/StdNavbar.test.tsx deleted file mode 100644 index 806b2d4..0000000 --- a/src/components/common/layout/stdNavbar/tests/StdNavbar.test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { fakeAppName, fakeAppVersion, fakeHomeLink } from '@/mocks/data/components/navbarHeader'; -import { renderWithRouter } from '@/shared/types/common/tests/testUtils'; -import { screen } from '@testing-library/react'; -import StdNavbar from '../StdNavbar'; -import { menuBottomData, menuTopData } from '@/routes'; - -const TEST_ID = 'navbar'; -const TOTAL_LENGTH = menuTopData.length + menuBottomData.length + 1; // Add one for the PinnedProject link - -describe('StdNavbar component', () => { - it('should render the navbar component with proper role and id, with the correct amount of sub items', () => { - renderWithRouter( - , - ); - expect(screen.getByRole('navigation')).toBeInTheDocument(); - expect(document.querySelector(`#${TEST_ID}`)); - expect(screen.getAllByRole('link').length).toBe(TOTAL_LENGTH); - }); -}); diff --git a/src/components/common/layout/stdNavbar/tests/StdNavbarController.test.tsx b/src/components/common/layout/stdNavbar/tests/StdNavbarController.test.tsx deleted file mode 100644 index a5fbc7c..0000000 --- a/src/components/common/layout/stdNavbar/tests/StdNavbarController.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { noop } from '@/shared/utils/common/defaultUtils'; -import { render, screen } from '@testing-library/react'; -import StdNavbarController from '../StdNavbarController'; - -const TEST_LABEL = 'Controls'; -const TEST_ID = 'navbar-controller-id'; - -describe('StdNavbarController component', () => { - it('should render the component with passed id', () => { - render(); - expect(document.querySelector(`#${TEST_ID}`)).toBeInTheDocument(); - }); - it('should render the proper content when expanded', () => { - render(); - expect(screen.queryByText(TEST_LABEL)).toBeInTheDocument(); - }); - it('should render the proper content when expanded is false', () => { - render(); - expect(screen.queryByText(TEST_LABEL)).not.toBeInTheDocument(); - }); -}); diff --git a/src/components/common/layout/stdNavbar/tests/StdNavbarHeader.test.tsx b/src/components/common/layout/stdNavbar/tests/StdNavbarHeader.test.tsx deleted file mode 100644 index 6ebedb4..0000000 --- a/src/components/common/layout/stdNavbar/tests/StdNavbarHeader.test.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { fakeAppName, fakeAppVersion, fakeHomeLink } from '@/mocks/data/components/navbarHeader'; -import { screen } from '@testing-library/react'; -import { renderWithRouter } from '@/shared/types/common/tests/testUtils'; -import StdNavbarHeader from '../StdNavbarHeader'; - -const TEST_ID = 'navbar-header'; - -describe('StdNavbarHeader component', () => { - it('should render the wrapper and the common content', () => { - renderWithRouter( - , - ); - expect(document.querySelector(`#${TEST_ID}`)).toBeInTheDocument(); - expect(screen.getByRole('link')).toBeInTheDocument(); - }); - it('should not render appName and version if expanded is false', () => { - renderWithRouter( - , - ); - expect(screen.queryByText(fakeAppName)).not.toBeInTheDocument(); - expect(screen.queryByText(fakeAppVersion)).not.toBeInTheDocument(); - }); -}); diff --git a/src/components/common/layout/stdNavbar/tests/StdNavbarMenuItem.test.tsx b/src/components/common/layout/stdNavbar/tests/StdNavbarMenuItem.test.tsx deleted file mode 100644 index 070fd38..0000000 --- a/src/components/common/layout/stdNavbar/tests/StdNavbarMenuItem.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { menuItemSample } from '@/mocks/data/features/menuItemData.mock'; -import { screen } from '@testing-library/react'; -import { renderWithRouter } from '@/shared/types/common/tests/testUtils'; -import StdNavbarMenuItem from '../StdNavbarMenuItem'; - -describe('StdNavbarMenuItem component', () => { - it('should render the component with the default behavior and proper id', () => { - renderWithRouter(); - expect(document.querySelector(`#${menuItemSample.id}`)).toBeInTheDocument(); - expect(screen.getByRole('link')).toBeInTheDocument(); - expect(document.querySelector(`#${menuItemSample.icon}`)).toBeInTheDocument(); - }); - it('should render the item label if expanded is true', () => { - renderWithRouter(); - expect(screen.getByText(menuItemSample.label)).toBeInTheDocument(); - }); - it('should not render the item label if expanded is not true', () => { - renderWithRouter(); - expect(screen.queryByText(menuItemSample.label)).not.toBeInTheDocument(); - }); -}); diff --git a/src/components/common/layout/stdNavbar/tests/navbarClassBuilder.test.ts b/src/components/common/layout/stdNavbar/tests/navbarClassBuilder.test.ts deleted file mode 100644 index 13b1933..0000000 --- a/src/components/common/layout/stdNavbar/tests/navbarClassBuilder.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { - NAVBAR_BASE_CLASSES, - NAVBAR_COLLAPSED_CLASSES, - NAVBAR_EXPANDED_CLASSES, - NAVBAR_ITEM_CLASSES, - NAVBAR_ITEM_SELECTED_CLASSES, - navbarClassBuilder, - navbarItemClassBuilder, -} from '../navbarClassBuilder'; - -describe('navbarClassBuilder', () => { - it('should have the common classes', () => { - expect(navbarClassBuilder(true)).toContain(NAVBAR_BASE_CLASSES); - expect(navbarClassBuilder(false)).toContain(NAVBAR_BASE_CLASSES); - }); - it('should have the proper expanded classes', () => { - expect(navbarClassBuilder(true)).toContain(NAVBAR_EXPANDED_CLASSES); - }); - it('should have the proper collapsed classes', () => { - expect(navbarClassBuilder(false)).toContain(NAVBAR_COLLAPSED_CLASSES); - }); -}); - -describe('navbarItemClassBuilder', () => { - it('should have the common classes', () => { - expect(navbarItemClassBuilder(true, true)).toContain(NAVBAR_ITEM_CLASSES); - expect(navbarItemClassBuilder(false, true)).toContain(NAVBAR_ITEM_CLASSES); - }); - it('should have the extra background class if selected', () => { - expect(navbarItemClassBuilder(true, true)).toContain(NAVBAR_ITEM_SELECTED_CLASSES); - expect(navbarItemClassBuilder(false, true)).not.toContain(NAVBAR_ITEM_SELECTED_CLASSES); - }); -}); diff --git a/src/components/pegase/navbar/Navbar.tsx b/src/components/pegase/navbar/Navbar.tsx deleted file mode 100644 index 47a9cbb..0000000 --- a/src/components/pegase/navbar/Navbar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import StdNavbarController from '@/components/common/layout/stdNavbar/StdNavbarController'; -import StdNavbarHeader from '@/components/common/layout/stdNavbar/StdNavbarHeader'; -import StdNavbarMenu from '@/components/common/layout/stdNavbar/StdNavbarMenu'; -import { navbarClassBuilder } from '@/components/common/layout/stdNavbar/navbarClassBuilder'; -import { APP_NAME } from '@/shared/constants'; -import { MenuNavItem } from '@/shared/types'; -import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { RdsDivider } from 'rte-design-system-react'; - -type StdNavbarProps = { - topItems: MenuNavItem[]; - bottomItems: MenuNavItem[]; - id: string; -}; -const Navbar = ({ id, topItems, bottomItems }: StdNavbarProps) => { - const [expanded, setExpanded] = useState(true); - const { t } = useTranslation(); - const toggleExpanded = () => { - setExpanded((oldExpanded) => !oldExpanded); - }; - const navbarClasses = navbarClassBuilder(expanded); - const controllerLabel = expanded ? t('components.navbar.@minimize') : t('components.navbar.@expand'); - const controllerId = `${id}-controller`; - return ( - - ); -}; -export default Navbar; diff --git a/src/mocks/data/features/menuItemData.mock.tsx b/src/mocks/data/features/menuItemData.mock.tsx index 7d56cf2..2f525e7 100644 --- a/src/mocks/data/features/menuItemData.mock.tsx +++ b/src/mocks/data/features/menuItemData.mock.tsx @@ -5,13 +5,13 @@ */ import { MenuNavItem } from '@/shared/types'; -import { StdIconId } from '@/shared/utils/common/mappings/iconMaps'; +import { RdsIconId } from 'rte-design-system-react'; export const menuItemSample: MenuNavItem = { id: 'download', key: 'downloads', label: 'Téléchargements', path: '/', - icon: StdIconId.Download, + icon: RdsIconId.Download, component: () => <>, }; diff --git a/src/pages/pegase/home/components/StudyTableDisplay.tsx b/src/pages/pegase/home/components/StudyTableDisplay.tsx index f6dd190..b40b1ed 100644 --- a/src/pages/pegase/home/components/StudyTableDisplay.tsx +++ b/src/pages/pegase/home/components/StudyTableDisplay.tsx @@ -5,19 +5,16 @@ */ import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; import { StudyDTO } from '@/shared/types'; import { StudyStatus } from '@/shared/types/common/StudyStatus.type'; import getStudyTableHeaders from './StudyTableHeaders'; import { addSortColumn } from './StudyTableUtils'; import StudiesPagination from './StudiesPagination'; import { RowSelectionState } from '@tanstack/react-table'; -import StudyCreationModal from '@common/modal/StudyCreationModal'; import { deleteStudy } from '@/shared/services/studyService'; import StdSimpleTable from '@/components/common/data/stdSimpleTable/StdSimpleTable'; import { RdsButton } from 'rte-design-system-react'; import { useStudyTableDisplay } from '@/hooks/useStudyTableDisplay'; -import { useNewStudyModal } from '@/hooks/useNewStudyModal'; import { useStudyNavigation } from '@/hooks/useStudyNavigation'; interface StudyTableDisplayProps { @@ -26,16 +23,13 @@ interface StudyTableDisplayProps { } const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) => { - const { t } = useTranslation(); const [rowSelection, setRowSelection] = useState({}); const [isHeaderHovered, setIsHeaderHovered] = useState(false); - const [selectedStudy, setSelectedStudy] = useState(null); // Reload trigger for re-fetching data const [reloadStudies, setReloadStudies] = useState(false); const [sortBy, setSortBy] = useState<{ [key: string]: 'asc' | 'desc' }>({}); const [sortedColumn, setSortedColumn] = useState('status'); - const { isModalOpen, toggleModal } = useNewStudyModal(); const { navigateToStudy } = useStudyNavigation(); const { rows, count, intervalSize, currentPage, setPage } = useStudyTableDisplay({ searchTerm: searchStudy, @@ -62,9 +56,6 @@ const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) = const isDeleteActive = selectedStatus === StudyStatus.ERROR || selectedStatus === StudyStatus.IN_PROGRESS; const handleDuplicate = () => { - const selectedStudy = rows[Number.parseInt(selectedRowId || '-1')]; - setSelectedStudy(selectedStudy); - toggleModal(); setReloadStudies(!reloadStudies); // Trigger reload after deleting }; @@ -111,7 +102,7 @@ const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) =
- {selectedRowId !== undefined ? ( + {selectedRowId !== undefined && ( <> @@ -123,16 +114,6 @@ const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) = disabled={!isDeleteActive} /> - ) : ( - - )} - {isModalOpen && ( - )}
diff --git a/src/routes.tsx b/src/routes.tsx index 576dced..34ed9dd 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -7,7 +7,7 @@ /* eslint-disable react-refresh/only-export-components */ import { lazy } from 'react'; import { MenuNavItem } from './shared/types'; -import { StdIconId } from './shared/utils/common/mappings/iconMaps'; +import { RdsIconId } from 'rte-design-system-react'; const Settings = lazy(() => import('./pages/pegase/settings/Settings')); const HomePage = lazy(() => import('./pages/pegase/home/HomePage')); @@ -22,7 +22,7 @@ export const menuTopData: MenuNavItem[] = [ key: 'home', label: 'home.@label', path: '/', - icon: StdIconId.Home, + icon: RdsIconId.Home, component: HomePage, }, { @@ -30,7 +30,7 @@ export const menuTopData: MenuNavItem[] = [ key: 'project', label: 'page.@projet', path: '/projects', - icon: StdIconId.Folder, + icon: RdsIconId.Folder, component: ProjectsPage, }, { @@ -38,7 +38,7 @@ export const menuTopData: MenuNavItem[] = [ key: 'logs', label: 'page.@logs', path: '/logs', - icon: StdIconId.ReceiptLong, + icon: RdsIconId.ReceiptLong, component: LogsPage, }, { @@ -46,7 +46,7 @@ export const menuTopData: MenuNavItem[] = [ key: 'parameters', label: 'page.@parameters', path: '/parameters', - icon: StdIconId.Settings, + icon: RdsIconId.Settings, component: Settings, }, { @@ -54,7 +54,7 @@ export const menuTopData: MenuNavItem[] = [ key: 'antares', label: 'page.@antares', path: '/antares', - icon: StdIconId.Apps, + icon: RdsIconId.Apps, component: AntaresPage, }, ]; @@ -64,7 +64,7 @@ export const menuBottomData: MenuNavItem[] = [ key: 'logout', label: 'page.@logout', path: '/logout', - icon: StdIconId.Logout, + icon: RdsIconId.Logout, component: LogoutPage, }, ]; diff --git a/src/shared/const/navBarConfig.ts b/src/shared/const/navBarConfig.ts new file mode 100644 index 0000000..bef8825 --- /dev/null +++ b/src/shared/const/navBarConfig.ts @@ -0,0 +1,25 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { APP_NAME } from '@/shared/constants.ts'; +import { HeaderStyleConfig } from 'rte-design-system-react'; + +export const navBarConfig = { + header: { + variant: 'logo', + versionTextColor: 'gray-600', + appName: APP_NAME, + appVersion: `v${import.meta.env.VITE_APP_VERSION}`, + headerLink: '/', + headerId: 'main-nav-bar-controller', + logoConfig: { + logoExpandedHref: 'brand/appIcon.svg', + logoExpandedId: 'appIcon-collapsed-id', + logoCollapsedHref: 'brand/appIcon.svg', + logoCollapsedId: 'appIcon-expanded-id', + }, + } as HeaderStyleConfig, +}; diff --git a/src/shared/types/common/MenuNavItem.type.ts b/src/shared/types/common/MenuNavItem.type.ts index cb2bd30..e115ecd 100644 --- a/src/shared/types/common/MenuNavItem.type.ts +++ b/src/shared/types/common/MenuNavItem.type.ts @@ -4,13 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { StdIconId } from '@/shared/utils/common/mappings/iconMaps'; +import { RdsIconIdKey } from 'rte-design-system-react'; export type MenuNavItem = { key: string; label: string; path: string; - icon: StdIconId; + icon: RdsIconIdKey; id?: string; component: React.ComponentType; }; diff --git a/src/shared/utils/textUtils.ts b/src/shared/utils/textUtils.ts new file mode 100644 index 0000000..f2f28c5 --- /dev/null +++ b/src/shared/utils/textUtils.ts @@ -0,0 +1,13 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { MenuNavItem } from '@/shared/types'; + +export const translateMenuItemLabel = (menuItems: MenuNavItem[], t: (key: string) => string): MenuNavItem[] => { + return (menuItems as MenuNavItem[]).map((data: MenuNavItem) => { + return { ...data, label: t(data.label) }; + }); +}; diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo index 0417327..6ae52b7 100644 --- a/tsconfig.tsbuildinfo +++ b/tsconfig.tsbuildinfo @@ -1 +1,2 @@ -{"root":["./src/App.tsx","./src/envVariables.ts","./src/i18n.ts","./src/main.tsx","./src/routes.tsx","./src/testSetup.ts","./src/vite-env.d.ts","./src/components/common/base/stdIcon/Icon.tsx","./src/components/common/base/stdIcon/StdIcon.tsx","./src/components/common/base/stdIcon/iconClassBuilder.ts","./src/components/common/data/stdSimpleTable/StdSimpleTable.tsx","./src/components/common/data/stdSimpleTable/tests/stdSimpleTable.test.tsx","./src/components/common/data/stdTable/TableContext.tsx","./src/components/common/data/stdTable/TableCore.tsx","./src/components/common/data/stdTable/tableCoreRowClassBuilder.ts","./src/components/common/data/stdTable/useTableContext.ts","./src/components/common/data/stdTable/cells/ExpandableCell.tsx","./src/components/common/data/stdTable/cells/tests/expandableCell.test.tsx","./src/components/common/data/stdTable/features/readOnly.ts","./src/components/common/data/stdTable/lineRender/StdCollapseIcon.tsx","./src/components/common/data/stdTable/tests/TableCore.test.tsx","./src/components/common/data/stdTable/tests/tableCoreRowClassBuilder.test.ts","./src/components/common/data/stdTable/tests/testTableUtils.ts","./src/components/common/data/stdTable/types/readOnly.type.d.ts","./src/components/common/data/stdTable/types/sizeClassNames.d.ts","./src/components/common/handler/ThemeHandler.tsx","./src/components/common/handler/test/ThemeHandler.test.tsx","./src/components/common/layout/stdAvatar/StdAvatar.tsx","./src/components/common/layout/stdAvatar/avatarClassBuilder.ts","./src/components/common/layout/stdAvatar/tests/StdAvatar.test.tsx","./src/components/common/layout/stdAvatar/tests/avatarClassBuilder.test.ts","./src/components/common/layout/stdAvatarGroup/StdAvatarGroup.tsx","./src/components/common/layout/stdAvatarGroup/avatarGroupClassBuilder.ts","./src/components/common/layout/stdAvatarGroup/avatarTools.ts","./src/components/common/layout/stdAvatarGroup/tests/StdAvatarGroup.test.tsx","./src/components/common/layout/stdAvatarGroup/tests/avatarTools.test.ts","./src/components/common/layout/stdNavbar/StdNavbar.tsx","./src/components/common/layout/stdNavbar/StdNavbarController.tsx","./src/components/common/layout/stdNavbar/StdNavbarHeader.tsx","./src/components/common/layout/stdNavbar/StdNavbarMenu.tsx","./src/components/common/layout/stdNavbar/StdNavbarMenuItem.tsx","./src/components/common/layout/stdNavbar/navbarClassBuilder.ts","./src/components/common/layout/stdNavbar/tests/StdNavbar.test.tsx","./src/components/common/layout/stdNavbar/tests/StdNavbarController.test.tsx","./src/components/common/layout/stdNavbar/tests/StdNavbarHeader.test.tsx","./src/components/common/layout/stdNavbar/tests/StdNavbarMenuItem.test.tsx","./src/components/common/layout/stdNavbar/tests/navbarClassBuilder.test.ts","./src/components/common/layout/stdTextWithTooltip/StdTextWithTooltip.tsx","./src/components/pegase/header/Header.tsx","./src/components/pegase/navbar/Navbar.tsx","./src/components/pegase/pegaseCard/cardClassBuilder.ts","./src/components/pegase/pegaseCard/pegaseCard.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/cardTitleClassBuilder.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/pegaseCardTitle.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/tests/cardTitleClassBuilder.test.ts","./src/components/pegase/pegaseCard/pegaseCardTitle/tests/pegaseCardTitle.test.tsx","./src/components/pegase/pegaseCard/tests/cardTripleActionClassBuilder.test.ts","./src/components/pegase/pegaseCard/tests/pegaseCardTripleAction.test.tsx","./src/components/pegase/star/PegaseStar.tsx","./src/hooks/useDateFormatter.ts","./src/hooks/useDropdownOptions.ts","./src/hooks/useFetchProjectList.ts","./src/hooks/useHandlePinnedProjectList.ts","./src/hooks/useNewStudyModal.ts","./src/hooks/useProjectNavigation.ts","./src/hooks/useStudyNavigation.ts","./src/hooks/useStudyTableDisplay.ts","./src/hooks/common/usePrevious.ts","./src/hooks/common/test/usePrevious.test.ts","./src/hooks/test/useDropdownOptions.test.ts","./src/hooks/test/useFetchProjectList.test.ts","./src/hooks/test/useHandlePinnedProjectList.test.tsx","./src/hooks/test/useNewStudyModal.test.ts","./src/hooks/test/useProjectNavigation.test.tsx","./src/hooks/test/useStudyNavigation.test.tsx","./src/hooks/test/useStudyTableDisplay.test.ts","./src/mocks/mockTools.ts","./src/mocks/data/components/dropdownItems.mock.ts","./src/mocks/data/components/navbarHeader.ts","./src/mocks/data/features/menuItemData.mock.tsx","./src/mocks/data/list/keywords.ts","./src/mocks/data/list/names.ts","./src/mocks/data/list/projectName.ts","./src/mocks/data/list/studyName.ts","./src/mocks/data/list/user.mocks.ts","./src/mocks/data/list/user.ts","./src/pages/pegase/antares/Antares.tsx","./src/pages/pegase/home/HomePage.tsx","./src/pages/pegase/home/components/HomePageContent.tsx","./src/pages/pegase/home/components/SearchBar.tsx","./src/pages/pegase/home/components/StudiesPagination.tsx","./src/pages/pegase/home/components/StudyTableDisplay.tsx","./src/pages/pegase/home/components/StudyTableHeaders.tsx","./src/pages/pegase/home/components/StudyTableUtils.tsx","./src/pages/pegase/home/pinnedProjects/PinnedProject.tsx","./src/pages/pegase/home/pinnedProjects/PinnedProjectCard.tsx","./src/pages/pegase/home/pinnedProjects/ProjectCreator.tsx","./src/pages/pegase/logout/Logout.tsx","./src/pages/pegase/projects/ProjectContent.tsx","./src/pages/pegase/projects/ProjectsPage.tsx","./src/pages/pegase/projects/ProjectsPagination.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetails.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetailsContent.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetailsHeader.tsx","./src/pages/pegase/reports/LogsPage.tsx","./src/pages/pegase/settings/Settings.tsx","./src/pages/pegase/studies/HorizonInput.tsx","./src/pages/pegase/studies/KeywordsInput.tsx","./src/pages/pegase/studies/ProjectInput.tsx","./src/pages/pegase/studies/StudyCreationModal.tsx","./src/pages/pegase/studies/studyDetails/AreaLinkTab.tsx","./src/pages/pegase/studies/studyDetails/AreaLinkTableHeaders.tsx","./src/pages/pegase/studies/studyDetails/EnrTab.tsx","./src/pages/pegase/studies/studyDetails/LoadTab.tsx","./src/pages/pegase/studies/studyDetails/MiscLinkTab.tsx","./src/pages/pegase/studies/studyDetails/StudyDetailsContent.tsx","./src/pages/pegase/studies/studyDetails/StudyNavigationMenu.tsx","./src/pages/pegase/studies/studyDetails/ThermalTab.tsx","./src/pages/pegase/studies/studyDetails/areaLinkTable.tsx","./src/pages/pegase/studies/studyDetails/studyDetails.tsx","./src/pages/pegase/studies/studyDetails/studyHeader.tsx","./src/shared/constants.ts","./src/shared/const/apiEndPoint.ts","./src/shared/enum/project.ts","./src/shared/notification/containers.tsx","./src/shared/notification/notification.tsx","./src/shared/services/pinnedProjectService.ts","./src/shared/services/projectService.ts","./src/shared/services/studyService.ts","./src/shared/services/test/pinnedProjectService.test.tsx","./src/shared/services/test/projectService.test.tsx","./src/shared/services/test/studyService.test.tsx","./src/shared/types/index.ts","./src/shared/types/common/DisplayStatus.type.ts","./src/shared/types/common/MenuNavItem.type.ts","./src/shared/types/common/StdBase.type.ts","./src/shared/types/common/StudyStatus.type.ts","./src/shared/types/common/Tailwind.type.ts","./src/shared/types/common/TailwindColorClass.type.ts","./src/shared/types/common/User.type.ts","./src/shared/types/common/UserSettings.type.ts","./src/shared/types/common/tests/testUtils.tsx","./src/shared/types/pegase/Project.type.ts","./src/shared/types/pegase/Study.type.ts","./src/shared/utils/dateFormatter.ts","./src/shared/utils/slotsUtils.ts","./src/shared/utils/tabIndexUtils.ts","./src/shared/utils/common/defaultUtils.ts","./src/shared/utils/common/displayUtils.ts","./src/shared/utils/common/slotsUtils.ts","./src/shared/utils/common/classes/classMerger.ts","./src/shared/utils/common/classes/test/classMerger.test.ts","./src/shared/utils/common/dom/getDimensions.ts","./src/shared/utils/common/dom/test/getDimensions.test.tsx","./src/shared/utils/common/mappings/iconMaps.ts","./src/shared/utils/tests/dateFormatter.test.tsx","./src/store/contexts/ModalContext.tsx","./src/store/contexts/ProjectContext.tsx","./src/store/contexts/UserContext.tsx","./src/store/contexts/createFastContext.tsx","./src/store/reducers/projectReducer.tsx","./tailwind.config.ts","./vite-env.d.ts"],"version":"5.7.2"} +{"root":["./src/App.tsx","./src/envVariables.ts","./src/i18n.ts","./src/main.tsx","./src/routes.tsx","./src/testSetup.ts","./src/vite-env.d.ts","./src/components/common/base/stdIcon/Icon.tsx","./src/components/common/base/stdIcon/StdIcon.tsx","./src/components/common/base/stdIcon/iconClassBuilder.ts","./src/components/common/data/stdSimpleTable/StdSimpleTable.tsx","./src/components/common/data/stdSimpleTable/tests/stdSimpleTable.test.tsx","./src/components/common/data/stdTable/TableContext.tsx","./src/components/common/data/stdTable/TableCore.tsx","./src/components/common/data/stdTable/tableCoreRowClassBuilder.ts","./src/components/common/data/stdTable/useTableContext.ts","./src/components/common/data/stdTable/cells/ExpandableCell.tsx","./src/components/common/data/stdTable/cells/tests/expandableCell.test.tsx","./src/components/common/data/stdTable/features/readOnly.ts","./src/components/common/data/stdTable/lineRender/StdCollapseIcon.tsx","./src/components/common/data/stdTable/tests/TableCore.test.tsx","./src/components/common/data/stdTable/tests/tableCoreRowClassBuilder.test.ts","./src/components/common/data/stdTable/tests/testTableUtils.ts","./src/components/common/data/stdTable/types/readOnly.type.d.ts","./src/components/common/data/stdTable/types/sizeClassNames.d.ts","./src/components/common/handler/ThemeHandler.tsx","./src/components/common/handler/test/ThemeHandler.test.tsx","./src/components/common/layout/stdAvatar/StdAvatar.tsx","./src/components/common/layout/stdAvatar/avatarClassBuilder.ts","./src/components/common/layout/stdAvatar/tests/StdAvatar.test.tsx","./src/components/common/layout/stdAvatar/tests/avatarClassBuilder.test.ts","./src/components/common/layout/stdAvatarGroup/StdAvatarGroup.tsx","./src/components/common/layout/stdAvatarGroup/avatarGroupClassBuilder.ts","./src/components/common/layout/stdAvatarGroup/avatarTools.ts","./src/components/common/layout/stdAvatarGroup/tests/StdAvatarGroup.test.tsx","./src/components/common/layout/stdAvatarGroup/tests/avatarTools.test.ts","./src/components/common/layout/stdTextWithTooltip/StdTextWithTooltip.tsx","./src/components/common/modal/ProjectCreationModal.tsx","./src/components/common/modal/StudyCreationModal.tsx","./src/components/pegase/header/Header.tsx","./src/components/pegase/pegaseCard/cardClassBuilder.ts","./src/components/pegase/pegaseCard/pegaseCard.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/cardTitleClassBuilder.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/pegaseCardTitle.tsx","./src/components/pegase/pegaseCard/pegaseCardTitle/tests/cardTitleClassBuilder.test.ts","./src/components/pegase/pegaseCard/pegaseCardTitle/tests/pegaseCardTitle.test.tsx","./src/components/pegase/pegaseCard/tests/cardTripleActionClassBuilder.test.ts","./src/components/pegase/pegaseCard/tests/pegaseCardTripleAction.test.tsx","./src/components/pegase/star/PegaseStar.tsx","./src/hooks/useDateFormatter.ts","./src/hooks/useDropdownOptions.ts","./src/hooks/useFetchProjectList.ts","./src/hooks/useHandlePinnedProjectList.ts","./src/hooks/useNewStudyModal.ts","./src/hooks/useProjectNavigation.ts","./src/hooks/useStudyNavigation.ts","./src/hooks/useStudyTableDisplay.ts","./src/hooks/common/usePrevious.ts","./src/hooks/common/test/usePrevious.test.ts","./src/hooks/test/useDropdownOptions.test.ts","./src/hooks/test/useFetchProjectList.test.ts","./src/hooks/test/useHandlePinnedProjectList.test.tsx","./src/hooks/test/useNewStudyModal.test.ts","./src/hooks/test/useProjectNavigation.test.tsx","./src/hooks/test/useStudyNavigation.test.tsx","./src/hooks/test/useStudyTableDisplay.test.ts","./src/mocks/mockTools.ts","./src/mocks/data/components/dropdownItems.mock.ts","./src/mocks/data/components/navbarHeader.ts","./src/mocks/data/features/menuItemData.mock.tsx","./src/mocks/data/list/keywords.ts","./src/mocks/data/list/names.ts","./src/mocks/data/list/projectName.ts","./src/mocks/data/list/studyName.ts","./src/mocks/data/list/user.mocks.ts","./src/mocks/data/list/user.ts","./src/pages/pegase/antares/Antares.tsx","./src/pages/pegase/home/HomePage.tsx","./src/pages/pegase/home/components/HomePageContent.tsx","./src/pages/pegase/home/components/SearchBar.tsx","./src/pages/pegase/home/components/StudiesPagination.tsx","./src/pages/pegase/home/components/StudyTableDisplay.tsx","./src/pages/pegase/home/components/StudyTableHeaders.tsx","./src/pages/pegase/home/components/StudyTableUtils.tsx","./src/pages/pegase/home/pinnedProjects/PinnedProject.tsx","./src/pages/pegase/home/pinnedProjects/PinnedProjectCard.tsx","./src/pages/pegase/home/pinnedProjects/ProjectCreator.tsx","./src/pages/pegase/logout/Logout.tsx","./src/pages/pegase/projects/ProjectContent.tsx","./src/pages/pegase/projects/ProjectsPage.tsx","./src/pages/pegase/projects/ProjectsPagination.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetails.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetailsContent.tsx","./src/pages/pegase/projects/projectDetails/ProjectDetailsHeader.tsx","./src/pages/pegase/reports/LogsPage.tsx","./src/pages/pegase/settings/Settings.tsx","./src/pages/pegase/studies/HorizonInput.tsx","./src/pages/pegase/studies/KeywordsInput.tsx","./src/pages/pegase/studies/ProjectInput.tsx","./src/pages/pegase/studies/studyDetails/AreaLinkTab.tsx","./src/pages/pegase/studies/studyDetails/AreaLinkTableHeaders.tsx","./src/pages/pegase/studies/studyDetails/EnrTab.tsx","./src/pages/pegase/studies/studyDetails/LoadTab.tsx","./src/pages/pegase/studies/studyDetails/MiscLinkTab.tsx","./src/pages/pegase/studies/studyDetails/StudyDetailsContent.tsx","./src/pages/pegase/studies/studyDetails/StudyNavigationMenu.tsx","./src/pages/pegase/studies/studyDetails/ThermalTab.tsx","./src/pages/pegase/studies/studyDetails/areaLinkTable.tsx","./src/pages/pegase/studies/studyDetails/studyDetails.tsx","./src/pages/pegase/studies/studyDetails/studyHeader.tsx","./src/shared/constants.ts","./src/shared/const/apiEndPoint.ts","./src/shared/const/navBarConfig.ts","./src/shared/enum/project.ts","./src/shared/notification/containers.tsx","./src/shared/notification/notification.tsx","./src/shared/services/pinnedProjectService.ts","./src/shared/services/projectService.ts","./src/shared/services/studyService.ts","./src/shared/services/test/pinnedProjectService.test.tsx","./src/shared/services/test/projectService.test.tsx","./src/shared/services/test/studyService.test.tsx","./src/shared/types/index.ts","./src/shared/types/common/DisplayStatus.type.ts","./src/shared/types/common/MenuNavItem.type.ts","./src/shared/types/common/StdBase.type.ts","./src/shared/types/common/StudyStatus.type.ts","./src/shared/types/common/Tailwind.type.ts","./src/shared/types/common/TailwindColorClass.type.ts","./src/shared/types/common/User.type.ts","./src/shared/types/common/UserSettings.type.ts","./src/shared/types/common/tests/testUtils.tsx","./src/shared/types/pegase/Project.type.ts","./src/shared/types/pegase/Study.type.ts","./src/shared/utils/dateFormatter.ts","./src/shared/utils/slotsUtils.ts","./src/shared/utils/tabIndexUtils.ts","./src/shared/utils/textUtils.ts","./src/shared/utils/common/defaultUtils.ts","./src/shared/utils/common/displayUtils.ts","./src/shared/utils/common/slotsUtils.ts","./src/shared/utils/common/classes/classMerger.ts","./src/shared/utils/common/classes/test/classMerger.test.ts","./src/shared/utils/common/dom/getDimensions.ts","./src/shared/utils/common/dom/test/getDimensions.test.tsx","./src/shared/utils/common/mappings/iconMaps.ts","./src/shared/utils/tests/dateFormatter.test.tsx","./src/store/contexts/ModalContext.tsx","./src/store/contexts/ProjectContext.tsx","./src/store/contexts/UserContext.tsx","./src/store/contexts/createFastContext.tsx","./src/store/reducers/projectReducer.tsx","./tailwind.config.ts","./vite-env.d.ts"],"version":"5.7.2"} +