This commit is contained in:
delivan 2022-12-20 22:39:33 +09:00
commit fdfbb02f98
5 changed files with 64 additions and 51 deletions

View File

@ -85,7 +85,7 @@ export const BeforeYouStartModal: FunctionComponent<Props> = (props) => {
{selectedWalletItem && ( {selectedWalletItem && (
<selectedWalletItem.IconComponent width={16} height={16} /> <selectedWalletItem.IconComponent width={16} height={16} />
)} )}
{walletKeyName} <WalletAccountName>{walletKeyName}</WalletAccountName>
</WalletAccountValue> </WalletAccountValue>
</WalletAccountContainer> </WalletAccountContainer>
<ClaimWithTwitterButton onClick={handleClickButton}> <ClaimWithTwitterButton onClick={handleClickButton}>
@ -186,6 +186,13 @@ const WalletAccountValue = styled.div`
color: ${color.grey["100"]}; color: ${color.grey["100"]};
`; `;
const WalletAccountName = styled.div`
max-width: 11rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
`;
const ClaimWithTwitterButton = styled.button` const ClaimWithTwitterButton = styled.button`
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -7,3 +7,15 @@ export const KEPLR_VERSION_ERROR = "You should update keplr";
export const KEPLR_NO_ACCOUNT_ERROR = "key doesn't exist"; export const KEPLR_NO_ACCOUNT_ERROR = "key doesn't exist";
export const KEPLR_NO_ACCOUNT_MESSAGE = export const KEPLR_NO_ACCOUNT_MESSAGE =
"Create a wallet account to get started with ICNS!"; "Create a wallet account to get started with ICNS!";
export const INSUFFICIENT_GAS_ERROR = "insufficient funds: invalid request";
export const INSUFFICIENT_GAS_MESSAGE =
"Not enough OSMO in your account. Please add more OSMO to your account";
export const ACCOUNT_NOT_EXIST_ERROR = "does not exist: unknown address";
export const ACCOUNT_NOT_EXIST_MESSAGE =
"Account has not been registered on chain. Please add some OSMO to your account and try again.";
export const VERIFICATION_THRESHOLD_ERROR = "verfication is below threshold:";
export const VERIFICATION_THRESHOLD_MESSAGE =
"Verifier consensus failed. Verifiers may be offline. Please try again later.";

View File

@ -98,9 +98,9 @@ export default function CompletePage() {
strings={registeredAddressed.map( strings={registeredAddressed.map(
(address) => address.bech32_prefix, (address) => address.bech32_prefix,
)} )}
typeSpeed={150} typeSpeed={30}
backSpeed={150} backSpeed={30}
backDelay={1000} backDelay={500}
loop loop
smartBackspace smartBackspace
onStringTyped={(arrayPos: number) => { onStringTyped={(arrayPos: number) => {
@ -113,16 +113,6 @@ export default function CompletePage() {
</RecipentContainer> </RecipentContainer>
</ContentContainer> </ContentContainer>
<DescriptionContainer>
<AlertIcon>
<AlertCircleOutlineIcon />
</AlertIcon>
<DescriptionText>
ICNS name will stay the same even if your twitter handle changes in
the future.
</DescriptionText>
</DescriptionContainer>
<ShareButtonContainer onClick={onClickShareButton}> <ShareButtonContainer onClick={onClickShareButton}>
<Image <Image
src="/images/icons/twitter-small.png" src="/images/icons/twitter-small.png"
@ -130,7 +120,7 @@ export default function CompletePage() {
width={28} width={28}
height={28} height={28}
/> />
<ShareButtonText>SHARE MY NAME</ShareButtonText> <ShareButtonText>INVITE FRIENDS</ShareButtonText>
</ShareButtonContainer> </ShareButtonContainer>
</MainContainer> </MainContainer>
</Container> </Container>
@ -224,40 +214,6 @@ const AvailableAddressText = styled.div`
color: ${color.blue}; color: ${color.blue};
`; `;
const DescriptionContainer = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 1rem;
width: 31rem;
margin-top: 1.5rem;
padding: 1.25rem 2rem;
background-color: ${color.grey["900"]};
`;
const AlertIcon = styled.div`
position: relative;
width: 1.5rem;
height: 1.5rem;
`;
const DescriptionText = styled.div`
width: 100%;
font-family: "Inter", serif;
font-style: normal;
font-weight: 400;
font-size: 0.8rem;
line-height: 140%;
color: ${color.grey["400"]};
`;
const SpinnerWrapper = styled.div` const SpinnerWrapper = styled.div`
display: flex; display: flex;
position: relative; position: relative;

View File

@ -81,11 +81,18 @@ export default function Home() {
<SubContainer> <SubContainer>
<CheckContainer> <CheckContainer>
<CheckIcon /> <CheckIcon />
Osmo is required for this transaction 0.5+ Osmo is required for this transaction{" "}
<a
href="https://app.osmosis.zone"
target="_blank"
rel="noreferrer"
>
GET OSMO
</a>
</CheckContainer> </CheckContainer>
<CheckContainer> <CheckContainer>
<CheckIcon /> <CheckIcon />
More wallet support coming soon Make sure you have a Cosmos wallet installed
</CheckContainer> </CheckContainer>
</SubContainer> </SubContainer>
</MainTitleContainer> </MainTitleContainer>
@ -246,4 +253,8 @@ const CheckContainer = styled.div`
padding-left: 0.75rem; padding-left: 0.75rem;
color: ${color.grey["400"]}; color: ${color.grey["400"]};
a {
color: ${color.grey["400"]};
}
`; `;

View File

@ -52,8 +52,14 @@ import {
verifyTwitterAccount, verifyTwitterAccount,
} from "../../queries"; } from "../../queries";
import { import {
ACCOUNT_NOT_EXIST_ERROR,
ACCOUNT_NOT_EXIST_MESSAGE,
INSUFFICIENT_GAS_ERROR,
INSUFFICIENT_GAS_MESSAGE,
KEPLR_NOT_FOUND_ERROR, KEPLR_NOT_FOUND_ERROR,
TWITTER_LOGIN_ERROR, TWITTER_LOGIN_ERROR,
VERIFICATION_THRESHOLD_ERROR,
VERIFICATION_THRESHOLD_MESSAGE,
} from "../../constants/error-message"; } from "../../constants/error-message";
import { makeClaimMessage, makeSetRecordMessage } from "../../messages"; import { makeClaimMessage, makeSetRecordMessage } from "../../messages";
import Axios from "axios"; import Axios from "axios";
@ -428,6 +434,26 @@ export default function VerificationPage() {
} }
} catch (error) { } catch (error) {
if (Axios.isAxiosError(error)) { if (Axios.isAxiosError(error)) {
const message = (error?.response?.data as QueryError).message;
if (message.includes(INSUFFICIENT_GAS_ERROR)) {
setErrorMessage({ message: INSUFFICIENT_GAS_MESSAGE });
setErrorModalOpen(true);
return;
}
if (message.includes(ACCOUNT_NOT_EXIST_ERROR)) {
setErrorMessage({ message: ACCOUNT_NOT_EXIST_MESSAGE });
setErrorModalOpen(true);
return;
}
if (message.includes(VERIFICATION_THRESHOLD_ERROR)) {
setErrorMessage({ message: VERIFICATION_THRESHOLD_MESSAGE });
setErrorModalOpen(true);
return;
}
setErrorMessage({ setErrorMessage({
message: (error?.response?.data as QueryError).message, message: (error?.response?.data as QueryError).message,
}); });
@ -437,6 +463,7 @@ export default function VerificationPage() {
if (error instanceof Error) { if (error instanceof Error) {
console.log(error.message); console.log(error.message);
setErrorMessage({ message: error.message }); setErrorMessage({ message: error.message });
setErrorModalOpen(true); setErrorModalOpen(true);
} }