From 1da5faf59c3fac97da3ad81e51c49d3bfc255a99 Mon Sep 17 00:00:00 2001 From: Carter Date: Wed, 27 Nov 2024 11:37:04 -0600 Subject: [PATCH] user settings icon picker --- src/user/UserMenu.tsx | 2 +- src/user/UserSettings.tsx | 206 +++++++++++++++++++++++++++++++++++++- 2 files changed, 203 insertions(+), 5 deletions(-) diff --git a/src/user/UserMenu.tsx b/src/user/UserMenu.tsx index 7cbf2f9..5462021 100644 --- a/src/user/UserMenu.tsx +++ b/src/user/UserMenu.tsx @@ -1,4 +1,4 @@ -import { Avatar, Box, Button, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, PaletteColor, Theme, Typography, useTheme } from "@mui/material"; +import { Avatar, Box, Button, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, PaletteColor, Theme, useTheme } from "@mui/material"; import { useGlobalState } from "../providers/StateContainer"; import { getSecondaryColour, getSignatureAccentColour } from "../services/whiteLabel"; import { makeStyles } from "@mui/styles"; diff --git a/src/user/UserSettings.tsx b/src/user/UserSettings.tsx index 72c7fdb..09f3132 100644 --- a/src/user/UserSettings.tsx +++ b/src/user/UserSettings.tsx @@ -1,11 +1,18 @@ -import { Close } from "@mui/icons-material"; -import { AppBar, Button, IconButton, Theme, Toolbar, Typography } from "@mui/material"; +import { AccountBox, Close, ExpandLess, ExpandMore, Face, Share as ShareIcon } from "@mui/icons-material"; +import { AppBar, Box, Button, CircularProgress, Collapse, Divider, FormControl, FormLabel, Grid2, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, TextField, Theme, Toolbar, Tooltip, Typography } from "@mui/material"; import ResponsiveDialog from "common/ResponsiveDialog"; import UserAvatar from "./UserAvatar"; import { useGlobalState, useUserAPI } from "providers"; import { useState } from "react"; import { makeStyles } from "@mui/styles"; import { blue } from "@mui/material/colors"; +import ShareObject from "./ShareObject"; +import { pond } from "protobuf-ts/pond"; +import { User, userScope } from "models"; +import SearchSelect from "common/SearchSelect"; +import {Option as OptionType} from "common/SearchSelect"; +import moment from "moment"; +import { IconPicker } from "common/IconPicker"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -44,11 +51,16 @@ interface Props { export default function UserSettings(props: Props) { const { isOpen, closeDialogCallback } = props; - const [{ user }, dispatch] = useGlobalState() + const [globalState, dispatch] = useGlobalState() + const [sharing, setSharing] = useState(false) const userAPI = useUserAPI(); const classes = useStyles() const [isLoading, setIsLoading] = useState(false); + const [user, setUser] = useState(globalState.user); + const [profileExpanded, setProfileExpanded] = useState(false); + const [avatarExpanded, setAvatarExpanded] = useState(false); + const [avatarUrl, setAvatarUrl] = useState(""); const submit = () => { userAPI @@ -75,6 +87,192 @@ export default function UserSettings(props: Props) { closeDialogCallback(); }; + const loading = () => { + return ; + }; + + const changeName = (name: string) => { + let updatedUser = User.clone(user); + updatedUser.settings.name = name; + setUser(updatedUser); + }; + + const changeTimezone = (tz: string) => { + let updatedUser = User.clone(user); + updatedUser.settings.timezone = tz; + + setUser(updatedUser); + }; + + const generalSettings = () => { + const { name, email, phoneNumber, timezone } = user.settings; + + return ( + + setSharing(false)} + /> + + setSharing(true)}> + + + + + changeName(event.target.value.toString())} + /> + + + + + Phone Number + + {/* changePhoneNumber(value)} + value={phoneNumber} + onlyCountries={["ca", "us"]} + defaultCountry={"ca"} + countryCodeEditable={false} + /> */} + lol + + + + + + ({ label: tz, value: tz } as OptionType))} + changeSelection={(selected: OptionType | null) => + changeTimezone(selected ? selected.value : "") + } + /> + + + + ); + }; + + const avatarSettings = () => { + return ; + }; + + const settingsList = () => { + return ( + + setProfileExpanded(!profileExpanded)}> + + + + + {profileExpanded ? : } + + + + + + {isLoading ? loading() : generalSettings()} + + + + + + + + setAvatarExpanded(!avatarExpanded)}> + + + + + {avatarExpanded ? : } + + + + {isLoading ? loading() : avatarSettings()} + + + + {/* + + setNotificationsExpanded(!notificationsExpanded)}> + + + + + {notificationsExpanded ? : } + + + + + + {isLoading ? loading() : notificationsSettings()} + + + + + + + + setUnitsExpanded(!unitsExpanded)}> + + + + + {unitsExpanded ? : } + + + + + + {isLoading ? loading() : unitPreferences()} + + + + + + + + setMapsExpanded(!mapsExpanded)}> + + + + + {mapsExpanded ? : } + + + + + + {isLoading ? loading() : mapSettings()} + + + + */} + + ); + }; + return ( - {/* {settingsList()} */} + {settingsList()} ); } \ No newline at end of file