Skip to content

Commit

Permalink
process improvements (#565)
Browse files Browse the repository at this point in the history
* improvments

* delete rerender state
  • Loading branch information
gerouvi committed Mar 5, 2024
1 parent 297e31b commit f841261
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 49 deletions.
2 changes: 0 additions & 2 deletions src/components/Navbar/index.tsx
Expand Up @@ -79,8 +79,6 @@ const Navbar = () => {
src={account?.account.avatar}
name={account?.account.name.default || account?.address}
size='xs'
bg='primary.main'
color='white'
/>
{isOpen ? (
<ChevronUpIcon boxSize={8} color='navbar_chevron' />
Expand Down
24 changes: 24 additions & 0 deletions src/components/Process/ActionsMenu.tsx
Expand Up @@ -52,6 +52,12 @@ const ActionsMenuList = (props: MenuListProps) => {
justifyContent='start'
isLoading={loading.continue}
variant=''
sx={{
'& span': {
display: 'flex',
alignItems: 'center',
},
}}
>
{t('process_actions.start')}
</MenuItem>
Expand All @@ -64,6 +70,12 @@ const ActionsMenuList = (props: MenuListProps) => {
justifyContent='start'
isLoading={loading.pause}
variant=''
sx={{
'& span': {
display: 'flex',
alignItems: 'center',
},
}}
>
{t('process_actions.pause')}
</MenuItem>
Expand All @@ -76,6 +88,12 @@ const ActionsMenuList = (props: MenuListProps) => {
isLoading={loading.end}
variant='solid'
colorScheme='gray'
sx={{
'& span': {
display: 'flex',
alignItems: 'center',
},
}}
>
{t('process_actions.end')}
</MenuItem>
Expand All @@ -88,6 +106,12 @@ const ActionsMenuList = (props: MenuListProps) => {
isLoading={loading.cancel}
variant='solid'
colorScheme='gray'
sx={{
'& span': {
display: 'flex',
alignItems: 'center',
},
}}
>
{t('process_actions.cancel')}
</MenuItem>
Expand Down
15 changes: 13 additions & 2 deletions src/components/Process/Aside.tsx
Expand Up @@ -138,7 +138,7 @@ const ProcessAside = () => {
)
}

export const VoteButton = ({ setQuestionsTab }: { setQuestionsTab: () => void }) => {
export const VoteButton = ({ setQuestionsTab, ...props }: { setQuestionsTab: () => void }) => {
const { t } = useTranslation()

const { election, connected, isAbleToVote, isInCensus } = useElection()
Expand All @@ -159,6 +159,7 @@ export const VoteButton = ({ setQuestionsTab }: { setQuestionsTab: () => void })
color='process.aside.color'
py={3}
px={{ base: 3, lg2: 0 }}
{...props}
>
{census?.type !== 'spreadsheet' && !connected && (
<ConnectButton.Custom>
Expand Down Expand Up @@ -193,7 +194,17 @@ export const VoteButton = ({ setQuestionsTab }: { setQuestionsTab: () => void })
</ConnectButton.Custom>
)}
{census?.type === 'spreadsheet' && !connected && <SpreadsheetAccess />}
{isAbleToVote && <CVoteButton w='full' fontSize='lg' onClick={setQuestionsTab} />}
{isAbleToVote && (
<CVoteButton
w='60%'
fontSize='lg'
height='50px'
onClick={setQuestionsTab}
_disabled={{
opacity: '0.8',
}}
/>
)}
</Flex>
)
}
Expand Down
9 changes: 2 additions & 7 deletions src/components/Process/CreatedBy.tsx
Expand Up @@ -9,12 +9,7 @@ export const CreatedBy = (props: FlexProps) => {

return (
<Flex gap={2} alignItems='center' {...props}>
<Avatar
alignSelf='start'
size='sm'
src={organization?.account.avatar}
name={organization?.account.name.default}
/>
<Avatar size='sm' src={organization?.account.avatar} name={organization?.account.name.default} />
<LongOrganizationName />
<CopyAddressBtn />
</Flex>
Expand Down Expand Up @@ -52,7 +47,7 @@ const CopyAddressBtn = () => {
return (
<IconButton
variant='transparent'
icon={<CopyIcon />}
icon={<CopyIcon boxSize={3} />}
aria-label='copy address'
onClick={() => {
toast({
Expand Down
3 changes: 2 additions & 1 deletion src/components/Process/View.tsx
Expand Up @@ -76,6 +76,7 @@ export const ProcessView = () => {
<Box>
<Box className='site-wrapper' mb={44}>
<Header />

{election?.streamUri && (
<Box
maxW={{ base: videoTop ? '250px' : '800px', lg: videoTop ? '400px' : '800px' }}
Expand Down Expand Up @@ -107,7 +108,7 @@ export const ProcessView = () => {
</TabList>
<TabPanels>
<TabPanel>
<Box className='md-sizes'>
<Box className='md-sizes' mb='100px' pt='50px'>
<ElectionQuestions
confirmContents={(election, answers) => <ConfirmVoteModal election={election} answers={answers} />}
/>
Expand Down
4 changes: 4 additions & 0 deletions src/themes/default/colors.ts
Expand Up @@ -34,6 +34,10 @@ export const colors = {
700: colorsBase.primary.dark2,
},

avatar: {
bg: colorsBase.primary.main,
color: colorsBase.white.pure,
},
black: {
50: colorsBase.white.pure,
500: colorsBase.black,
Expand Down
31 changes: 0 additions & 31 deletions src/themes/default/components/Actions.ts

This file was deleted.

16 changes: 16 additions & 0 deletions src/themes/default/components/Avatar.ts
@@ -0,0 +1,16 @@
import { avatarAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers } from '@chakra-ui/react'

const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(avatarAnatomy.keys)

const baseStyle = definePartsStyle({
// define the part you're going to style

container: {
borderRadius: 'full',
bg: 'avatar.bg',
color: 'avatar.color',
},
})

export const Avatar = defineMultiStyleConfig({ baseStyle })
11 changes: 8 additions & 3 deletions src/themes/default/components/Questions.ts
Expand Up @@ -105,13 +105,17 @@ const baseStyle = definePartsStyle({
alignItems: 'center',
gap: 2,
w: { lg2: '99%' },
_hover: {
bgColor: '#eee',
},

'& span:nth-of-type(1)': {
display: { base: 'none', md: 'block' },
position: 'absolute',
width: '30px',
height: '30px',
background: 'transparent',
ml: '5px',
ml: '10px',
borderRadius: 'none',

'&[data-checked=""]': {
Expand All @@ -120,9 +124,9 @@ const baseStyle = definePartsStyle({
bgColor: 'transparent',
},

border: 'none',
background: 'process.questions.question_selected.bg',
borderColor: 'process.questions.question_selected.bg',
borderColor: 'white',
borderWidth: '1px',
bgSize: '15px',
bgRepeat: 'no-repeat',
bgPosition: 'center',
Expand All @@ -146,6 +150,7 @@ const baseStyle = definePartsStyle({
},
'& span:nth-of-type(2)': {
p: 2,
pl: { md: 12 },
m: 0,
border: '1px solid lightgray',
w: '100%',
Expand Down
6 changes: 3 additions & 3 deletions src/themes/default/components/index.ts
@@ -1,4 +1,3 @@
import { ElectionActions } from './Actions'
import { Alert } from './Alert'
import { Badge } from './Badge'
import { Button } from './Button'
Expand All @@ -16,15 +15,16 @@ import { SpreadsheetAccess } from './SpreadSheet'
import { Stepper } from './Stepper'
import { Tabs } from './Tabs'
import { Textarea } from './Textarea'
import { Avatar } from './Avatar'

export {
Alert,
Avatar,
Badge,
Button,
Card,
Checkbox,
ConfirmModal,
ElectionActions,
ElectionQuestions,
ElectionResults,
Form,
Expand All @@ -39,8 +39,8 @@ export {
}

export const components = {
ElectionActions,
Alert,
Avatar,
Badge,
Button,
Card,
Expand Down

3 comments on commit f841261

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://onvote-stg.netlify.app as production
πŸš€ Deployed on https://65e712c218b65a0ca989f180--onvote-stg.netlify.app

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.