-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Experiment with chain pages * More progress on chain pages * Move providers to root * Add flags and improve styling * Add gatsby-ssr * More responsiveness and fixes
- Loading branch information
1 parent
96897c2
commit f991fdc
Showing
15 changed files
with
350 additions
and
59 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,9 @@ | ||
import React from "react"; | ||
import { Web3Provider } from "./src/context/Web3Context"; | ||
import { SearchProvider } from "./src/context/SearchContext"; | ||
|
||
export const wrapRootElement = ({ element }) => ( | ||
<SearchProvider> | ||
<Web3Provider>{element}</Web3Provider> | ||
</SearchProvider> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from "react"; | ||
import { Web3Provider } from "./src/context/Web3Context"; | ||
import { SearchProvider } from "./src/context/SearchContext"; | ||
|
||
export const wrapRootElement = ({ element }) => ( | ||
<SearchProvider> | ||
<Web3Provider>{element}</Web3Provider> | ||
</SearchProvider> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from "react"; | ||
import { ExternalLinkIcon } from "@chakra-ui/icons"; | ||
import { Link } from "@chakra-ui/react"; | ||
|
||
export const ExternalLink = ({ href, children }) => ( | ||
<Link href={href} isExternal> | ||
{children} <ExternalLinkIcon mx="2px" /> | ||
</Link> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
import { Badge, Tooltip } from "@chakra-ui/react"; | ||
import { ChainData } from "../types/chain"; | ||
|
||
export const RedFlagBadge = ({ redFlags }: Pick<ChainData, "redFlags">) => { | ||
if (!redFlags || redFlags.length === 0) { | ||
return null; | ||
} | ||
const flagLabel = | ||
redFlags[0] === "reusedChainId" | ||
? "Flagged for reusing chain ID" | ||
: "Flagged for unknown reasons"; | ||
return ( | ||
<Tooltip label={flagLabel}> | ||
<Badge colorScheme="red" textTransform="capitalize"> | ||
Flagged | ||
</Badge> | ||
</Tooltip> | ||
); | ||
}; |
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,45 @@ | ||
import React, { useContext } from "react"; | ||
import { | ||
Button, | ||
Table, | ||
TableContainer, | ||
Tbody, | ||
Td, | ||
Th, | ||
Thead, | ||
Tr, | ||
} from "@chakra-ui/react"; | ||
import { Web3Context } from "../context/Web3Context"; | ||
|
||
export const RpcTable = ({ rpcs, handleRpcClick }) => { | ||
const { isConnected, handleConnect } = useContext(Web3Context); | ||
|
||
return ( | ||
<TableContainer> | ||
<Table> | ||
<Thead> | ||
<Tr> | ||
<Th pl="0">RPC URL</Th> | ||
<Th></Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{rpcs.map((rpcUrl) => ( | ||
<Tr> | ||
<Td pl="0">{rpcUrl}</Td> | ||
<Td pr="0" textAlign="end"> | ||
{!isConnected ? ( | ||
<Button onClick={handleConnect}>Connect</Button> | ||
) : ( | ||
<Button onClick={() => handleRpcClick(rpcUrl)}> | ||
Add Chain | ||
</Button> | ||
)} | ||
</Td> | ||
</Tr> | ||
))} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; |
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,8 @@ | ||
import React from "react"; | ||
import { VStack } from "@chakra-ui/react"; | ||
|
||
export const StatValue = ({ children }: { children: React.ReactNode }) => ( | ||
<VStack align="start" gap="1"> | ||
{children} | ||
</VStack> | ||
); |
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,13 @@ | ||
import React from "react"; | ||
import { Badge } from "@chakra-ui/react"; | ||
import { ChainData } from "../types/chain"; | ||
|
||
export const StatusBadge = ({ status }: Pick<ChainData, "status">) => { | ||
const actualStatus = status ?? "Active"; | ||
const colorScheme = status === "deprecated" ? "yellow" : undefined; | ||
return ( | ||
<Badge textTransform="capitalize" colorScheme={colorScheme}> | ||
{actualStatus} | ||
</Badge> | ||
); | ||
}; |
Oops, something went wrong.