Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import useAuth from 'src/hooks/useAuth';
import { Alert, CssBaseline } from '@mui/material';
import ThemeProvider from './theme/ThemeProvider';
import AppInit from './components/AppInit';
import ThemeSettings from './components/ThemeSettings';
import { CustomSnackBarProvider } from './contexts/CustomSnackBarContext';
import ReactGA from 'react-ga4';
import {
Expand Down Expand Up @@ -201,6 +202,7 @@ function App() {
open={shouldShowPrompt}
onClose={dismissPrompt}
/>
<ThemeSettings />
</CompanySettingsProvider>
</CustomSnackBarProvider>
</SnackbarProvider>
Expand Down
229 changes: 105 additions & 124 deletions frontend/src/components/ThemeSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { FC, useContext, useRef, useState, MouseEvent } from 'react';
import { FC, useContext, useRef, useState } from 'react';
import {
Popover,
styled,
Button,
MenuItem,
Menu,
Typography,
Stack,
Divider,
Expand All @@ -16,16 +14,14 @@ import CheckTwoToneIcon from '@mui/icons-material/CheckTwoTone';
import SettingsTwoToneIcon from '@mui/icons-material/SettingsTwoTone';
import Fab from '@mui/material/Fab';
import { useTranslation } from 'react-i18next';
import UnfoldMoreTwoToneIcon from '@mui/icons-material/UnfoldMoreTwoTone';
import { NavLink } from 'react-router-dom';

const ThemeSettingsButton = styled(Box)(
({ theme }) => `
position: fixed;
z-index: 9999;
right: ${theme.spacing(4)};
bottom: ${theme.spacing(4)};

&::before {
width: 30px;
height: 30px;
Expand Down Expand Up @@ -86,7 +82,7 @@ const ColorSchemeWrapper = styled(Box)(

border-radius: ${theme.general.borderRadiusXl};
height: 28px;

&.colorSchemeWrapper {
display: flex;
align-items: stretch;
Expand All @@ -113,7 +109,7 @@ const ColorSchemeWrapper = styled(Box)(
.primary {
background: #5569ff;
}

.secondary {
background: #f2f5f9;
}
Expand All @@ -123,21 +119,51 @@ const ColorSchemeWrapper = styled(Box)(
.primary {
background: #2442AF;
}

.secondary {
background: #F8F8F8;
}
}

&.purpleFlow {
.primary {
background: #9b52e1;
}

.secondary {
background: #00b795;
}
}

&.theme1 {
.primary {
background: #0EA5E9;
}

.secondary {
background: #06B6D4;
}
}

&.theme2 {
.primary {
background: #EC4899;
}

.secondary {
background: #8B5CF6;
}
}

&.theme3 {
.primary {
background: #06B6D4;
}

.secondary {
background: #6366F1;
}
}
`
);

Expand Down Expand Up @@ -189,15 +215,6 @@ const ThemeSettings: FC = () => {
setThemeName(theme);
};

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const openMenu = (event: MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const closeMenu = () => {
setAnchorEl(null);
};

return (
<>
<ThemeSettingsButton>
Expand All @@ -220,110 +237,6 @@ const ThemeSettings: FC = () => {
horizontal: 'right'
}}
>
<Box p={2}>
<Typography
sx={{
mb: 2,
textAlign: 'center',
fontWeight: 'bold',
textTransform: 'uppercase'
}}
variant="body1"
>
Layout Blueprints
</Typography>
<Button
fullWidth
size="large"
variant="outlined"
endIcon={<UnfoldMoreTwoToneIcon />}
color="primary"
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
onClick={openMenu}
>
Choose layout
</Button>
<Menu
disableScrollLock
anchorEl={anchorEl}
open={open}
onClose={closeMenu}
anchorOrigin={{
vertical: 'center',
horizontal: 'center'
}}
transformOrigin={{
vertical: 'center',
horizontal: 'center'
}}
>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/extended-sidebar/dashboards"
>
Extended Sidebar
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/accent-header/dashboards"
>
Accent Header
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/accent-sidebar/dashboards"
>
Accent Sidebar
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/boxed-sidebar/dashboards"
>
Boxed Sidebar
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/collapsed-sidebar/dashboards"
>
Collapsed Sidebar
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/bottom-navigation/dashboards"
>
Bottom Navigation
</MenuItem>
<MenuItem
sx={{
fontWeight: 'bold'
}}
component={NavLink}
to="/top-navigation/dashboards"
>
Top Navigation
</MenuItem>
</Menu>
</Box>
<Divider />
<ThemeToggleWrapper>
<Typography
sx={{
Expand Down Expand Up @@ -392,6 +305,74 @@ const ThemeSettings: FC = () => {
</ColorSchemeWrapper>
</ButtonWrapper>
</Tooltip>
<Tooltip placement="left" title="SkyView" arrow>
<ButtonWrapper
className={theme === 'SkyView' ? 'active' : ''}
onClick={() => {
changeTheme('SkyView');
}}
>
{theme === 'SkyView' && (
<CheckSelected>
<CheckTwoToneIcon />
</CheckSelected>
)}
<ColorSchemeWrapper className="colorSchemeWrapper theme1">
<Box className="primary" />
<Box className="secondary" />
</ColorSchemeWrapper>
</ButtonWrapper>
</Tooltip>
</Stack>
<Divider sx={{ my: 2 }} />
<Typography
sx={{
mb: 3,
textAlign: 'center',
fontWeight: 'bold',
textTransform: 'uppercase'
}}
variant="body1"
>
Dark color schemes
</Typography>
<Stack alignItems="center" spacing={2}>
<Tooltip placement="left" title="PureDarkTheme" arrow>
<ButtonWrapper
className={theme === 'PureDarkTheme' ? 'active' : ''}
onClick={() => {
changeTheme('PureDarkTheme');
}}
>
{theme === 'PureDarkTheme' && (
<CheckSelected>
<CheckTwoToneIcon />
</CheckSelected>
)}
<ColorSchemeWrapper className="colorSchemeWrapper theme2">
<Box className="primary" />
<Box className="secondary" />
</ColorSchemeWrapper>
</ButtonWrapper>
</Tooltip>
<Tooltip placement="left" title="Elegant Night" arrow>
<ButtonWrapper
className={theme === 'ElegantNightTheme' ? 'active' : ''}
onClick={() => {
changeTheme('ElegantNightTheme');
}}
>
{theme === 'ElegantNightTheme' && (
<CheckSelected>
<CheckTwoToneIcon />
</CheckSelected>
)}
<ColorSchemeWrapper className="colorSchemeWrapper theme3">
<Box className="primary" />
<Box className="secondary" />
</ColorSchemeWrapper>
</ButtonWrapper>
</Tooltip>
</Stack>
</ThemeToggleWrapper>
</Popover>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/content/own/Settings/Features/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function FeaturesSettings() {
<Card
key={feature.id}
sx={{
backgroundColor: 'white'
backgroundColor: 'background.paper'
}}
>
<CardContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ function ApiKeys() {
justifyContent="space-between"
p={2}
sx={{
backgroundColor: 'grey.100',
backgroundColor: 'action.hover',
borderRadius: 1,
border: '1px solid',
borderColor: 'grey.300'
borderColor: 'divider'
}}
>
<Typography
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/content/own/WorkOrders/Details/CommentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const CommentWrapper = styled(Box)<{ highlighted?: boolean }>(
({ theme, highlighted }) => `
padding: ${theme.spacing(2)};
border-radius: ${theme.general.borderRadius};
background: ${theme.colors.alpha.white[100]};
background: ${theme.palette.background.paper};
border: ${
highlighted
? `2px solid ${theme.palette.primary.main}`
: `1px solid ${theme.colors.alpha.black[10]}`
: `1px solid ${theme.palette.divider}`
};
transition: all 0.2s ease-in-out;
${highlighted ? `box-shadow: 0 0 8px ${theme.palette.primary.main}40;` : ''}
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/content/own/components/CustomDatagrid2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ interface CustomDatagrid2Props<TData extends RowData> {
getRowId?: (row: TData) => string;
}

const PINNED_BG = '#F2F5F9';

function CustomDatagrid2<TData extends RowData>({
columns,
data,
Expand Down Expand Up @@ -523,7 +521,7 @@ function CustomDatagrid2<TData extends RowData>({
fontWeight: 'bold',
textTransform: 'uppercase',
borderBottom: `1px solid ${theme.palette.divider}`,
backgroundColor: '#E8EAEE',
backgroundColor: theme.palette.background.paper,
position: 'sticky',
top: 0,
zIndex: 3
Expand Down Expand Up @@ -558,12 +556,12 @@ function CustomDatagrid2<TData extends RowData>({
whiteSpace: 'nowrap',
position: isPinned ? 'sticky' : 'relative',
left: isPinned ? stickyLeft : undefined,
backgroundColor: PINNED_BG,
backgroundColor: isPinned ? alpha(theme.palette.primary.main, 0.06) : theme.palette.background.paper,
userSelect: isResizing ? 'none' : 'auto',
cursor: canDrag ? 'pointer' : 'default',
borderRight: isPinned
? `2px solid ${theme.palette.divider}`
: `1px solid #F2F5F9`,
: `1px solid ${theme.palette.divider}`,
boxShadow: isPinned
? `2px 0 4px ${alpha(
theme.palette.common.black,
Expand Down Expand Up @@ -762,7 +760,7 @@ function CustomDatagrid2<TData extends RowData>({
textOverflow: 'ellipsis',
position: isPinned ? 'sticky' : undefined,
left: isPinned ? stickyLeft : undefined,
backgroundColor: isPinned ? PINNED_BG : undefined,
backgroundColor: isPinned ? alpha(theme.palette.primary.main, 0.06) : undefined,
borderRight: isPinned
? `2px solid ${theme.palette.divider}`
: undefined,
Expand Down
Loading