✨ Add dark mode to new-frontend and conditional sidebar items (#600)
This commit is contained in:
@@ -20,7 +20,7 @@ const ActionsMenu: React.FC<ActionsMenuProps> = ({ type, id }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuButton as={Button} bg="white" rightIcon={<BsThreeDotsVertical />} variant="unstyled">
|
<MenuButton as={Button} rightIcon={<BsThreeDotsVertical />} variant="unstyled">
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuList>
|
<MenuList>
|
||||||
<MenuItem onClick={editUserModal.onOpen} icon={<FiEdit fontSize="16px" />}>Edit {type}</MenuItem>
|
<MenuItem onClick={editUserModal.onOpen} icon={<FiEdit fontSize="16px" />}>Edit {type}</MenuItem>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Box, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerOverlay, Flex, IconButton, Image, useDisclosure, Text } from '@chakra-ui/react';
|
import { Box, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerOverlay, Flex, IconButton, Image, useDisclosure, Text, useColorModeValue } from '@chakra-ui/react';
|
||||||
import { FiMenu } from 'react-icons/fi';
|
import { FiMenu } from 'react-icons/fi';
|
||||||
|
|
||||||
import Logo from "../assets/images/fastapi-logo.svg";
|
import Logo from "../assets/images/fastapi-logo.svg";
|
||||||
@@ -9,6 +9,10 @@ import { useUserStore } from '../store/user-store';
|
|||||||
|
|
||||||
|
|
||||||
const Sidebar: React.FC = () => {
|
const Sidebar: React.FC = () => {
|
||||||
|
const bgColor = useColorModeValue("white", "#1a202c");
|
||||||
|
const textColor = useColorModeValue("gray", "white");
|
||||||
|
const secBgColor = useColorModeValue("ui.secondary", "#252d3d");
|
||||||
|
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
const { user } = useUserStore();
|
const { user } = useUserStore();
|
||||||
|
|
||||||
@@ -18,7 +22,7 @@ const Sidebar: React.FC = () => {
|
|||||||
<IconButton onClick={onOpen} display={{ base: 'flex', md: 'none' }} aria-label="Open Menu" position="absolute" fontSize='20px' m={4} icon={<FiMenu />} />
|
<IconButton onClick={onOpen} display={{ base: 'flex', md: 'none' }} aria-label="Open Menu" position="absolute" fontSize='20px' m={4} icon={<FiMenu />} />
|
||||||
<Drawer isOpen={isOpen} placement="left" onClose={onClose}>
|
<Drawer isOpen={isOpen} placement="left" onClose={onClose}>
|
||||||
<DrawerOverlay />
|
<DrawerOverlay />
|
||||||
<DrawerContent bg="ui.secondary" maxW="250px">
|
<DrawerContent maxW="250px">
|
||||||
<DrawerCloseButton />
|
<DrawerCloseButton />
|
||||||
<DrawerBody py={8}>
|
<DrawerBody py={8}>
|
||||||
<Flex flexDir="column" justify="space-between">
|
<Flex flexDir="column" justify="space-between">
|
||||||
@@ -28,7 +32,7 @@ const Sidebar: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
{
|
{
|
||||||
user?.email &&
|
user?.email &&
|
||||||
<Text color='gray' noOfLines={2} fontSize="sm" p={2}>Logged in as: {user.email}</Text>
|
<Text color={textColor} noOfLines={2} fontSize="sm" p={2}>Logged in as: {user.email}</Text>
|
||||||
}
|
}
|
||||||
</Flex>
|
</Flex>
|
||||||
</DrawerBody>
|
</DrawerBody>
|
||||||
@@ -36,15 +40,15 @@ const Sidebar: React.FC = () => {
|
|||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
{/* Desktop */}
|
{/* Desktop */}
|
||||||
<Box bg="white" p={3} h="100vh" position="sticky" top="0" display={{ base: 'none', md: 'flex' }}>
|
<Box bg={bgColor} p={3} h="100vh" position="sticky" top="0" display={{ base: 'none', md: 'flex' }}>
|
||||||
<Flex flexDir="column" justify="space-between" bg="ui.secondary" p={4} borderRadius={12}>
|
<Flex flexDir="column" justify="space-between" bg={secBgColor} p={4} borderRadius={12}>
|
||||||
<Box>
|
<Box>
|
||||||
<Image src={Logo} alt="Logo" w="180px" maxW="2xs" p={6} />
|
<Image src={Logo} alt="Logo" w="180px" maxW="2xs" p={6} />
|
||||||
<SidebarItems />
|
<SidebarItems />
|
||||||
</Box>
|
</Box>
|
||||||
{
|
{
|
||||||
user?.email &&
|
user?.email &&
|
||||||
<Text color='gray' noOfLines={2} fontSize="sm" p={2} maxW="180px">Logged in as: {user.email}</Text>
|
<Text color={textColor} noOfLines={2} fontSize="sm" p={2} maxW="180px">Logged in as: {user.email}</Text>
|
||||||
}
|
}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Box, Flex, Icon, Text } from '@chakra-ui/react';
|
import { Box, Flex, Icon, Text, useColorModeValue } from '@chakra-ui/react';
|
||||||
import { FiBriefcase, FiHome, FiSettings, FiUsers } from 'react-icons/fi';
|
import { FiBriefcase, FiHome, FiSettings, FiUsers } from 'react-icons/fi';
|
||||||
import { Link, useLocation } from 'react-router-dom';
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { useUserStore } from '../store/user-store';
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{ icon: FiHome, title: 'Dashboard', path: "/" },
|
{ icon: FiHome, title: 'Dashboard', path: "/" },
|
||||||
{ icon: FiBriefcase, title: 'Items', path: "/items" },
|
{ icon: FiBriefcase, title: 'Items', path: "/items" },
|
||||||
{ icon: FiUsers, title: 'Admin', path: "/admin" },
|
|
||||||
{ icon: FiSettings, title: 'User Settings', path: "/settings" },
|
{ icon: FiSettings, title: 'User Settings', path: "/settings" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -16,9 +17,14 @@ interface SidebarItemsProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
|
const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
|
||||||
|
const textColor = useColorModeValue("ui.main", "#E2E8F0");
|
||||||
|
const bgActive = useColorModeValue("#E2E8F0", "#4A5568");
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const { user } = useUserStore();
|
||||||
|
|
||||||
const listItems = items.map((item) => (
|
const finalItems = user?.is_superuser ? [...items, { icon: FiUsers, title: 'Admin', path: "/admin" }] : items;
|
||||||
|
|
||||||
|
const listItems = finalItems.map((item) => (
|
||||||
<Flex
|
<Flex
|
||||||
as={Link}
|
as={Link}
|
||||||
to={item.path}
|
to={item.path}
|
||||||
@@ -26,10 +32,10 @@ const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
|
|||||||
p={2}
|
p={2}
|
||||||
key={item.title}
|
key={item.title}
|
||||||
style={location.pathname === item.path ? {
|
style={location.pathname === item.path ? {
|
||||||
background: "#E2E8F0",
|
background: bgActive,
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
} : {}}
|
} : {}}
|
||||||
color="ui.main"
|
color={textColor}
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
>
|
>
|
||||||
<Icon as={item.icon} alignSelf="center" />
|
<Icon as={item.icon} alignSelf="center" />
|
||||||
|
@@ -32,7 +32,7 @@ const UserMenu: React.FC = () => {
|
|||||||
<MenuItem icon={<FiUser fontSize="18px" />} as={Link} to="settings">
|
<MenuItem icon={<FiUser fontSize="18px" />} as={Link} to="settings">
|
||||||
My profile
|
My profile
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem icon={<FiLogOut fontSize="18px" />} onClick={handleLogout} color="ui.danger">
|
<MenuItem icon={<FiLogOut fontSize="18px" />} onClick={handleLogout} color="ui.danger" fontWeight="bold">
|
||||||
Log out
|
Log out
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuList>
|
</MenuList>
|
||||||
|
@@ -55,7 +55,7 @@ const Delete: React.FC<DeleteProps> = ({ type, id, isOpen, onClose }) => {
|
|||||||
>
|
>
|
||||||
<AlertDialogOverlay>
|
<AlertDialogOverlay>
|
||||||
<AlertDialogContent as="form" onSubmit={handleSubmit(onSubmit)}>
|
<AlertDialogContent as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<AlertDialogHeader fontSize='lg' fontWeight='bold'>
|
<AlertDialogHeader>
|
||||||
Delete {type}
|
Delete {type}
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
|
|
||||||
|
72
src/new-frontend/src/modals/DeleteConfirmation.tsx
Normal file
72
src/new-frontend/src/modals/DeleteConfirmation.tsx
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
|
import { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, Button, useToast } from '@chakra-ui/react';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
|
interface DeleteProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DeleteConfirmation: React.FC<DeleteProps> = ({ isOpen, onClose }) => {
|
||||||
|
const toast = useToast();
|
||||||
|
const cancelRef = React.useRef<HTMLButtonElement | null>(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const { handleSubmit } = useForm();
|
||||||
|
|
||||||
|
const onSubmit = async () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
// TODO: Delete user account when API is ready
|
||||||
|
onClose();
|
||||||
|
} catch (err) {
|
||||||
|
toast({
|
||||||
|
title: "An error occurred.",
|
||||||
|
description: `An error occurred while deleting your account.`,
|
||||||
|
status: "error",
|
||||||
|
isClosable: true,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AlertDialog
|
||||||
|
isOpen={isOpen}
|
||||||
|
onClose={onClose}
|
||||||
|
leastDestructiveRef={cancelRef}
|
||||||
|
size={{ base: "sm", md: "md" }}
|
||||||
|
isCentered
|
||||||
|
>
|
||||||
|
<AlertDialogOverlay>
|
||||||
|
<AlertDialogContent as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<AlertDialogHeader>
|
||||||
|
Confirmation Required
|
||||||
|
</AlertDialogHeader>
|
||||||
|
|
||||||
|
<AlertDialogBody>
|
||||||
|
All your account data will be <b>permanently deleted.</b> If you're sure, please click <b>'Confirm'</b> to proceed.
|
||||||
|
</AlertDialogBody>
|
||||||
|
|
||||||
|
<AlertDialogFooter gap={3}>
|
||||||
|
<Button bg="ui.danger" color="white" _hover={{ opacity: 0.8 }} type="submit" isLoading={isLoading}>
|
||||||
|
Confirm
|
||||||
|
</Button>
|
||||||
|
<Button ref={cancelRef} onClick={onClose} isDisabled={isLoading}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</AlertDialogFooter>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialogOverlay>
|
||||||
|
</AlertDialog >
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DeleteConfirmation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -42,7 +42,7 @@ const Admin: React.FC = () => {
|
|||||||
) : (
|
) : (
|
||||||
users &&
|
users &&
|
||||||
<Container maxW="full">
|
<Container maxW="full">
|
||||||
<Heading size="lg" color="gray.700" textAlign={{ base: "center", md: "left" }} pt={12}>
|
<Heading size="lg" textAlign={{ base: "center", md: "left" }} pt={12}>
|
||||||
User Management
|
User Management
|
||||||
</Heading>
|
</Heading>
|
||||||
<Navbar type={"User"} />
|
<Navbar type={"User"} />
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Box, Text } from '@chakra-ui/react';
|
import { Container, Text } from '@chakra-ui/react';
|
||||||
|
|
||||||
import { useUserStore } from '../store/user-store';
|
import { useUserStore } from '../store/user-store';
|
||||||
|
|
||||||
@@ -10,10 +10,10 @@ const Dashboard: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box width="100%" p={8}>
|
<Container maxW="full" pt={12}>
|
||||||
<Text fontSize="2xl">Hi, {user?.full_name || user?.email} 👋🏼</Text>
|
<Text fontSize="2xl">Hi, {user?.full_name || user?.email} 👋🏼</Text>
|
||||||
<Text>Welcome back, nice to see you again!</Text>
|
<Text>Welcome back, nice to see you again!</Text>
|
||||||
</Box>
|
</Container>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@@ -44,7 +44,7 @@ const Items: React.FC = () => {
|
|||||||
) : (
|
) : (
|
||||||
items &&
|
items &&
|
||||||
<Container maxW="full">
|
<Container maxW="full">
|
||||||
<Heading size="lg" color="gray.700" textAlign={{ base: "center", md: "left" }} pt={12}>
|
<Heading size="lg" textAlign={{ base: "center", md: "left" }} pt={12}>
|
||||||
Items Management
|
Items Management
|
||||||
</Heading>
|
</Heading>
|
||||||
<Navbar type={"Item"} />
|
<Navbar type={"Item"} />
|
||||||
|
@@ -7,7 +7,7 @@ import { Flex, useToast } from '@chakra-ui/react';
|
|||||||
import { useUserStore } from '../store/user-store';
|
import { useUserStore } from '../store/user-store';
|
||||||
import UserMenu from '../components/UserMenu';
|
import UserMenu from '../components/UserMenu';
|
||||||
|
|
||||||
const Root: React.FC = () => {
|
const Layout: React.FC = () => {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const { getUser } = useUserStore();
|
const { getUser } = useUserStore();
|
||||||
|
|
||||||
@@ -39,4 +39,4 @@ const Root: React.FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Root;
|
export default Layout;
|
@@ -42,7 +42,7 @@ const RecoverPassword: React.FC = () => {
|
|||||||
Password Recovery
|
Password Recovery
|
||||||
</Heading>
|
</Heading>
|
||||||
<FormControl id="username">
|
<FormControl id="username">
|
||||||
<Text align="center" color="gray.600">
|
<Text align="center">
|
||||||
A password recovery email will be sent to the registered account.
|
A password recovery email will be sent to the registered account.
|
||||||
</Text>
|
</Text>
|
||||||
<Input
|
<Input
|
||||||
|
@@ -14,7 +14,7 @@ const UserSettings: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Container maxW="full">
|
<Container maxW="full">
|
||||||
<Heading size="lg" color="gray.700" textAlign={{ base: "center", md: "left" }} py={12}>
|
<Heading size="lg" textAlign={{ base: "center", md: "left" }} py={12}>
|
||||||
User Settings
|
User Settings
|
||||||
</Heading>
|
</Heading>
|
||||||
<Tabs variant='enclosed' >
|
<Tabs variant='enclosed' >
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Button, Container, Heading, Radio, RadioGroup, Stack } from '@chakra-ui/react';
|
import { Container, Heading, Radio, RadioGroup, Stack, useColorMode } from '@chakra-ui/react';
|
||||||
|
|
||||||
const Appearance: React.FC = () => {
|
const Appearance: React.FC = () => {
|
||||||
const [value, setValue] = React.useState('system');
|
const { colorMode, toggleColorMode } = useColorMode();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -11,21 +11,17 @@ const Appearance: React.FC = () => {
|
|||||||
<Heading size="sm" py={4}>
|
<Heading size="sm" py={4}>
|
||||||
Appearance
|
Appearance
|
||||||
</Heading>
|
</Heading>
|
||||||
<RadioGroup onChange={setValue} value={value}>
|
<RadioGroup onChange={toggleColorMode} value={colorMode}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Radio value="system" colorScheme="teal" defaultChecked>
|
|
||||||
Use system settings (default)
|
|
||||||
</Radio>
|
|
||||||
<Radio value="light" colorScheme="teal">
|
<Radio value="light" colorScheme="teal">
|
||||||
Light
|
Light <i>(default)</i>
|
||||||
</Radio>
|
</Radio>
|
||||||
<Radio value="dark" colorScheme="teal">
|
<Radio value="dark" colorScheme="teal">
|
||||||
Dark
|
Dark
|
||||||
</Radio>
|
</Radio>
|
||||||
</Stack>
|
</Stack>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
<Button bg="ui.main" color="white" _hover={{ opacity: 0.8 }} mt={4}>Save</Button>
|
</Container>
|
||||||
</ Container>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Box, Button, Container, FormControl, FormLabel, Heading, Input } from '@chakra-ui/react';
|
import { Box, Button, Container, FormControl, FormLabel, Heading, Input, useColorModeValue } from '@chakra-ui/react';
|
||||||
|
|
||||||
const ChangePassword: React.FC = () => {
|
const ChangePassword: React.FC = () => {
|
||||||
|
const color = useColorModeValue("gray.700", "white");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -12,15 +13,15 @@ const ChangePassword: React.FC = () => {
|
|||||||
</Heading>
|
</Heading>
|
||||||
<Box as="form" display="flex" flexDirection="column" alignItems="start">
|
<Box as="form" display="flex" flexDirection="column" alignItems="start">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel color="gray.700">Old password</FormLabel>
|
<FormLabel color={color}>Old password</FormLabel>
|
||||||
<Input placeholder='Password' type="password" />
|
<Input placeholder='Password' type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={4}>
|
<FormControl mt={4}>
|
||||||
<FormLabel color="gray.700">New password</FormLabel>
|
<FormLabel color={color}>New password</FormLabel>
|
||||||
<Input placeholder='Password' type="password" />
|
<Input placeholder='Password' type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={4}>
|
<FormControl mt={4}>
|
||||||
<FormLabel color="gray.700">Confirm new password</FormLabel>
|
<FormLabel color={color}>Confirm new password</FormLabel>
|
||||||
<Input placeholder='Password' type="password" />
|
<Input placeholder='Password' type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Button bg="ui.main" color="white" _hover={{ opacity: 0.8 }} mt={4} type="submit">
|
<Button bg="ui.main" color="white" _hover={{ opacity: 0.8 }} mt={4} type="submit">
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Button, Container, Heading, Text } from '@chakra-ui/react';
|
import { Button, Container, Heading, Text, useDisclosure } from '@chakra-ui/react';
|
||||||
|
|
||||||
|
import DeleteConfirmation from '../modals/DeleteConfirmation';
|
||||||
|
|
||||||
const DeleteAccount: React.FC = () => {
|
const DeleteAccount: React.FC = () => {
|
||||||
|
const confirmationModal = useDisclosure();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -13,9 +16,10 @@ const DeleteAccount: React.FC = () => {
|
|||||||
<Text>
|
<Text>
|
||||||
Are you sure you want to delete your account? This action cannot be undone.
|
Are you sure you want to delete your account? This action cannot be undone.
|
||||||
</Text>
|
</Text>
|
||||||
<Button bg="ui.danger" color="white" _hover={{ opacity: 0.8 }} mt={4}>
|
<Button bg="ui.danger" color="white" _hover={{ opacity: 0.8 }} mt={4} onClick={confirmationModal.onOpen}>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
|
<DeleteConfirmation isOpen={confirmationModal.isOpen} onClose={confirmationModal.onClose} />
|
||||||
</ Container>
|
</ Container>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import { Button, Container, FormControl, FormLabel, Heading, Input, Text } from '@chakra-ui/react';
|
import { Button, Container, FormControl, FormLabel, Heading, Input, Text, useColorModeValue } from '@chakra-ui/react';
|
||||||
|
|
||||||
import { useUserStore } from '../store/user-store';
|
import { useUserStore } from '../store/user-store';
|
||||||
|
|
||||||
const UserInformation: React.FC = () => {
|
const UserInformation: React.FC = () => {
|
||||||
|
const color = useColorModeValue("gray.700", "white");
|
||||||
const [editMode, setEditMode] = useState(false);
|
const [editMode, setEditMode] = useState(false);
|
||||||
const { user } = useUserStore();
|
const { user } = useUserStore();
|
||||||
|
|
||||||
@@ -20,21 +21,21 @@ const UserInformation: React.FC = () => {
|
|||||||
User Information
|
User Information
|
||||||
</Heading>
|
</Heading>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel color="gray.700">Full name</FormLabel>
|
<FormLabel color={color}>Full name</FormLabel>
|
||||||
{
|
{
|
||||||
editMode ?
|
editMode ?
|
||||||
<Input placeholder={user?.full_name || "Full name"} type="text" /> :
|
<Input placeholder={user?.full_name || "Full name"} type="text" size="md" /> :
|
||||||
<Text>
|
<Text size="md" py={2}>
|
||||||
{user?.full_name || "N/A"}
|
{user?.full_name || "N/A"}
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={4}>
|
<FormControl mt={4}>
|
||||||
<FormLabel color="gray.700">Email</FormLabel>
|
<FormLabel color={color}>Email</FormLabel>
|
||||||
{
|
{
|
||||||
editMode ?
|
editMode ?
|
||||||
<Input placeholder={user?.email} type="text" /> :
|
<Input placeholder={user?.email} type="text" size="md" /> :
|
||||||
<Text>
|
<Text size="md" py={2}>
|
||||||
{user?.email || "N/A"}
|
{user?.email || "N/A"}
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user