added map zoom back into to the user settings
This commit is contained in:
parent
70c88bc3df
commit
d8479b47dc
1 changed files with 32 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ import {
|
||||||
Textsms as TextIcon,
|
Textsms as TextIcon,
|
||||||
Contrast,
|
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, MenuItem, Radio, RadioGroup, TextField, Theme, ToggleButton, ToggleButtonGroup, 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, MenuItem, Radio, RadioGroup, Slider, 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, useSnackbar, useUserAPI } from "providers";
|
import { useGlobalState, useSnackbar, useUserAPI } from "providers";
|
||||||
|
|
@ -31,6 +31,7 @@ import UnitsIcon from "@mui/icons-material/Category";
|
||||||
import { setThemeType } from "theme";
|
import { setThemeType } from "theme";
|
||||||
import { IsAdaptiveAgriculture } from "services/whiteLabel";
|
import { IsAdaptiveAgriculture } from "services/whiteLabel";
|
||||||
import { setDistanceUnit, setGrainUnit, setPressureUnit, setTemperatureUnit } from "utils";
|
import { setDistanceUnit, setGrainUnit, setPressureUnit, setTemperatureUnit } from "utils";
|
||||||
|
import FieldsIcon from "products/AgIcons/FieldsIcon";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return ({
|
return ({
|
||||||
|
|
@ -82,7 +83,9 @@ 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 [unitsExpanded, setUnitsExpanded] = useState<boolean>(false);
|
const [unitsExpanded, setUnitsExpanded] = useState<boolean>(false);
|
||||||
|
const [mapsExpanded, setMapsExpanded] = useState<boolean>(false);
|
||||||
const [avatarUrl, setAvatarUrl] = useState<string>("");
|
const [avatarUrl, setAvatarUrl] = useState<string>("");
|
||||||
|
const [sliderVal, setSliderVal] = useState(globalState.user.settings.mapZoom);
|
||||||
// const [themeValue, setThemeValue] = useState<"light" | "dark" | "system">(themeMode.mode)
|
// const [themeValue, setThemeValue] = useState<"light" | "dark" | "system">(themeMode.mode)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -151,6 +154,30 @@ export default function UserSettings(props: Props) {
|
||||||
setUser(updatedUser);
|
setUser(updatedUser);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeDefaultZoom = (value: number) => {
|
||||||
|
setSliderVal(value);
|
||||||
|
let updatedUser = User.clone(user);
|
||||||
|
updatedUser.settings.mapZoom = value;
|
||||||
|
setUser(updatedUser)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapSettings = () => {
|
||||||
|
return (
|
||||||
|
<Box display="flex">
|
||||||
|
<Typography>Map Zoom Level</Typography>
|
||||||
|
<Slider
|
||||||
|
valueLabelDisplay="auto"
|
||||||
|
value={sliderVal}
|
||||||
|
min={1}
|
||||||
|
max={16}
|
||||||
|
onChange={(_, val) => {
|
||||||
|
changeDefaultZoom(val as number);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const generalSettings = () => {
|
const generalSettings = () => {
|
||||||
const { name, email, phoneNumber, timezone } = user.settings;
|
const { name, email, phoneNumber, timezone } = user.settings;
|
||||||
|
|
||||||
|
|
@ -631,15 +658,15 @@ export default function UserSettings(props: Props) {
|
||||||
</List>
|
</List>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|
||||||
{/* <Divider />
|
<Divider />
|
||||||
|
|
||||||
<ListItem button onClick={() => setMapsExpanded(!mapsExpanded)}>
|
<ListItemButton onClick={() => setMapsExpanded(!mapsExpanded)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<FieldsIcon />
|
<FieldsIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={"Map Settings"} />
|
<ListItemText primary={"Map Settings"} />
|
||||||
{mapsExpanded ? <ExpandLess /> : <ExpandMore />}
|
{mapsExpanded ? <ExpandLess /> : <ExpandMore />}
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
<Collapse in={mapsExpanded} timeout="auto" unmountOnExit>
|
<Collapse in={mapsExpanded} timeout="auto" unmountOnExit>
|
||||||
<List component="div">
|
<List component="div">
|
||||||
<ListItem>
|
<ListItem>
|
||||||
|
|
@ -648,7 +675,7 @@ export default function UserSettings(props: Props) {
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
</Collapse> */}
|
</Collapse>
|
||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue