Skip to content

Commit

Permalink
Merge pull request #26 from vocdoni/dev
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
elboletaire committed Mar 19, 2024
2 parents 869ab1e + 550fb37 commit 2e0ab16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion webapp/src/components/Done.tsx
Expand Up @@ -71,7 +71,7 @@ export const Done = ({ pid, setPid, usernames, setUsernames, censusRecords, shor
<Box>
<Text>
You created a census for a total of {usernames.length} farcaster users, containing{' '}
{Math.round((usernames.length / censusRecords) * 1000) / 10}% of the provided CSV file.{` `}
{Math.round((usernames.length / censusRecords) * 1000) / 10}% of the specified census.{` `}
<Link download={'census-usernames.csv'} href={usersfile.url}>
Download usernames list <Icon as={FaDownload} />
</Link>
Expand Down
15 changes: 10 additions & 5 deletions webapp/src/components/Form.tsx
Expand Up @@ -109,6 +109,7 @@ const Form: React.FC = (props: FlexProps) => {
name: 'addresses',
})
const censusType = watch('censusType')
const notify = watch('notify')

const notifyAllowed = ['custom', 'nft', 'erc20']

Expand Down Expand Up @@ -240,8 +241,10 @@ const Form: React.FC = (props: FlexProps) => {
if (census.usernames && census.usernames.length) {
setUsernames(census.usernames)
}
if (data.censusType === 'custom') {
if (census.fromTotalAddresses) {
setCensusRecords(census.fromTotalAddresses)
}
if (data.censusType === 'custom') {
census.size = census.usernames.length
}

Expand Down Expand Up @@ -291,7 +294,7 @@ const Form: React.FC = (props: FlexProps) => {

return (
<Flex flexDir='column' alignItems='center' {...props}>
<Card maxW={{ base: '100%', md: 400, lg: 500 }}>
<Card w={{ base: '100%', md: 400, lg: 500 }}>
<CardHeader align='center'>
<Heading as='h1' size='2xl'>
farcaster.vote
Expand Down Expand Up @@ -377,7 +380,9 @@ const Form: React.FC = (props: FlexProps) => {
</FormControl>
{notifyAllowed.includes(censusType) && (
<FormControl isDisabled={loading}>
<Switch {...register('notify')}>Notify farcaster users (only for censuses &lt; 1k)</Switch>
<Switch {...register('notify')} lineHeight={6}>
Notify farcaster users via cast (only for censuses &lt; 1k)
</Switch>
</FormControl>
)}
{['erc20', 'nft'].includes(censusType) &&
Expand All @@ -403,7 +408,7 @@ const Form: React.FC = (props: FlexProps) => {
placeholder='Smart contract address'
{...register(`addresses.${index}.address`, { required })}
/>
{(censusType === 'nft' || (censusType === 'erc20' && index > 0)) && (
{addressFields.length > 1 && (
<InputRightElement>
<IconButton
aria-label='Remove address'
Expand Down Expand Up @@ -512,7 +517,7 @@ const Form: React.FC = (props: FlexProps) => {
</Alert>
)}

{usernames.length > 1000 && (
{notify && usernames.length > 1000 && (
<Alert status='warning'>
<AlertIcon />
<AlertDescription>
Expand Down

0 comments on commit 2e0ab16

Please sign in to comment.