-
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 remote-tracking branch 'origin' into mo-tests
- Loading branch information
Showing
34 changed files
with
458 additions
and
133 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
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
4 changes: 2 additions & 2 deletions
4
dapp/src/assets/icons/Bitcoin.tsx → dapp/src/assets/icons/BitcoinIcon.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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import React from "react" | ||
import { createIcon } from "@chakra-ui/react" | ||
|
||
export const EthereumIcon = createIcon({ | ||
displayName: "EthereumIcon", | ||
viewBox: "0 0 56 57", | ||
path: [ | ||
<g clipPath="url(#clip0_7755_23923)"> | ||
<rect | ||
y="0.5" | ||
width="56" | ||
height="56" | ||
rx="28" | ||
fill="white" | ||
fillOpacity="0.1" | ||
/> | ||
<rect y="0.5" width="56" height="56" fill="#231F20" /> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M27.9967 13.5004L27.9969 13.5V13.5007L37.4934 28.9816L27.9969 34.4965V34.4969L27.9967 34.4967L27.9965 34.4968L27.996 34.4963L18.5 28.9816L27.9961 13.5014L27.9965 13.5L27.9967 13.5004ZM27.9969 43.8989V43.901L18.5 30.7528L27.9969 36.2652V36.2664L27.9978 36.2654L37.5003 30.7529L27.9978 43.9012L27.9969 43.8989Z" | ||
fill="#FFFDF9" | ||
/> | ||
</g>, | ||
<defs> | ||
<clipPath id="clip0_7755_23923"> | ||
<rect y="0.5" width="56" height="56" rx="28" fill="white" /> | ||
</clipPath> | ||
</defs>, | ||
], | ||
}) |
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
80 changes: 80 additions & 0 deletions
80
dapp/src/components/TransactionModal/ActiveStakingStep/StakingErrorModal/RetryModal.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,80 @@ | ||
import React, { useMemo } from "react" | ||
import { | ||
Box, | ||
Button, | ||
HStack, | ||
Icon, | ||
ModalBody, | ||
ModalFooter, | ||
ModalHeader, | ||
} from "@chakra-ui/react" | ||
import { CableWithPlugIcon } from "#/assets/icons" | ||
import { TextMd, TextSm } from "#/components/shared/Typography" | ||
import IconWrapper from "#/components/shared/IconWrapper" | ||
import { getExpirationTimestamp, getPercentValue } from "#/utils" | ||
import { useCountdown } from "#/hooks" | ||
import { ONE_MINUTE_IN_SECONDS, ONE_SEC_IN_MILLISECONDS } from "#/constants" | ||
import { IconShieldCheckFilled, IconX } from "@tabler/icons-react" | ||
|
||
const getCounterData = (minutes: string, seconds: string) => { | ||
const isLessThanMinute = parseInt(minutes, 10) <= 0 | ||
|
||
const progressPercent = `${ | ||
isLessThanMinute | ||
? getPercentValue(parseInt(seconds, 10), ONE_MINUTE_IN_SECONDS) | ||
: 100 | ||
}%` | ||
const label = `${isLessThanMinute ? "0" : "1"}:${seconds}` | ||
|
||
return { label, progressPercent } | ||
} | ||
|
||
export default function RetryModal({ retry }: { retry: () => void }) { | ||
const retryTimestamp = useMemo( | ||
() => | ||
getExpirationTimestamp(ONE_MINUTE_IN_SECONDS * ONE_SEC_IN_MILLISECONDS), | ||
[], | ||
) | ||
const { minutes, seconds } = useCountdown(retryTimestamp, true, retry) | ||
|
||
const { label, progressPercent } = getCounterData(minutes, seconds) | ||
|
||
return ( | ||
<> | ||
<ModalHeader color="red.400">Oops! There was an error.</ModalHeader> | ||
<ModalBody gap={10} pt={4}> | ||
<IconWrapper icon={CableWithPlugIcon} boxSize={32} color="red.400"> | ||
<Icon as={IconX} color="red.400" boxSize={14} strokeWidth={1} /> | ||
</IconWrapper> | ||
<TextMd> | ||
Your deposit didn't go through but no worries, your funds are | ||
safe. | ||
</TextMd> | ||
<HStack gap={1}> | ||
<TextMd>Auto-retry in</TextMd> | ||
<TextMd fontWeight="bold" textAlign="left" minW={10}> | ||
{label} | ||
</TextMd> | ||
<Box | ||
w={3} | ||
h={3} | ||
aspectRatio={1} | ||
borderRadius="50%" | ||
background={`conic-gradient(var(--chakra-colors-brand-400) ${progressPercent}, transparent 0)`} | ||
transition="background" | ||
/> | ||
<Box /> | ||
</HStack> | ||
</ModalBody> | ||
<ModalFooter mt={4}> | ||
<Button size="lg" width="100%" onClick={retry}> | ||
Retry | ||
</Button> | ||
<HStack> | ||
<Icon as={IconShieldCheckFilled} boxSize={5} color="gold.700" /> | ||
<TextSm color="grey.700">Your funds are secure.</TextSm> | ||
</HStack> | ||
</ModalFooter> | ||
</> | ||
) | ||
} |
Oops, something went wrong.