-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: WalletConnect integration, part 8, verify
- Loading branch information
1 parent
7a8aa27
commit 6127b2d
Showing
9 changed files
with
165 additions
and
48 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
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,17 +1,61 @@ | ||
import { Box, Card, HStack, Icon, VStack } from "@chakra-ui/react"; | ||
|
||
import { AlertCircleIcon } from "../../assets/icons"; | ||
import { AlertCircleIcon, AlertTriangleIcon, VerifiedIcon } from "../../assets/icons"; | ||
|
||
export const VerifyInfobox = () => ( | ||
<Box textAlign="center"> | ||
<VStack spacing="16px"> | ||
<HStack margin="auto"> | ||
<Icon as={AlertCircleIcon} verticalAlign="bottom" /> | ||
<Card marginLeft="8px">Unknown domain</Card> | ||
</HStack> | ||
<Box margin="auto"> | ||
<Card>This domain was not verified. To be implemented.</Card> | ||
</Box> | ||
export type VerificationAlert = { | ||
color: string; | ||
icon: typeof AlertTriangleIcon; | ||
text: string; | ||
}; | ||
export type ValidationStatus = "SCAM" | "UNKNOWN" | "INVALID" | "VALID"; | ||
|
||
const getVerificationAlert = (validationStatus: ValidationStatus) => { | ||
const statusOptions: Record<ValidationStatus, VerificationAlert> = { | ||
SCAM: { | ||
color: "red.500", | ||
icon: AlertTriangleIcon, | ||
text: "This domain is suspected to be a SCAM. Potential threat detected.", | ||
}, | ||
UNKNOWN: { | ||
color: "yellow.500", | ||
icon: AlertCircleIcon, | ||
text: "This domain is unknown. Cannot verify it.", | ||
}, | ||
INVALID: { | ||
color: "yellow.500", | ||
icon: AlertTriangleIcon, | ||
text: "This domain is invalid.", | ||
}, | ||
VALID: { | ||
color: "green.500", | ||
icon: VerifiedIcon, | ||
text: "This domain is verified.", | ||
}, | ||
}; | ||
return ( | ||
<HStack | ||
margin="auto" | ||
padding="8px" | ||
border="1px solid" | ||
borderColor={statusOptions[validationStatus].color} | ||
borderRadius="md" | ||
> | ||
<Icon as={statusOptions[validationStatus].icon} verticalAlign="bottom" /> | ||
<Card marginLeft="8px">{statusOptions[validationStatus].text}</Card> | ||
</HStack> | ||
); | ||
}; | ||
|
||
export const VerifyInfobox = ({ | ||
isScam, | ||
validationStatus, | ||
}: { | ||
isScam?: boolean; | ||
validationStatus: "UNKNOWN" | "INVALID" | "VALID"; | ||
}) => ( | ||
<Box textAlign="left" data-testid="verifyinfobox"> | ||
<VStack margin="auto" marginTop="16px" marginBottom="16px" spacing="16px"> | ||
{isScam ? getVerificationAlert("SCAM") : getVerificationAlert(validationStatus)} | ||
</VStack> | ||
</Box> | ||
); |
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
6127b2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.