theme change is now in user settings
This commit is contained in:
parent
b208cd68f4
commit
df0f7eb6aa
3 changed files with 50 additions and 8 deletions
|
|
@ -52,10 +52,10 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
},
|
},
|
||||||
rowHover: {
|
rowHover: {
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
// "&:hover": {
|
"&:hover": {
|
||||||
// backgroundColor: !isMobile && "rgba(150, 150, 150, 0.15)",
|
backgroundColor: "rgba(150, 150, 150, 0.15)",
|
||||||
// }
|
}
|
||||||
}
|
},
|
||||||
})},
|
})},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -314,7 +314,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
</Box>
|
</Box>
|
||||||
{rows.map((row, index) => {
|
{rows.map((row, index) => {
|
||||||
return (
|
return (
|
||||||
<Card className={classNames(classes.card, onRowClick&&classes.rowHover)} key={"mobile-card-"+index} onClick={() => onRowClick&&onRowClick(row)}>
|
<Card className={classNames(classes.card)} key={"mobile-card-"+index} onClick={() => onRowClick&&onRowClick(row)}>
|
||||||
{renderMobileRow(row)}
|
{renderMobileRow(row)}
|
||||||
{renderGutter &&
|
{renderGutter &&
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -226,12 +226,12 @@ export default function UserMenu() {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="User Settings" />
|
<ListItemText primary="User Settings" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={toggleMode} aria-label="Toggle Theme" dense>
|
{/* <MenuItem onClick={toggleMode} aria-label="Toggle Theme" dense>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<ThemeIcon />
|
<ThemeIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="Toggle Theme" />
|
<ListItemText primary="Toggle Theme" />
|
||||||
</MenuItem>
|
</MenuItem> */}
|
||||||
{hasTeams && (
|
{hasTeams && (
|
||||||
<MenuItem onClick={openTeamDialog} aria-label="Open Team Menu" dense>
|
<MenuItem onClick={openTeamDialog} aria-label="Open Team Menu" dense>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ import {
|
||||||
Notifications as NotificationsIcon,
|
Notifications as NotificationsIcon,
|
||||||
Email as EmailIcon,
|
Email as EmailIcon,
|
||||||
Textsms as TextIcon,
|
Textsms as TextIcon,
|
||||||
|
Contrast,
|
||||||
} from "@mui/icons-material";
|
} from "@mui/icons-material";
|
||||||
import { AppBar, Box, Button, Checkbox, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Grid2, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Radio, RadioGroup, TextField, Theme, Toolbar, Tooltip, Typography } from "@mui/material";
|
import { AppBar, Box, Button, Checkbox, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Grid2, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Radio, RadioGroup, TextField, Theme, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography } from "@mui/material";
|
||||||
import ResponsiveDialog from "common/ResponsiveDialog";
|
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||||
import UserAvatar from "./UserAvatar";
|
import UserAvatar from "./UserAvatar";
|
||||||
import { useGlobalState, useUserAPI } from "providers";
|
import { useGlobalState, useUserAPI } from "providers";
|
||||||
|
|
@ -24,6 +25,8 @@ import {Option as OptionType} from "common/SearchSelect";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { IconPicker } from "common/IconPicker";
|
import { IconPicker } from "common/IconPicker";
|
||||||
import { MuiTelInput } from "mui-tel-input";
|
import { MuiTelInput } from "mui-tel-input";
|
||||||
|
import { useThemeMode } from "theme/AppThemeProvider";
|
||||||
|
import ContractsIcon from "products/CommonIcons/contractIcon";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return ({
|
return ({
|
||||||
|
|
@ -61,6 +64,7 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function UserSettings(props: Props) {
|
export default function UserSettings(props: Props) {
|
||||||
|
const themeMode = useThemeMode()
|
||||||
const { isOpen, closeDialogCallback } = props;
|
const { isOpen, closeDialogCallback } = props;
|
||||||
const [globalState, dispatch] = useGlobalState()
|
const [globalState, dispatch] = useGlobalState()
|
||||||
const [sharing, setSharing] = useState(false)
|
const [sharing, setSharing] = useState(false)
|
||||||
|
|
@ -73,6 +77,7 @@ export default function UserSettings(props: Props) {
|
||||||
const [avatarExpanded, setAvatarExpanded] = useState<boolean>(false);
|
const [avatarExpanded, setAvatarExpanded] = useState<boolean>(false);
|
||||||
const [notificationsExpanded, setNotificationsExpanded] = useState<boolean>(false);
|
const [notificationsExpanded, setNotificationsExpanded] = useState<boolean>(false);
|
||||||
const [avatarUrl, setAvatarUrl] = useState<string>("");
|
const [avatarUrl, setAvatarUrl] = useState<string>("");
|
||||||
|
const [themeValue, setThemeValue] = useState<"light" | "dark" | "system">(themeMode.mode)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function changeIcon(icon: string | undefined) {
|
function changeIcon(icon: string | undefined) {
|
||||||
|
|
@ -350,9 +355,46 @@ export default function UserSettings(props: Props) {
|
||||||
return <IconPicker url={user.settings.avatar} setUrl={setAvatarUrl} id={user.settings.id} />;
|
return <IconPicker url={user.settings.avatar} setUrl={setAvatarUrl} id={user.settings.id} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChange = (event: React.MouseEvent<HTMLElement>, nextView: "light" | "dark" | "system") => {
|
||||||
|
event.preventDefault()
|
||||||
|
themeMode.setMode(nextView)
|
||||||
|
};
|
||||||
|
|
||||||
|
const themeToggle = () => {
|
||||||
|
return (
|
||||||
|
<ToggleButtonGroup
|
||||||
|
value={themeMode.mode}
|
||||||
|
exclusive
|
||||||
|
onChange={handleChange}
|
||||||
|
size="small"
|
||||||
|
sx={{margin:-1}}
|
||||||
|
>
|
||||||
|
<ToggleButton value="light">
|
||||||
|
light
|
||||||
|
</ToggleButton>
|
||||||
|
<ToggleButton value="system">
|
||||||
|
system
|
||||||
|
</ToggleButton>
|
||||||
|
<ToggleButton value="dark">
|
||||||
|
dark
|
||||||
|
</ToggleButton>
|
||||||
|
</ToggleButtonGroup>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const settingsList = () => {
|
const settingsList = () => {
|
||||||
return (
|
return (
|
||||||
<List disablePadding>
|
<List disablePadding>
|
||||||
|
<ListItem >
|
||||||
|
<ListItemIcon>
|
||||||
|
<Contrast />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={"Theme"} />
|
||||||
|
{themeToggle()}
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<Divider />
|
||||||
|
|
||||||
<ListItemButton onClick={() => setProfileExpanded(!profileExpanded)}>
|
<ListItemButton onClick={() => setProfileExpanded(!profileExpanded)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<AccountBox />
|
<AccountBox />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue