-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: account banner * fix: lintting issue
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
liquidity/ui/src/components/AccountBanner/AccountBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Button, Flex, Heading } from '@chakra-ui/react'; | ||
import { useAccounts, useCreateAccount } from '@snx-v3/useAccounts'; | ||
import { FC } from 'react'; | ||
|
||
export const AccountBanner: FC = () => { | ||
const { | ||
data: accounts, | ||
isLoading: isAccountsLoading, | ||
isFetching: isAccountsFetching, | ||
} = useAccounts(); | ||
const { | ||
mutation: { mutate: createAccount, isPending: isCreateAccountLoading }, | ||
} = useCreateAccount(); | ||
|
||
if (!isAccountsFetching && !isAccountsLoading && accounts && accounts.length === 0) { | ||
return ( | ||
<Flex | ||
mt={4} | ||
flexGrow="1" | ||
h="fit-content" | ||
border="1px solid" | ||
borderColor="gray.900" | ||
rounded="base" | ||
width="100%" | ||
px="6" | ||
py="8" | ||
bg="navy.700" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
> | ||
<Heading fontSize="18px">Create an account to deposit liquidity</Heading> | ||
<Button onClick={() => createAccount()} isLoading={isCreateAccountLoading}> | ||
Create Account | ||
</Button> | ||
</Flex> | ||
); | ||
} | ||
|
||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './AccountBanner'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters