-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from valory-xyz/tanya/improve-creating-accoun…
…t-transition Make creating account transition more obvious
- Loading branch information
Showing
7 changed files
with
112 additions
and
68 deletions.
There are no files selected for viewing
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,78 @@ | ||
import { message, Typography } from 'antd'; | ||
import Image from 'next/image'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { Chain } from '@/client'; | ||
import { CardSection } from '@/components/styled/CardSection'; | ||
import { SUPPORT_URL } from '@/constants'; | ||
import { UNICODE_SYMBOLS } from '@/constants/unicode'; | ||
import { PageState } from '@/enums'; | ||
import { usePageState, useSetup } from '@/hooks'; | ||
import { useWallet } from '@/hooks/useWallet'; | ||
import { WalletService } from '@/service/Wallet'; | ||
|
||
export const SetupCreateSafe = () => { | ||
const { masterSafeAddress } = useWallet(); | ||
const { backupSigner } = useSetup(); | ||
const { goto } = usePageState(); | ||
|
||
const [isCreatingSafe, setIsCreatingSafe] = useState(false); | ||
const [isError, setIsError] = useState(false); | ||
|
||
useEffect(() => { | ||
if (isCreatingSafe) return; | ||
setIsCreatingSafe(true); | ||
// TODO: add backup signer | ||
WalletService.createSafe(Chain.GNOSIS, backupSigner).catch((e) => { | ||
console.error(e); | ||
setIsError(true); | ||
message.error('Failed to create an account. Please try again later.'); | ||
}); | ||
}, [backupSigner, isCreatingSafe]); | ||
|
||
useEffect(() => { | ||
// Only progress is the safe is created and accessible via context (updates on interval) | ||
if (masterSafeAddress) goto(PageState.Main); | ||
}, [goto, masterSafeAddress]); | ||
|
||
return ( | ||
<CardSection | ||
vertical | ||
align="center" | ||
justify="center" | ||
padding="80px 24px" | ||
gap={12} | ||
> | ||
{isError ? ( | ||
<> | ||
<Image src="/broken-robot.svg" alt="logo" width={80} height={80} /> | ||
<Typography.Text type="secondary" className="mt-12"> | ||
Error, please contact{' '} | ||
<a target="_blank" href={SUPPORT_URL}> | ||
Olas community {UNICODE_SYMBOLS.EXTERNAL_LINK} | ||
</a> | ||
</Typography.Text> | ||
</> | ||
) : ( | ||
<> | ||
<Image | ||
src="/onboarding-robot.svg" | ||
alt="logo" | ||
width={80} | ||
height={80} | ||
/> | ||
<Typography.Title | ||
level={4} | ||
className="m-0 mt-12 loading-ellipses" | ||
style={{ width: '220px' }} | ||
> | ||
Creating account | ||
</Typography.Title> | ||
<Typography.Text type="secondary"> | ||
You will be redirected once the account is created | ||
</Typography.Text> | ||
</> | ||
)} | ||
</CardSection> | ||
); | ||
}; |
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
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const BACKEND_URL: string = `http://localhost:${process.env.NEXT_PUBLIC_BACKEND_PORT || 8000}/api`; | ||
export const COW_SWAP_GNOSIS_XDAI_OLAS_URL: string = | ||
'https://swap.cow.fi/#/100/swap/WXDAI/OLAS'; | ||
export const SUPPORT_URL = | ||
'https://discord.com/channels/899649805582737479/1169275451089367131'; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.