mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* add custom network * created announcement banner * add custom network from banner * show ADD CUSTOM NETWORK on MetaMask provider * show add ocean to wallet action * removed warningPolygon from alert * removed customNetwork component * remove Add custom network on asset details page * Details use function from web3 to add token * changed available on Polygon link, refactoring * show Switch to Polygon when no wallet connected * banner content for no provider and Polygon network * change message when not provider and eth network * changed warning and added announcement in site.json * moved network logic inside Announcement, moved Announcement component * added switch to ETH button, refactoring * removed add mOcean action button * moved location verification to App.tsx * styling & copy updates Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import React, { ReactElement } from 'react'
|
|
import Footer from './organisms/Footer'
|
|
import Header from './organisms/Header'
|
|
import Styles from '../global/Styles'
|
|
import styles from './App.module.css'
|
|
import { useSiteMetadata } from '../hooks/useSiteMetadata'
|
|
import Alert from './atoms/Alert'
|
|
import { graphql, PageProps, useStaticQuery } from 'gatsby'
|
|
import { useAccountPurgatory } from '../hooks/useAccountPurgatory'
|
|
import AnnouncementBanner from './molecules/AnnouncementBanner'
|
|
import { useWeb3 } from '../providers/Web3'
|
|
|
|
const contentQuery = graphql`
|
|
query AppQuery {
|
|
purgatory: allFile(filter: { relativePath: { eq: "purgatory.json" } }) {
|
|
edges {
|
|
node {
|
|
childContentJson {
|
|
account {
|
|
title
|
|
description
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export default function App({
|
|
children,
|
|
...props
|
|
}: {
|
|
children: ReactElement
|
|
}): ReactElement {
|
|
const data = useStaticQuery(contentQuery)
|
|
const purgatory = data.purgatory.edges[0].node.childContentJson.account
|
|
|
|
const { warning } = useSiteMetadata()
|
|
const { accountId } = useWeb3()
|
|
const { isInPurgatory, purgatoryData } = useAccountPurgatory(accountId)
|
|
|
|
return (
|
|
<Styles>
|
|
<div className={styles.app}>
|
|
{!location.pathname.includes('/asset/did') && <AnnouncementBanner />}
|
|
<Header />
|
|
{(props as PageProps).uri === '/' && (
|
|
<Alert text={warning.main} state="info" />
|
|
)}
|
|
{isInPurgatory && (
|
|
<Alert
|
|
title={purgatory.title}
|
|
badge={`Reason: ${purgatoryData?.reason}`}
|
|
text={purgatory.description}
|
|
state="error"
|
|
/>
|
|
)}
|
|
<main className={styles.main}>{children}</main>
|
|
<Footer />
|
|
</div>
|
|
</Styles>
|
|
)
|
|
}
|