Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #26

Merged
merged 2 commits into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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