From b336d5a1cedac117a6a672347917bbef6ab25f22 Mon Sep 17 00:00:00 2001 From: gtzatchkova Date: Tue, 3 Sep 2024 23:43:22 +0200 Subject: [PATCH 1/9] Change Button name to 'Errors report' --- client/components/Parts/Bars/Menu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/Parts/Bars/Menu.tsx b/client/components/Parts/Bars/Menu.tsx index 6faec1d24..6d562bdac 100644 --- a/client/components/Parts/Bars/Menu.tsx +++ b/client/components/Parts/Bars/Menu.tsx @@ -93,7 +93,7 @@ export function ReportButton(props: ButtonProps) { Date: Wed, 4 Sep 2024 00:11:06 +0200 Subject: [PATCH 2/9] Change styling of datagrid metadata bar --- client/components/Controllers/Table/Menu.tsx | 5 +++ client/components/Parts/Bars/Menu.tsx | 32 +++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/client/components/Controllers/Table/Menu.tsx b/client/components/Controllers/Table/Menu.tsx index 88f1cd825..3b84fc799 100644 --- a/client/components/Controllers/Table/Menu.tsx +++ b/client/components/Controllers/Table/Menu.tsx @@ -13,24 +13,29 @@ export default function Menu() { store.togglePanel('metadata')} + color='OKFNCoolGray' /> store.togglePanel('report')} + color='OKFNCoolGray' /> store.togglePanel('source')} + color='OKFNCoolGray' /> ) diff --git a/client/components/Parts/Bars/Menu.tsx b/client/components/Parts/Bars/Menu.tsx index 6d562bdac..7af7370db 100644 --- a/client/components/Parts/Bars/Menu.tsx +++ b/client/components/Parts/Bars/Menu.tsx @@ -43,7 +43,7 @@ function MenuBarItems(props: React.PropsWithChildren) { export interface ButtonProps { label?: string - color?: 'success' | 'warning' | 'error' | 'info' + color?: 'success' | 'warning' | 'error' | 'info' | 'OKFNCoolGray' active?: boolean enabled?: boolean disabled?: boolean @@ -66,10 +66,14 @@ export function MetadataButton(props: ButtonProps) { variant="text" label={props.label || 'Metadata'} Icon={TuneIcon} - color={props.color || props.active ? 'warning' : undefined} + color={props.color || props.active ? 'OKFNCoolGray' : undefined} disabled={props.disabled || props.enabled} onClick={() => onClick()} sx={{ + '& .MuiTypography-root': { + fontSize: '16px', + fontWeight: '600' + }, '&.Mui-disabled': { color: props.enabled ? theme.palette.info.main : undefined, }, @@ -95,10 +99,14 @@ export function ReportButton(props: ButtonProps) { variant="text" label={props.label || 'Errors Report'} Icon={RuleIcon} - color={props.color || props.active ? 'warning' : undefined} + color={props.color || props.active ? 'OKFNCoolGray' : undefined} disabled={props.disabled || props.enabled} onClick={() => onClick()} sx={{ + '& .MuiTypography-root': { + fontSize: '16px', + fontWeight: '600' + }, '&.Mui-disabled': { color: props.enabled ? theme.palette.info.main : undefined, }, @@ -124,10 +132,14 @@ export function SourceButton(props: ButtonProps) { variant="text" label={props.label || 'Source'} Icon={CodeIcon} - color={props.color || props.active ? 'warning' : undefined} + color={props.color || props.active ? 'OKFNCoolGray' : undefined} disabled={props.disabled || props.enabled} onClick={() => onClick()} sx={{ + '& .MuiTypography-root': { + fontSize: '16px', + fontWeight: '600' + }, '&.Mui-disabled': { color: props.enabled ? theme.palette.info.main : undefined, }, @@ -178,6 +190,12 @@ export function UndoButton(props: ButtonProps) { color={props.color} disabled={props.disabled} onClick={() => onClick()} + sx={{ + '& .MuiTypography-root': { + fontSize: '16px', + fontWeight: '600' + }, + }} /> ) @@ -201,6 +219,12 @@ export function RedoButton(props: ButtonProps) { color={props.color} disabled={props.disabled} onClick={() => onClick()} + sx={{ + '& .MuiTypography-root': { + fontSize: '16px', + fontWeight: '600' + } + }} /> ) From 8edce4a5210291bbd34f5b757ccfa5d258506de5 Mon Sep 17 00:00:00 2001 From: gtzatchkova Date: Wed, 4 Sep 2024 00:49:08 +0200 Subject: [PATCH 3/9] Make style changes to datagrid --- client/components/Controllers/Table/Menu.tsx | 76 ++++++++++++------- client/components/Controllers/Table/index.tsx | 4 +- client/components/Parts/Bars/Action.tsx | 18 +++-- client/components/Parts/Bars/Menu.tsx | 2 +- 4 files changed, 61 insertions(+), 39 deletions(-) diff --git a/client/components/Controllers/Table/Menu.tsx b/client/components/Controllers/Table/Menu.tsx index 3b84fc799..85b66cfa4 100644 --- a/client/components/Controllers/Table/Menu.tsx +++ b/client/components/Controllers/Table/Menu.tsx @@ -1,5 +1,7 @@ import * as menu from '../../Parts/Bars/Menu' import * as store from '@client/store' +import Box from '@mui/material/Box' +import * as action from '../../Parts/Bars/Action' export default function Menu() { const panel = store.useStore((state) => state.panel) @@ -8,35 +10,53 @@ export default function Menu() { const source = store.useStore((state) => state.source) const undoneHistory = store.useStore((state) => state.table?.undoneHistory) + const isTableUpdated = store.useStore(store.getIsTableOrResourceUpdated) + return ( - - store.togglePanel('metadata')} - color='OKFNCoolGray' - /> - store.togglePanel('report')} - color='OKFNCoolGray' - /> - store.togglePanel('source')} - color='OKFNCoolGray' - /> - - + + + + store.togglePanel('metadata')} + color="OKFNCoolGray" + /> + store.togglePanel('report')} + color="OKFNCoolGray" + /> + store.togglePanel('source')} + color="OKFNCoolGray" + /> + + + + + store.openDialog('publish')} + /> + + + ) } diff --git a/client/components/Controllers/Table/index.tsx b/client/components/Controllers/Table/index.tsx index 75d8ec3bc..cc5617ec5 100644 --- a/client/components/Controllers/Table/index.tsx +++ b/client/components/Controllers/Table/index.tsx @@ -1,14 +1,13 @@ import Box from '@mui/material/Box' import ScrollBox from '../../Parts/Boxes/Scroll' import { useTheme } from '@mui/material/styles' -import Action from './Action' import Editor from './Editor' import Menu from './Menu' import Panel from './Panel' export default function Table() { const theme = useTheme() - const contentHeight = `calc(100vh - ${theme.spacing(8 + 8)})` + const contentHeight = `calc(100vh - ${theme.spacing(8)})` return ( @@ -17,7 +16,6 @@ export default function Table() { - ) } diff --git a/client/components/Parts/Bars/Action.tsx b/client/components/Parts/Bars/Action.tsx index 160cdab41..89e98f47b 100644 --- a/client/components/Parts/Bars/Action.tsx +++ b/client/components/Parts/Bars/Action.tsx @@ -2,7 +2,6 @@ import * as React from 'react' import noop from 'lodash/noop' import Box from '@mui/material/Box' import Toolbar from '@mui/material/Toolbar' -import IosShareIcon from '@mui/icons-material/IosShare' import SaveAltIcon from '@mui/icons-material/SaveAlt' import CheckIcon from '@mui/icons-material/Check' import HistoryIcon from '@mui/icons-material/History' @@ -10,6 +9,7 @@ import IconButton from '../../Parts/Buttons/Icon' import Columns from '../Grids/Columns' import LightTooltip from '../Tooltips/Light' import { useKeyPress } from 'ahooks' +import ElectricBoltIcon from '@mui/icons-material/ElectricBolt' export interface ActionBarProps {} @@ -50,12 +50,14 @@ export function SaveAsButton(props: ButtonProps) { onClick()} - sx={{ backgroundColor: 'white' }} + sx={{ backgroundColor: 'white', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { + borderColor: (theme) => theme.palette.OKFNCoolGray.main + } }} /> @@ -77,11 +79,13 @@ export function PublishButton(props: ButtonProps) { onClick()} - sx={{ backgroundColor: 'white' }} + sx={{ backgroundColor: 'white', textTransform: 'none', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { + borderColor: (theme) => theme.palette.OKFNCoolGray.main + } }} /> @@ -129,12 +133,12 @@ export function SaveButton(props: ButtonProps) { onClick()} - sx={{ backgroundColor: !props.updated ? 'white' : undefined }} + sx={{ backgroundColor: !props.updated ? 'white' : undefined, textTransform: 'none' }} /> diff --git a/client/components/Parts/Bars/Menu.tsx b/client/components/Parts/Bars/Menu.tsx index 7af7370db..9b3ae2175 100644 --- a/client/components/Parts/Bars/Menu.tsx +++ b/client/components/Parts/Bars/Menu.tsx @@ -25,7 +25,7 @@ export function MenuBar(props: React.PropsWithChildren) { return ( From d37a2a94ab4d78c54057f415681ac00443c624f8 Mon Sep 17 00:00:00 2001 From: gtzatchkova Date: Sat, 7 Sep 2024 19:25:09 +0200 Subject: [PATCH 4/9] Change red color to OKFN theme color --- client/components/Editors/Table/columns.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/Editors/Table/columns.tsx b/client/components/Editors/Table/columns.tsx index 21a90d0c2..7783e4351 100644 --- a/client/components/Editors/Table/columns.tsx +++ b/client/components/Editors/Table/columns.tsx @@ -1,6 +1,7 @@ import LightTooltip from '../../Parts/Tooltips/Light' import * as helpers from '../../../helpers' import * as types from '../../../types' +import { useTheme } from '@mui/material/styles' // TODO: remove colors hard-coding // TODO: use proper InovuaDatagrid types @@ -32,6 +33,8 @@ export function createColumns( }, } + const theme = useTheme() + const dataColumns = [] for (const field of schema.fields) { // TODO: fix this on ther server side -- schema should not have hidden fields @@ -50,7 +53,7 @@ export function createColumns( type: ['integer', 'number'].includes(field.type) ? 'number' : 'string', headerProps: field.name in errorIndex.label - ? { style: { color: 'white', background: 'red' } } + ? { style: { color: 'white', background: theme.palette.OKFNRed.main } } : field.name === selection?.columnName ? { style: { color: '#ed6c02' } } : undefined, From f9c85e8a6bd2e45198506b3faac17c07426c3797 Mon Sep 17 00:00:00 2001 From: gtzatchkova Date: Sat, 7 Sep 2024 19:25:31 +0200 Subject: [PATCH 5/9] Remove tooltips from action buttons --- client/components/Parts/Bars/Action.tsx | 107 ++++++++++-------------- 1 file changed, 45 insertions(+), 62 deletions(-) diff --git a/client/components/Parts/Bars/Action.tsx b/client/components/Parts/Bars/Action.tsx index 89e98f47b..2dba95c8f 100644 --- a/client/components/Parts/Bars/Action.tsx +++ b/client/components/Parts/Bars/Action.tsx @@ -7,7 +7,6 @@ import CheckIcon from '@mui/icons-material/Check' import HistoryIcon from '@mui/icons-material/History' import IconButton from '../../Parts/Buttons/Icon' import Columns from '../Grids/Columns' -import LightTooltip from '../Tooltips/Light' import { useKeyPress } from 'ahooks' import ElectricBoltIcon from '@mui/icons-material/ElectricBolt' @@ -38,8 +37,6 @@ export interface ButtonProps { export function SaveAsButton(props: ButtonProps) { const onClick = props.onClick || noop - let title = 'Save to another location [Ctrl+J]' - if (props.disabled) title = 'Saving to another location is not available' useKeyPress(['ctrl.j'], (event) => { event.preventDefault() if (!props.disabled) { @@ -47,27 +44,23 @@ export function SaveAsButton(props: ButtonProps) { } }) return ( - - - onClick()} - sx={{ backgroundColor: 'white', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { - borderColor: (theme) => theme.palette.OKFNCoolGray.main - } }} - /> - - + + onClick()} + sx={{ backgroundColor: 'white', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { + borderColor: (theme) => theme.palette.OKFNCoolGray.main + } }} + /> + ) } export function PublishButton(props: ButtonProps) { const onClick = props.onClick || noop - let title = 'Publish on the web [Ctrl+K]' - if (props.disabled) title = 'Publishing on the web is not available' useKeyPress(['ctrl.k'], (event) => { event.preventDefault() if (!props.disabled) { @@ -75,27 +68,23 @@ export function PublishButton(props: ButtonProps) { } }) return ( - - - onClick()} - sx={{ backgroundColor: 'white', textTransform: 'none', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { - borderColor: (theme) => theme.palette.OKFNCoolGray.main - } }} - /> - - + + onClick()} + sx={{ backgroundColor: 'white', textTransform: 'none', color: (theme) => theme.palette.OKFNCoolGray.main, borderColor: (theme) => theme.palette.OKFNCoolGray.main, '&:hover': { + borderColor: (theme) => theme.palette.OKFNCoolGray.main + } }} + /> + ) } export function RevertButton(props: ButtonProps) { const onClick = props.onClick || noop - let title = 'Revert the changes [Ctrl+Q]' - if (!props.updated) title = 'No changes to revert' useKeyPress(['ctrl.q'], (event) => { event.preventDefault() if (props.updated) { @@ -103,26 +92,22 @@ export function RevertButton(props: ButtonProps) { } }) return ( - - - onClick()} - sx={{ backgroundColor: !props.updated ? 'white' : undefined }} - /> - - + + onClick()} + sx={{ backgroundColor: !props.updated ? 'white' : undefined }} + /> + ) } export function SaveButton(props: ButtonProps) { const onClick = props.onClick || noop - let title = 'Save the changes [Ctrl+S]' - if (!props.updated) title = 'No changes to save' useKeyPress(['ctrl.s'], (event) => { event.preventDefault() if (props.updated) { @@ -130,17 +115,15 @@ export function SaveButton(props: ButtonProps) { } }) return ( - - - onClick()} - sx={{ backgroundColor: !props.updated ? 'white' : undefined, textTransform: 'none' }} - /> - - + + onClick()} + sx={{ backgroundColor: !props.updated ? 'white' : undefined, textTransform: 'none' }} + /> + ) } From 31d6fa4247f8c60275907d0d061b5a70773c7f0a Mon Sep 17 00:00:00 2001 From: gtzatchkova Date: Sat, 7 Sep 2024 20:40:08 +0200 Subject: [PATCH 6/9] Make panel fixed to bottom of the page (kind of) --- client/components/Controllers/Table/Panel.tsx | 8 +++++++- client/components/Controllers/Table/index.tsx | 2 +- client/components/Parts/Boxes/Scroll.tsx | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/components/Controllers/Table/Panel.tsx b/client/components/Controllers/Table/Panel.tsx index 376cc31e7..8d76f0a4a 100644 --- a/client/components/Controllers/Table/Panel.tsx +++ b/client/components/Controllers/Table/Panel.tsx @@ -13,7 +13,13 @@ export default function Panel() {