From d486d78594099989fe0197f7f3142afffd7277a1 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Sun, 27 Nov 2022 14:56:09 +0100 Subject: [PATCH] v2 styling (#263) * feat: implement progress bar on running event * refactor: use event action hook * refactor: align backend data * style: v2 style tweaks * style: v2 style tweaks + ts * fix: fix delay increment calls * style: v2 style tweaks + ts * style: v2 style tweaks + ts * style: v2 style tweaks + ts * fix: naming issue with message control socket endpoint * chore: upgrade style dependencies * style: v2 style tweaks + ts * style: v2 style tweaks + ts * style: v2 style tweaks + ts * fix: add selected and next information to EventTimer * style: v2 style tweaks + ts * style: v2 style tweaks + ts * style: v2 style tweaks + ts * style: v2 style tweaks + ts * refactor: extract logic * chore: upgrade build dependencies * chore: folder structure refactor * fix: issue with dependency path in electron * chore: update version in demo db --- client/package.json | 16 +- .../components/buttons/ActionButtons.tsx | 51 - .../common/components/buttons/QuitIconBtn.tsx | 24 +- .../components/collapseBar/CollapseBar.jsx | 25 - .../collapseBar/CollapseBar.module.scss | 22 +- .../components/collapseBar/CollapseBar.tsx | 20 + .../common/components/copy-tag/CopyTag.tsx | 35 + .../components/countdown/TimerDisplay.scss | 4 +- .../common/components/input/AutoTextArea.jsx | 27 - .../src/common/components/input/TextInput.jsx | 106 - .../src/common/components/input/TimeInput.jsx | 197 -- .../components/input/TimeInput.module.scss | 47 - .../input/auto-text-area/AutoTextArea.tsx | 34 + .../ColourInput.module.scss | 2 - .../input/{ => colour-input}/ColourInput.tsx | 2 +- .../input/delay-input/DelayInput.module.scss | 9 + .../DelayInput.tsx} | 58 +- .../components/input/text-input/TextInput.tsx | 46 + .../__tests__/TextInput.test.tsx} | 9 +- .../input/text-input/useReactiveTextInput.tsx | 88 + .../components/input/time-input/TimeInput.jsx | 174 ++ .../input/time-input/TimeInput.module.scss | 19 + .../NavigationMenu.module.scss | 42 +- .../components/osc-tag/CopyTag.module.scss | 26 - .../src/common/components/osc-tag/CopyTag.tsx | 34 - client/src/common/context/LoggingContext.tsx | 17 +- client/src/common/hooks/useSocket.ts | 4 +- client/src/common/models/Info.types.ts | 9 +- .../control/__tests__/MessageControl.test.jsx | 39 - .../__tests__/PlaybackControl.test.jsx | 21 - .../control/message/InputRow.module.scss | 17 + .../src/features/control/message/InputRow.tsx | 18 +- .../control/message/MessageControl.jsx | 64 - .../message/MessageControl.module.scss | 75 +- .../control/message/MessageControl.tsx | 52 + .../control/message/MessageControlExport.jsx | 4 +- .../features/control/playback/Playback.tsx | 60 +- .../control/playback/PlaybackButtons.jsx | 42 - .../control/playback/PlaybackButtons.tsx | 28 + .../playback/PlaybackControl.module.scss | 36 +- .../control/playback/PlaybackTimer.tsx | 26 +- .../control/playback/TapButton.module.scss | 63 +- ...ntrolExport.jsx => TimerControlExport.tsx} | 6 +- .../features/control/playback/Transport.tsx | 8 +- .../src/features/editors/Editor.module.scss | 20 +- .../src/features/event-editor/EventEditor.jsx | 57 +- .../event-editor/EventEditor.module.scss | 152 +- client/src/features/info/CollapsableInfo.tsx | 52 + client/src/features/info/Info.jsx | 4 +- client/src/features/info/Info.module.scss | 84 +- client/src/features/info/InfoExport.jsx | 4 +- client/src/features/info/InfoLogger.jsx | 147 -- .../src/features/info/InfoLogger.module.scss | 99 +- client/src/features/info/InfoLogger.tsx | 148 ++ .../info/{InfoNif.jsx => InfoNif.tsx} | 27 +- client/src/features/info/InfoTitle.jsx | 52 - .../src/features/info/__tests__/Info.test.jsx | 20 - client/src/features/menu/MenuBar.tsx | 30 +- client/src/features/menu/RundownMenu.tsx | 52 +- .../features/menu/__tests__/MenuBar.test.tsx | 33 - client/src/features/rundown/Rundown.jsx | 37 +- .../src/features/rundown/Rundown.module.scss | 11 - client/src/features/rundown/RundownEntry.tsx | 6 +- client/src/features/rundown/RundownExport.tsx | 4 +- client/src/features/rundown/_blockMixins.scss | 40 +- .../rundown/block-block/BlockBlock.jsx | 44 - .../block-block/BlockBlock.module.scss | 27 +- .../rundown/block-block/BlockBlock.tsx | 37 + .../delay-block/DelayBlock.module.scss | 39 +- .../{DelayBlock.jsx => DelayBlock.tsx} | 55 +- .../event-block/EventBlock.module.scss | 341 ++- .../rundown/event-block/EventBlock.tsx | 79 +- .../event-block/composite/BlockActionMenu.tsx | 84 + .../composite/EventBlockActionMenu.jsx | 87 - .../composite/EventBlockTimers.jsx | 2 +- .../quick-add-block/QuickAddBlock.module.scss | 70 +- .../rundown/quick-add-block/QuickAddBlock.tsx | 69 +- client/src/features/table/OntimeTable.jsx | 1 - client/src/features/table/Table.module.scss | 70 +- .../table/tableElements/EditableCell.jsx | 5 +- .../src/features/table/tableRows/EventRow.jsx | 15 +- client/src/index.jsx | 5 +- client/src/index.scss | 14 +- client/src/theme/_main.scss | 13 +- client/src/theme/_mixins.scss | 22 +- client/src/theme/_ontimeColours.scss | 108 + client/src/theme/_v2Styles.scss | 47 + client/src/theme/_viewerDefs.scss | 3 + client/src/theme/ontimeButton.ts | 53 + client/src/theme/ontimeCheckbox.ts | 21 + client/src/theme/ontimeMenu.ts | 18 + client/src/theme/ontimeSelect.ts | 20 + client/src/theme/ontimeSwitch.ts | 10 + client/src/theme/ontimeTextInputs.ts | 43 + client/src/theme/ontimeTooltip.ts | 12 + client/src/theme/theme.js | 50 - client/src/theme/theme.ts | 88 + client/yarn.lock | 1866 ++++++++--------- server/demo-db/db.json | 2 +- server/main.js | 6 +- .../src/classes/event-loader/EventLoader.js | 10 +- server/src/classes/socket/SocketController.js | 14 +- server/src/classes/socket/socketConfig.js | 2 +- server/src/classes/timer/EventTimer.js | 7 +- 104 files changed, 3027 insertions(+), 3217 deletions(-) delete mode 100644 client/src/common/components/buttons/ActionButtons.tsx delete mode 100644 client/src/common/components/collapseBar/CollapseBar.jsx create mode 100644 client/src/common/components/collapseBar/CollapseBar.tsx create mode 100644 client/src/common/components/copy-tag/CopyTag.tsx delete mode 100644 client/src/common/components/input/AutoTextArea.jsx delete mode 100644 client/src/common/components/input/TextInput.jsx delete mode 100644 client/src/common/components/input/TimeInput.jsx delete mode 100644 client/src/common/components/input/TimeInput.module.scss create mode 100644 client/src/common/components/input/auto-text-area/AutoTextArea.tsx rename client/src/common/components/input/{ => colour-input}/ColourInput.module.scss (76%) rename client/src/common/components/input/{ => colour-input}/ColourInput.tsx (94%) create mode 100644 client/src/common/components/input/delay-input/DelayInput.module.scss rename client/src/common/components/input/{DelayInput.jsx => delay-input/DelayInput.tsx} (50%) create mode 100644 client/src/common/components/input/text-input/TextInput.tsx rename client/src/common/components/input/{__tests__/TextInput.test.jsx => text-input/__tests__/TextInput.test.tsx} (93%) create mode 100644 client/src/common/components/input/text-input/useReactiveTextInput.tsx create mode 100644 client/src/common/components/input/time-input/TimeInput.jsx create mode 100644 client/src/common/components/input/time-input/TimeInput.module.scss delete mode 100644 client/src/common/components/osc-tag/CopyTag.module.scss delete mode 100644 client/src/common/components/osc-tag/CopyTag.tsx delete mode 100644 client/src/features/control/__tests__/MessageControl.test.jsx delete mode 100644 client/src/features/control/__tests__/PlaybackControl.test.jsx create mode 100644 client/src/features/control/message/InputRow.module.scss delete mode 100644 client/src/features/control/message/MessageControl.jsx create mode 100644 client/src/features/control/message/MessageControl.tsx delete mode 100644 client/src/features/control/playback/PlaybackButtons.jsx create mode 100644 client/src/features/control/playback/PlaybackButtons.tsx rename client/src/features/control/playback/{TimerControlExport.jsx => TimerControlExport.tsx} (66%) create mode 100644 client/src/features/info/CollapsableInfo.tsx delete mode 100644 client/src/features/info/InfoLogger.jsx create mode 100644 client/src/features/info/InfoLogger.tsx rename client/src/features/info/{InfoNif.jsx => InfoNif.tsx} (52%) delete mode 100644 client/src/features/info/InfoTitle.jsx delete mode 100644 client/src/features/info/__tests__/Info.test.jsx delete mode 100644 client/src/features/menu/__tests__/MenuBar.test.tsx delete mode 100644 client/src/features/rundown/block-block/BlockBlock.jsx create mode 100644 client/src/features/rundown/block-block/BlockBlock.tsx rename client/src/features/rundown/delay-block/{DelayBlock.jsx => DelayBlock.tsx} (51%) create mode 100644 client/src/features/rundown/event-block/composite/BlockActionMenu.tsx delete mode 100644 client/src/features/rundown/event-block/composite/EventBlockActionMenu.jsx create mode 100644 client/src/theme/_ontimeColours.scss create mode 100644 client/src/theme/_v2Styles.scss create mode 100644 client/src/theme/ontimeButton.ts create mode 100644 client/src/theme/ontimeCheckbox.ts create mode 100644 client/src/theme/ontimeMenu.ts create mode 100644 client/src/theme/ontimeSelect.ts create mode 100644 client/src/theme/ontimeSwitch.ts create mode 100644 client/src/theme/ontimeTextInputs.ts create mode 100644 client/src/theme/ontimeTooltip.ts delete mode 100644 client/src/theme/theme.js create mode 100644 client/src/theme/theme.ts diff --git a/client/package.json b/client/package.json index 115566c0b..5faa02bd9 100644 --- a/client/package.json +++ b/client/package.json @@ -3,12 +3,12 @@ "version": "1.9.6", "private": true, "dependencies": { - "@chakra-ui/react": "2.3.4", + "@chakra-ui/react": "^2.4.1", "@dnd-kit/core": "^6.0.5", "@dnd-kit/sortable": "^7.0.1", "@dnd-kit/utilities": "^3.2.0", - "@emotion/react": "^11.10.4", - "@emotion/styled": "^11.10.4", + "@emotion/react": "^11.10.5", + "@emotion/styled": "^11.10.5", "@react-icons/all-files": "^4.1.0", "@tanstack/react-query": "^4.10.3", "@tanstack/react-query-devtools": "^4.11.0", @@ -61,7 +61,7 @@ "@types/react-dom": "^18.0.6", "@typescript-eslint/eslint-plugin": "^5.37.0", "@typescript-eslint/parser": "^5.37.0", - "@vitejs/plugin-react": "^2.1.0", + "@vitejs/plugin-react": "^2.2.0", "eslint": "^8.25.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-jest": "^27.0.4", @@ -77,10 +77,10 @@ "stylelint-config-prettier": "^9.0.3", "stylelint-config-standard-scss": "^4.0.0", "typescript": "^4.8.3", - "vite": "^3.1.6", - "vite-plugin-svgr": "^2.2.1", - "vite-tsconfig-paths": "^3.5.0", - "vitest": "^0.23.2" + "vite": "^3.2.4", + "vite-plugin-svgr": "^2.2.2", + "vite-tsconfig-paths": "^3.6.0", + "vitest": "^0.25.3" }, "resolutions": { "**/@types/react": "18.0.21" diff --git a/client/src/common/components/buttons/ActionButtons.tsx b/client/src/common/components/buttons/ActionButtons.tsx deleted file mode 100644 index 62344a52c..000000000 --- a/client/src/common/components/buttons/ActionButtons.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { IconButton, Menu, MenuButton, MenuItem, MenuList, Tooltip } from '@chakra-ui/react'; -import { FiClock } from '@react-icons/all-files/fi/FiClock'; -import { FiMinusCircle } from '@react-icons/all-files/fi/FiMinusCircle'; -import { FiPlus } from '@react-icons/all-files/fi/FiPlus'; - -interface ActionButtonProps { - showAdd?: boolean; - showDelay?: boolean; - showBlock?: boolean; - actionHandler: (action: string) => void; -} - -export default function ActionButtons(props: ActionButtonProps) { - const { showAdd, showDelay, showBlock, actionHandler } = props; - - const menuStyle = { - color: '#000000', - backgroundColor: 'rgba(255,255,255,1)', - }; - - return ( - - - } - colorScheme='white' - variant='outline' - /> - - - } onClick={() => actionHandler('event')} isDisabled={!showAdd}> - Add Event after - - - } onClick={() => actionHandler('delay')} isDisabled={!showDelay}> - Add Delay after - - } - onClick={() => actionHandler('block')} - isDisabled={!showBlock} - > - Add Block after - - - - ); -} diff --git a/client/src/common/components/buttons/QuitIconBtn.tsx b/client/src/common/components/buttons/QuitIconBtn.tsx index 5c35b1f37..1c16afc50 100644 --- a/client/src/common/components/buttons/QuitIconBtn.tsx +++ b/client/src/common/components/buttons/QuitIconBtn.tsx @@ -19,6 +19,23 @@ interface QuitIconBtnProps { clickHandler: () => void; size?: Size; } + +const quitBtnStyle = { + color: '#D20300', // $red-700 + borderColor: '#D20300', // $red-700 + _focus: { boxShadow: 'none' }, + _hover: { + background: '#D20300', // $red-700 + color: 'white', + }, + _active: { + background: '#9A0000', // $red-1000 + color: 'white', + }, + variant: 'outline', + isRound: true, +}; + export default function QuitIconBtn(props: QuitIconBtnProps) { const { clickHandler, size = 'lg', ...rest } = props; const [isOpen, setIsOpen] = useState(false); @@ -47,11 +64,8 @@ export default function QuitIconBtn(props: QuitIconBtnProps) { aria-label='Quit Application' size={size} icon={} - colorScheme='red' - variant='outline' - isRound onClick={() => setIsOpen(true)} - _focus={{ boxShadow: 'none' }} + {...quitBtnStyle} {...rest} /> @@ -59,7 +73,7 @@ export default function QuitIconBtn(props: QuitIconBtnProps) { - Server Shutdown + Ontime Shutdown This will shutdown the program and all running servers. Are you sure? diff --git a/client/src/common/components/collapseBar/CollapseBar.jsx b/client/src/common/components/collapseBar/CollapseBar.jsx deleted file mode 100644 index c2fcf2e60..000000000 --- a/client/src/common/components/collapseBar/CollapseBar.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Icon } from '@chakra-ui/react'; -import { FiChevronUp } from '@react-icons/all-files/fi/FiChevronUp'; -import PropTypes from 'prop-types'; - -import style from './CollapseBar.module.scss'; - -export default function CollapseBar(props) { - const { title = 'Collapse bar', isCollapsed, onClick } = props; - - return ( -
- {title} - -
- ); -} -CollapseBar.propTypes = { - title: PropTypes.string, - isCollapsed: PropTypes.bool, - onClick: PropTypes.func, -}; diff --git a/client/src/common/components/collapseBar/CollapseBar.module.scss b/client/src/common/components/collapseBar/CollapseBar.module.scss index cda8e11e4..290a15e70 100644 --- a/client/src/common/components/collapseBar/CollapseBar.module.scss +++ b/client/src/common/components/collapseBar/CollapseBar.module.scss @@ -1,27 +1,23 @@ -@use '../../../theme/main' as *; +@use '../../../theme/v2Styles' as *; .header { - padding: 0; - margin: 0; - font-size: 0.9em; + font-size: $inner-section-text-size; + font-weight: 600; display: flex; justify-content: space-between; - color: $header-gray; -} - - -.moreExpanded, -.moreCollapsed { + color: $section-white; + border-bottom: 1px solid $border-color-ondark; + padding-bottom: $element-inner-spacing; + margin-bottom: $element-spacing; cursor: pointer; - color: $text-white; } .moreExpanded { transform: scaleY(-1); - transition: transform 0.3s; + transition: transform $transition-time-feedback; } .moreCollapsed { transform: scaleY(1); - transition: transform 0.3s; + transition: transform $transition-time-feedback; } diff --git a/client/src/common/components/collapseBar/CollapseBar.tsx b/client/src/common/components/collapseBar/CollapseBar.tsx new file mode 100644 index 000000000..820462662 --- /dev/null +++ b/client/src/common/components/collapseBar/CollapseBar.tsx @@ -0,0 +1,20 @@ +import { FiChevronUp } from '@react-icons/all-files/fi/FiChevronUp'; + +import style from './CollapseBar.module.scss'; + +interface CollapseBarProps { + title: string; + isCollapsed: boolean; + onClick: () => void; +} + +export default function CollapseBar(props: CollapseBarProps) { + const { title = 'Collapse bar', isCollapsed, onClick } = props; + + return ( +
+ {title} + +
+ ); +} diff --git a/client/src/common/components/copy-tag/CopyTag.tsx b/client/src/common/components/copy-tag/CopyTag.tsx new file mode 100644 index 000000000..aa3e8c328 --- /dev/null +++ b/client/src/common/components/copy-tag/CopyTag.tsx @@ -0,0 +1,35 @@ +import { PropsWithChildren } from 'react'; +import { Button, ButtonGroup, IconButton, Tooltip } from '@chakra-ui/react'; +import { IoCopy } from '@react-icons/all-files/io5/IoCopy'; + +import { tooltipDelayFast } from '../../../ontimeConfig'; +import { Size } from '../../models/UtilTypes'; + +interface CopyTagProps { + label: string; + className?: string; + size?: Size; +} + +export default function CopyTag(props: PropsWithChildren) { + const { label, className, size = 'xs', children } = props; + + return ( + + + + } + variant='ontime-filled' + tabIndex={-1} + onClick={() => navigator.clipboard.writeText(children as string)} + /> + + + ); +} diff --git a/client/src/common/components/countdown/TimerDisplay.scss b/client/src/common/components/countdown/TimerDisplay.scss index bc0db663a..fd3739c02 100644 --- a/client/src/common/components/countdown/TimerDisplay.scss +++ b/client/src/common/components/countdown/TimerDisplay.scss @@ -1,7 +1,7 @@ @use '../../../theme/viewerDefs' as *; .timer { - font-family: 'Open Sans', sans-serif; + font-family: var(--font-family-override, $ontime-font-family); color: var(--timer-color-override, $viewer-color); font-size: 21vw; line-height: 21vw; @@ -9,7 +9,7 @@ letter-spacing: 1vw; &--small { - font-size: 4em; + font-size: 3.75em; line-height: 0.9; text-align: center; letter-spacing: 0.1em; diff --git a/client/src/common/components/input/AutoTextArea.jsx b/client/src/common/components/input/AutoTextArea.jsx deleted file mode 100644 index 0dbeb8626..000000000 --- a/client/src/common/components/input/AutoTextArea.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useEffect, useRef } from 'react'; -import { Textarea } from '@chakra-ui/react'; -import autosize from 'autosize/dist/autosize'; - -export const AutoTextArea = (props) => { - const ref = useRef(); - - useEffect(() => { - const node = ref.current; - autosize(ref.current); - return () => { - autosize.destroy(node); - }; - }, []); - - - return ( -