diff --git a/apps/client/package.json b/apps/client/package.json index c397d00126..4091ec5320 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -4,12 +4,10 @@ "private": true, "type": "module", "dependencies": { - "@chakra-ui/react": "^2.7.0", "@dnd-kit/core": "^6.1.0", "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.2", - "@emotion/react": "^11.10.6", - "@emotion/styled": "^11.10.6", + "@mantine/core": "^7.6.2", "@mantine/hooks": "^7.6.2", "@react-icons/all-files": "^4.1.0", "@sentry/react": "^7.92.0", diff --git a/apps/client/src/App.tsx b/apps/client/src/App.tsx index 7cedda359e..25b0f47f62 100644 --- a/apps/client/src/App.tsx +++ b/apps/client/src/App.tsx @@ -1,6 +1,6 @@ import { useEffect } from 'react'; import { BrowserRouter } from 'react-router-dom'; -import { ChakraProvider } from '@chakra-ui/react'; +import { MantineProvider } from '@mantine/core'; import { QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; @@ -11,10 +11,11 @@ import useElectronEvent from './common/hooks/useElectronEvent'; import { ontimeQueryClient } from './common/queryClient'; import { socketClientName } from './common/stores/connectionName'; import { connectSocket } from './common/utils/socket'; -import theme from './theme/theme'; import { TranslationProvider } from './translation/TranslationProvider'; import AppRouter from './AppRouter'; +import { theme } from './theme/mantineTheme'; + // Load Open Sans typeface // @ts-expect-error no types from font import import('typeface-open-sans'); @@ -49,10 +50,10 @@ function App() { }, [isElectron, sendToElectron]); return ( - - - - + + + +
@@ -63,10 +64,10 @@ function App() {
-
-
-
-
+ + + + ); } diff --git a/apps/client/src/common/components/buttons/QuitIconBtn.tsx b/apps/client/src/common/components/buttons/QuitIconBtn.tsx index b99d241917..d93564c489 100644 --- a/apps/client/src/common/components/buttons/QuitIconBtn.tsx +++ b/apps/client/src/common/components/buttons/QuitIconBtn.tsx @@ -1,15 +1,7 @@ -import { useCallback, useEffect, useRef, useState } from 'react'; -import { - AlertDialog, - AlertDialogBody, - AlertDialogContent, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogOverlay, - Button, - IconButton, - Tooltip, -} from '@chakra-ui/react'; +import { useCallback, useEffect } from 'react'; +import { ActionIcon, Button, Group, Modal, Space, Tooltip } from '@mantine/core'; +import { useDisclosure } from '@mantine/hooks'; + import { IoPowerOutline } from '@react-icons/all-files/io5/IoPowerOutline'; import { useEmitLog } from '../../stores/logger'; @@ -19,78 +11,60 @@ interface QuitIconBtnProps { disabled?: boolean; } -const quitBtnStyle = { - color: '#D20300', // $red-700 - borderColor: '#D20300', // $red-700 - _focus: { boxShadow: 'none' }, - _hover: { - background: '#D20300', // $red-700 - color: 'white', - _disabled: { - color: '#D20300', // $red-700 - background: 'none', - }, - }, - _active: { - background: '#9A0000', // $red-1000 - color: 'white', - }, - variant: 'outline', - isRound: true, -}; - export default function QuitIconBtn(props: QuitIconBtnProps) { - const { clickHandler, disabled, ...rest } = props; - const [isOpen, setIsOpen] = useState(false); + const { clickHandler, disabled } = props; + const [opened, { open, close }] = useDisclosure(false); const { emitInfo } = useEmitLog(); - const onClose = () => setIsOpen(false); - const cancelRef = useRef(null); useEffect(() => { if (window.process?.type === 'renderer') { window.ipcRenderer.on('user-request-shutdown', () => { emitInfo('Shutdown request'); - setIsOpen(true); + open(); }); } - }, [emitInfo]); + }, [emitInfo, open]); const handleShutdown = useCallback(() => { - onClose(); + close(); clickHandler(); - }, [clickHandler]); + }, [clickHandler, close]); return ( <> - } - onClick={() => setIsOpen(true)} - isDisabled={disabled} - {...quitBtnStyle} - {...rest} - /> + color='red' + onClick={open} + disabled={disabled} + > + + - - - - - Ontime Shutdown - - This will shutdown the Ontime server. Are you sure? - - - - - - - + + + + ); } diff --git a/apps/client/src/common/components/buttons/TooltipActionBtn.tsx b/apps/client/src/common/components/buttons/TooltipActionBtn.tsx index 81f4de703a..1b57becc20 100644 --- a/apps/client/src/common/components/buttons/TooltipActionBtn.tsx +++ b/apps/client/src/common/components/buttons/TooltipActionBtn.tsx @@ -1,17 +1,21 @@ import { MouseEvent } from 'react'; -import { IconButton, IconButtonProps, Tooltip } from '@chakra-ui/react'; +import { ActionIcon, ActionIconProps, FloatingPosition, Tooltip } from '@mantine/core'; -interface TooltipActionBtnProps extends IconButtonProps { +interface TooltipActionBtnProps extends ActionIconProps { clickHandler: (event: MouseEvent) => void | Promise; tooltip: string; + tooltipPosition?: FloatingPosition; openDelay?: number; + icon: React.ReactNode; } export default function TooltipActionBtn(props: TooltipActionBtnProps) { - const { clickHandler, icon, size = 'xs', tooltip, openDelay = 0, className, ...rest } = props; + const { clickHandler, icon, size = 'xs', tooltip, openDelay = 0, tooltipPosition, className, ...rest } = props; return ( - - + + + {icon} + ); } diff --git a/apps/client/src/common/components/context-menu/ContextMenu.tsx b/apps/client/src/common/components/context-menu/ContextMenu.tsx index 56e024f7d0..3937d94744 100644 --- a/apps/client/src/common/components/context-menu/ContextMenu.tsx +++ b/apps/client/src/common/components/context-menu/ContextMenu.tsx @@ -2,7 +2,7 @@ // https://github.com/lukasbach/chakra-ui-contextmenu/blob/main/src/ContextMenu.tsx import { ReactElement } from 'react'; -import { Menu, MenuButton, MenuGroup, MenuList } from '@chakra-ui/react'; +import { Menu, Button } from '@mantine/core'; import { IconType } from '@react-icons/all-files'; import { create } from 'zustand'; @@ -68,8 +68,8 @@ export const ContextMenu = ({ children }: ContextMenuProps) => { <> {children}
- - + ); diff --git a/apps/client/src/common/components/context-menu/ContextMenuOption.tsx b/apps/client/src/common/components/context-menu/ContextMenuOption.tsx index 8e8a6bfe97..b47442930f 100644 --- a/apps/client/src/common/components/context-menu/ContextMenuOption.tsx +++ b/apps/client/src/common/components/context-menu/ContextMenuOption.tsx @@ -1,12 +1,12 @@ -import { MenuDivider, MenuItem } from '@chakra-ui/react'; +import { Menu } from '@mantine/core'; import { OptionWithoutGroup } from './ContextMenu'; export const ContextMenuOption = ({ label, onClick, isDisabled, icon: Icon, withDivider }: OptionWithoutGroup) => ( <> - {withDivider && } - } onClick={onClick} isDisabled={isDisabled}> + {withDivider && } + } onClick={onClick} disabled={isDisabled}> {label} - + ); diff --git a/apps/client/src/common/components/copy-tag/CopyTag.tsx b/apps/client/src/common/components/copy-tag/CopyTag.tsx index 1464d1aec4..a456a44b7e 100644 --- a/apps/client/src/common/components/copy-tag/CopyTag.tsx +++ b/apps/client/src/common/components/copy-tag/CopyTag.tsx @@ -1,5 +1,5 @@ import { PropsWithChildren } from 'react'; -import { Button, ButtonGroup, IconButton, Tooltip } from '@chakra-ui/react'; +import { Button, ActionIcon, Tooltip } from '@mantine/core'; import { IoCopy } from '@react-icons/all-files/io5/IoCopy'; import { tooltipDelayFast } from '../../../ontimeConfig'; @@ -20,19 +20,20 @@ export default function CopyTag(props: PropsWithChildren) { return ( - - - } variant='ontime-filled' tabIndex={-1} onClick={handleClick} - isDisabled={disabled} - /> - + disabled={disabled} + > + + + ); } diff --git a/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx b/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx index 14b01a55dc..b36a8bed2f 100644 --- a/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx +++ b/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx @@ -1,4 +1,4 @@ -import { Tooltip } from '@chakra-ui/react'; +import { Tooltip } from '@mantine/core'; import { IoChevronDown } from '@react-icons/all-files/io5/IoChevronDown'; import { IoChevronUp } from '@react-icons/all-files/io5/IoChevronUp'; diff --git a/apps/client/src/common/components/input/auto-text-area/AutoTextArea.tsx b/apps/client/src/common/components/input/auto-text-area/AutoTextArea.tsx index 1e47b8a848..949c1f9c2a 100644 --- a/apps/client/src/common/components/input/auto-text-area/AutoTextArea.tsx +++ b/apps/client/src/common/components/input/auto-text-area/AutoTextArea.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { Textarea, TextareaProps } from '@chakra-ui/react'; +import { Textarea, TextareaProps } from '@mantine/core'; // @ts-expect-error no types from library import autosize from 'autosize/dist/autosize'; @@ -18,11 +18,11 @@ export const AutoTextArea = (props: TextareaProps) => { return (