Skip to content

Commit

Permalink
fix: hide disabled add button if all followers have been added
Browse files Browse the repository at this point in the history
  • Loading branch information
maui-r committed Nov 14, 2022
1 parent 60aa4e0 commit ce5680a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/NodeDetails/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,21 +437,21 @@ const QueryFollowersButton = ({ profileId }: { profileId: string }) => {
}
}

if (isQuerying) return <Button variant='outlined' size='small' disabled>Add</Button>

if (!node.followersPageInfo) return (
<Tooltip title='Add to graph'>
<Button variant='outlined' size='small' onClick={handleAddFollowers}>Add</Button>
</Tooltip>
)

if (node.followersPageInfo.next < node.followersPageInfo.total) return (
if (node.followersPageInfo.next >= node.followersPageInfo.total) return null

if (isQuerying) return <Button variant='outlined' size='small' disabled>Add</Button>

return (
<Tooltip title='Add to graph'>
<Button variant='outlined' size='small' onClick={handleAddFollowers}>Add more</Button>
</Tooltip>
)

return null
}

const ProfileDetails = ({ profileId }: { profileId: string }) => {
Expand Down

0 comments on commit ce5680a

Please sign in to comment.