Skip to content

Commit

Permalink
feat: account banner (#279)
Browse files Browse the repository at this point in the history
* feat: account banner

* fix: lintting issue
  • Loading branch information
Rickk137 authored May 22, 2024
1 parent f9f7a8b commit 57ae3ef
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
40 changes: 40 additions & 0 deletions liquidity/ui/src/components/AccountBanner/AccountBanner.tsx
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;
};
1 change: 1 addition & 0 deletions liquidity/ui/src/components/AccountBanner/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './AccountBanner';
4 changes: 4 additions & 0 deletions liquidity/ui/src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { Flex, Heading } from '@chakra-ui/react';
import { Helmet } from 'react-helmet';
import { AssetsList, PositionsList, StatsList } from '../../components';
import { AccountBanner } from '../../components/AccountBanner';
import { useWallet } from '@snx-v3/useBlockchain';

export function Home() {
const { activeWallet } = useWallet();
return (
<>
<Helmet>
<title>Synthetix Liquidity V3</title>
<meta name="description" content="Synthetix V3 - Dashboard" />
</Helmet>
<Flex flexDir="column" mb={16}>
{activeWallet && <AccountBanner />}
<Heading
mt={{
base: 2,
Expand Down

0 comments on commit 57ae3ef

Please sign in to comment.