From 7a1e85fe979cf242c7587e967c23f99aab44c423 Mon Sep 17 00:00:00 2001 From: Elvin Cheng Date: Thu, 7 Dec 2023 23:16:38 -0500 Subject: [PATCH] Style user info popup (#78) * first pass * finish cleanup and restyling --- apps/web/src/components/FormList.tsx | 51 ++++--- apps/web/src/components/TopBar.tsx | 133 +++++++++++------- .../CreateFormInstanceModal.tsx | 96 ++++++++----- .../createFormInstance/SignatureDropdown.tsx | 6 +- apps/web/src/static/icons.tsx | 63 ++++++--- apps/web/src/styles/globals.css | 1 - 6 files changed, 219 insertions(+), 131 deletions(-) diff --git a/apps/web/src/components/FormList.tsx b/apps/web/src/components/FormList.tsx index 9bf20a20..b5ce82b5 100644 --- a/apps/web/src/components/FormList.tsx +++ b/apps/web/src/components/FormList.tsx @@ -1,5 +1,17 @@ import { FormRow } from './FormRow'; -import { Box, Button, Flex, Grid, GridItem, Input, InputGroup, InputLeftElement, Select, Text, useDisclosure } from '@chakra-ui/react'; +import { + Box, + Button, + Flex, + Grid, + GridItem, + Input, + InputGroup, + InputLeftElement, + Select, + Text, + useDisclosure, +} from '@chakra-ui/react'; import { RightSearchIcon, SortDownArrow } from 'apps/web/src/static/icons'; import { FormInstanceEntity } from '@web/client'; import { useState } from 'react'; @@ -20,12 +32,13 @@ export const FormList = ({ const { isOpen, onToggle } = useDisclosure(); const [showButton, setShowButton] = useState(false); - - const sortedFormInstances = formInstances .map((formInstance) => ({ ...formInstance, - levenshteinDistance: distance(searchQuery.toLowerCase(), formInstance.name.toLowerCase()), + levenshteinDistance: distance( + searchQuery.toLowerCase(), + formInstance.name.toLowerCase(), + ), })) .sort((a, b) => a.levenshteinDistance - b.levenshteinDistance); @@ -63,7 +76,11 @@ export const FormList = ({ > {isOpen ? ( - + ) : ( @@ -85,10 +102,10 @@ export const FormList = ({ borderBottom="1px solid" borderColor="#B0B0B0" boxShadow="none" - _hover={{ borderColor: "#595959" }} + _hover={{ borderColor: '#595959' }} _focus={{ - borderColor: "#595959", - boxShadow: "none", + borderColor: '#595959', + boxShadow: 'none', }} value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} @@ -117,7 +134,7 @@ export const FormList = ({ icon={} iconSize="10px" > - + @@ -148,13 +165,15 @@ export const FormList = ({ - {sortedFormInstances.map((formInstance: FormInstanceEntity, index: number) => ( - - ))} + {sortedFormInstances.map( + (formInstance: FormInstanceEntity, index: number) => ( + + ), + )} diff --git a/apps/web/src/components/TopBar.tsx b/apps/web/src/components/TopBar.tsx index 35b2e7c3..9f51fd23 100644 --- a/apps/web/src/components/TopBar.tsx +++ b/apps/web/src/components/TopBar.tsx @@ -1,4 +1,3 @@ -import { MFALogoIcon, UserProfileAvatar } from 'apps/web/src/static/icons'; import { Box, Hide, @@ -6,12 +5,19 @@ import { Text, Flex, Spacer, - Button, Popover, PopoverBody, PopoverContent, PopoverTrigger, + Divider, } from '@chakra-ui/react'; +import { + DropdownDownArrow, + DropdownUpArrow, + MFALogoIcon, + SignoutIcon, + UserProfileAvatar, +} from 'apps/web/src/static/icons'; import { useAuth } from '@web/hooks/useAuth'; export const TopBar: React.FC = () => { @@ -40,59 +46,78 @@ export const TopBar: React.FC = () => { - - - - Welcome back, {user?.firstName}! - - - - - - - ) : ( - - ) - } - colorScheme="none" - /> - - - - - - {user?.firstName + ' ' + user?.lastName} - - - - - + + + {({ isOpen, onClose }) => ( + <> + + + + + + + + {user?.firstName + ' ' + user?.lastName} + + + Position + + + + + + + + )} - ); diff --git a/apps/web/src/components/createFormInstance/CreateFormInstanceModal.tsx b/apps/web/src/components/createFormInstance/CreateFormInstanceModal.tsx index a7fc335d..79ab1bf6 100644 --- a/apps/web/src/components/createFormInstance/CreateFormInstanceModal.tsx +++ b/apps/web/src/components/createFormInstance/CreateFormInstanceModal.tsx @@ -1,13 +1,29 @@ import React, { useState, useEffect } from 'react'; import { - Modal, ModalOverlay, ModalContent, ModalBody, ModalCloseButton, Button, Flex, Box, Text, ModalFooter, Skeleton, Grid, List + Modal, + ModalOverlay, + ModalContent, + ModalBody, + ModalCloseButton, + Button, + Flex, + Box, + Text, + ModalFooter, + Skeleton, + Grid, + List, } from '@chakra-ui/react'; import { Reorder } from 'framer-motion'; import { DropdownDownArrow, DropdownUpArrow } from '@web/static/icons'; import { chakraComponents, Select } from 'chakra-react-select'; import { useMutation, useQuery } from '@tanstack/react-query'; import { - CreateFormInstanceDto, FormInstancesService, FormTemplateEntity, FormTemplatesService, PositionsService, + CreateFormInstanceDto, + FormInstancesService, + FormTemplateEntity, + FormTemplatesService, + PositionsService, } from '@web/client'; import { SignatureDropdown } from './SignatureDropdown'; import { CreateFormInstanceModalProps, Option } from './types'; @@ -94,7 +110,13 @@ const CreateFormInstanceModal: React.FC = ({ - + = ({ DropdownIndicator: (props: any) => ( {isFormTypeDropdownOpen ? ( - + ) : ( - + )} ), @@ -156,38 +178,38 @@ const CreateFormInstanceModal: React.FC = ({ /> {formTypeSelected ? ( - - - Assignees - -
- {selectedFormTemplate?.signatureFields.map((field, i) => ( - - ))} -
-
+ + + Assignees + +
+ {selectedFormTemplate?.signatureFields.map((field, i) => ( + + ))} +
+
) : ( - - Select assignee - + + Select assignee + ); export const SignatureDropdown = ({ diff --git a/apps/web/src/static/icons.tsx b/apps/web/src/static/icons.tsx index 2db0c5e9..943045fd 100644 --- a/apps/web/src/static/icons.tsx +++ b/apps/web/src/static/icons.tsx @@ -54,11 +54,10 @@ export const SearchIcon = createIcon({ d: 'M20.3504 18.6627H19.33L18.9683 18.3139C20.2342 16.8414 20.9963 14.9298 20.9963 12.8502C20.9963 8.2131 17.2375 4.45435 12.6004 4.45435C7.96334 4.45435 4.20459 8.2131 4.20459 12.8502C4.20459 17.4873 7.96334 21.246 12.6004 21.246C14.68 21.246 16.5917 20.4839 18.0642 19.2181L18.4129 19.5798V20.6002L24.8713 27.0456L26.7958 25.121L20.3504 18.6627ZM12.6004 18.6627C9.38417 18.6627 6.78792 16.0664 6.78792 12.8502C6.78792 9.63393 9.38417 7.03768 12.6004 7.03768C15.8167 7.03768 18.4129 9.63393 18.4129 12.8502C18.4129 16.0664 15.8167 18.6627 12.6004 18.6627Z', }); - export const RightSearchIcon = createIcon({ displayName: 'RightSearchIcon', viewBox: '0 0 26 26', - d: "M8.85026 14.8939H9.67318L9.96484 14.6126C8.94401 13.4251 8.32943 11.8835 8.32943 10.2064C8.32943 6.4668 11.3607 3.43555 15.1003 3.43555C18.8398 3.43555 21.8711 6.4668 21.8711 10.2064C21.8711 13.946 18.8398 16.9772 15.1003 16.9772C13.4232 16.9772 11.8815 16.3626 10.694 15.3418L10.4128 15.6335V16.4564L5.20443 21.6543L3.65234 20.1022L8.85026 14.8939ZM15.1003 14.8939C17.694 14.8939 19.7878 12.8001 19.7878 10.2064C19.7878 7.61263 17.694 5.51888 15.1003 5.51888C12.5065 5.51888 10.4128 7.61263 10.4128 10.2064C10.4128 12.8001 12.5065 14.8939 15.1003 14.8939Z", + d: 'M8.85026 14.8939H9.67318L9.96484 14.6126C8.94401 13.4251 8.32943 11.8835 8.32943 10.2064C8.32943 6.4668 11.3607 3.43555 15.1003 3.43555C18.8398 3.43555 21.8711 6.4668 21.8711 10.2064C21.8711 13.946 18.8398 16.9772 15.1003 16.9772C13.4232 16.9772 11.8815 16.3626 10.694 15.3418L10.4128 15.6335V16.4564L5.20443 21.6543L3.65234 20.1022L8.85026 14.8939ZM15.1003 14.8939C17.694 14.8939 19.7878 12.8001 19.7878 10.2064C19.7878 7.61263 17.694 5.51888 15.1003 5.51888C12.5065 5.51888 10.4128 7.61263 10.4128 10.2064C10.4128 12.8001 12.5065 14.8939 15.1003 14.8939Z', }); export const ProfileIcon = createIcon({ @@ -148,11 +147,12 @@ export const CheckIcon = createIcon({ export const MFALogoIcon = createIcon({ displayName: 'CustomLogoIcon', - viewBox: '0 0 800 200', + viewBox: '0 0 800 200', path: ( - - - - - - - + c-3.2,4.84-7.79,8.62-13.74,11.28c-5.87,2.67-12.76,4.02-20.64,4.02L757.76,168.29z" + /> + + + + + ), }); - export const SortDownArrow = createIcon({ displayName: 'SortDownArrow', viewBox: '0 0 10 8', @@ -201,14 +209,14 @@ export const SortDownArrow = createIcon({ export const DropdownDownArrow = createIcon({ displayName: 'DropdownDownArrow', - viewBox: '0 0 25 8', - d: 'M6 9L0.803848 0H11.1962L6 9Z', + viewBox: '0 0 10 8', + d: 'M5 8L0.669872 0.5L9.33013 0.5L5 8Z', }); export const DropdownUpArrow = createIcon({ displayName: 'DropdownUpArrow', - viewBox: '0 0 25 8', - d: 'M6 0L11.1962 9H0.803848L6 0Z', + viewBox: '0 0 10 8', + d: 'M5 0L9.33013 7.5L0.669873 7.5L5 0Z', }); export const UploadForm = createIcon({ @@ -268,3 +276,18 @@ export const ErrorIcon = createIcon({ ), }); + +export const SignoutIcon = createIcon({ + displayName: 'SignoutIcon', + viewBox: '0 0 15 20', + path: ( + <> + + + ), +}); diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css index 266f82b8..be502cba 100644 --- a/apps/web/src/styles/globals.css +++ b/apps/web/src/styles/globals.css @@ -126,4 +126,3 @@ a { background: #4c658a; border-radius: 24px; } -