Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuke0x0 committed Jan 2, 2025
1 parent ae59e08 commit 217687b
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 155 deletions.
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="https://unpkg.com/react/umd/react.production.min.js" crossorigin></script>
<!-- <script src="https://unpkg.com/react/umd/react.production.min.js" crossorigin></script>-->

<script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js" crossorigin></script>
<!-- <script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js" crossorigin></script>-->

<script src="https://unpkg.com/react-bootstrap@next/dist/react-bootstrap.min.js" crossorigin></script>
<!-- <script src="https://unpkg.com/react-bootstrap@next/dist/react-bootstrap.min.js" crossorigin></script>-->
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
279 changes: 140 additions & 139 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { useState } from 'react'
import styled from 'styled-components'
import { ApolloProvider } from 'react-apollo'
import { client } from './apollo/client'
import { Route, Switch, BrowserRouter, Redirect } from 'react-router-dom'
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'
import GlobalPage from './pages/GlobalPage'
import TokenPage from './pages/TokenPage'
import PairPage from './pages/PairPage'
import Link from './components/Link'
import { useGlobalData, useGlobalChartData } from './contexts/GlobalData'
import { useGlobalChartData, useGlobalData } from './contexts/GlobalData'
import { isAddress } from './utils'
import AccountPage from './pages/AccountPage'
import AllTokensPage from './pages/AllTokensPage'
Expand All @@ -23,72 +23,72 @@ import GoogleAnalyticsReporter from './components/analytics/GoogleAnalyticsRepor
import { PAIR_BLACKLIST, TOKEN_BLACKLIST } from './constants'

const AppWrapper = styled.div`
position: relative;
width: 100%;
position: relative;
width: 100%;
`
const ContentWrapper = styled.div`
display: grid;
grid-template-columns: ${({ open }) => (open ? '220px 1fr 200px' : '220px 1fr 64px')};
@media screen and (max-width: 1400px) {
grid-template-columns: 220px 1fr;
}
@media screen and (max-width: 1080px) {
grid-template-columns: 1fr;
max-width: 100vw;
overflow: hidden;
grid-gap: 0;
}
display: grid;
grid-template-columns: ${({ open }) => (open ? '220px 1fr 200px' : '220px 1fr 64px')};
@media screen and (max-width: 1400px) {
grid-template-columns: 220px 1fr;
}
@media screen and (max-width: 1080px) {
grid-template-columns: 1fr;
max-width: 100vw;
overflow: hidden;
grid-gap: 0;
}
`

const Right = styled.div`
position: fixed;
right: 0;
bottom: 0rem;
z-index: 99;
width: ${({ open }) => (open ? '220px' : '64px')};
height: ${({ open }) => (open ? 'fit-content' : '64px')};
overflow: auto;
background-color: ${({ theme }) => theme.bg1};
@media screen and (max-width: 1400px) {
display: none;
}
position: fixed;
right: 0;
bottom: 0rem;
z-index: 99;
width: ${({ open }) => (open ? '220px' : '64px')};
height: ${({ open }) => (open ? 'fit-content' : '64px')};
overflow: auto;
background-color: ${({ theme }) => theme.bg1};
@media screen and (max-width: 1400px) {
display: none;
}
`

const Center = styled.div`
height: 100%;
z-index: 9999;
transition: width 0.25s ease;
background-color: ${({ theme }) => theme.onlyLight};
height: 100%;
z-index: 9999;
transition: width 0.25s ease;
background-color: ${({ theme }) => theme.onlyLight};
`

const BannerWrapper = styled.div`
width: 100%;
display: flex;
justify-content: center;
width: 100%;
display: flex;
justify-content: center;
`

const WarningBanner = styled.div`
background-color: #ff6871;
padding: 1.5rem;
color: white;
width: 100%;
text-align: center;
font-weight: 500;
background-color: #ff6871;
padding: 1.5rem;
color: white;
width: 100%;
text-align: center;
font-weight: 500;
`

const UrlBanner = styled.div`
background-color: #ff007a;
padding: 1rem;
color: white;
width: 100%;
text-align: center;
font-weight: 500;
background-color: #ff007a;
padding: 1rem;
color: white;
width: 100%;
text-align: center;
font-weight: 500;
`

const Decorator = styled.span`
text-decoration: underline;
text-decoration: underline;
`

/**
Expand Down Expand Up @@ -139,98 +139,99 @@ function App() {
</WarningBanner>
</BannerWrapper>
)}
{/*{globalData && Object.keys(globalData).length > 0 &&*/}
{/*globalChartData && Object.keys(globalChartData).length > 0 ? */}
{globalData &&
Object.keys(globalData).length > 0 &&
globalChartData &&
Object.keys(globalChartData).length > 0 ? (
<BrowserRouter>
<Route component={GoogleAnalyticsReporter} />
<Switch>
<Route
exacts
strict
path="/token/:tokenAddress"
render={({ match }) => {
if (
isAddress(match.params.tokenAddress.toLowerCase()) &&
!Object.keys(TOKEN_BLACKLIST).includes(match.params.tokenAddress.toLowerCase())
) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<TokenPage address={match.params.tokenAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>
<Route
exacts
strict
path="/pair/:pairAddress"
render={({ match }) => {
if (
isAddress(match.params.pairAddress.toLowerCase()) &&
!Object.keys(PAIR_BLACKLIST).includes(match.params.pairAddress.toLowerCase())
) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<PairPage pairAddress={match.params.pairAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>
<Route
exacts
strict
path="/account/:accountAddress"
render={({ match }) => {
if (isAddress(match.params.accountAddress.toLowerCase())) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AccountPage account={match.params.accountAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>

<Route path="/home">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<GlobalPage />
</LayoutWrapper>
</Route>

<Route path="/tokens">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AllTokensPage />
</LayoutWrapper>
</Route>

<Route path="/pairs">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AllPairsPage />
</LayoutWrapper>
</Route>

<Route path="/accounts">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AccountLookup />
</LayoutWrapper>
</Route>

<Redirect to="/home" />
</Switch>
</BrowserRouter>
) : (
<LocalLoader fill="true" />
)}
globalChartData ?
(
<BrowserRouter>
<Route component={GoogleAnalyticsReporter} />
<Switch>
<Route
exacts
strict
path="/token/:tokenAddress"
render={({ match }) => {
if (
isAddress(match.params.tokenAddress.toLowerCase()) &&
!Object.keys(TOKEN_BLACKLIST).includes(match.params.tokenAddress.toLowerCase())
) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<TokenPage address={match.params.tokenAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>
<Route
exacts
strict
path="/pair/:pairAddress"
render={({ match }) => {
if (
isAddress(match.params.pairAddress.toLowerCase()) &&
!Object.keys(PAIR_BLACKLIST).includes(match.params.pairAddress.toLowerCase())
) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<PairPage pairAddress={match.params.pairAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>
<Route
exacts
strict
path="/account/:accountAddress"
render={({ match }) => {
if (isAddress(match.params.accountAddress.toLowerCase())) {
return (
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AccountPage account={match.params.accountAddress.toLowerCase()} />
</LayoutWrapper>
)
} else {
return <Redirect to="/home" />
}
}}
/>

<Route path="/home">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<GlobalPage />
</LayoutWrapper>
</Route>

<Route path="/tokens">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AllTokensPage />
</LayoutWrapper>
</Route>

<Route path="/pairs">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AllPairsPage />
</LayoutWrapper>
</Route>

<Route path="/accounts">
<LayoutWrapper savedOpen={savedOpen} setSavedOpen={setSavedOpen}>
<AccountLookup />
</LayoutWrapper>
</Route>

<Redirect to="/home" />
</Switch>
</BrowserRouter>
) : (
<LocalLoader fill="true" />
)}
</AppWrapper>
</ApolloProvider>
)
Expand Down
20 changes: 12 additions & 8 deletions src/apollo/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,43 @@ const SUBGRAPH_API_KEY = process.env.REACT_APP_THE_GRAPH_API_KEY

export const client = new ApolloClient({
link: new HttpLink({
// uri: ` http://localhost:8000/subgraphs/name/uniswap-v2`
uri: `https://gateway.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/EYCKATKGBKLWvSfwvBjzfCBmGwYNdVkduYXVivCsLRFu`,

}),
cache: new InMemoryCache(),
shouldBatch: true,
shouldBatch: true
})

export const healthClient = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/index-node/graphql',
uri: 'https://api.thegraph.com/index-node/graphql'
}),
cache: new InMemoryCache(),
shouldBatch: true,
shouldBatch: true
})

export const v1Client = new ApolloClient({
link: new HttpLink({
uri: `https://gateway.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/ESnjgAG9NjfmHypk4Huu4PVvz55fUwpyrRqHF21thoLJ`,
uri: `https://gateway.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/ESnjgAG9NjfmHypk4Huu4PVvz55fUwpyrRqHF21thoLJ`
}),
cache: new InMemoryCache(),
shouldBatch: true,
shouldBatch: true
})

export const stakingClient = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/way2rach/talisman',
uri: 'https://api.thegraph.com/subgraphs/name/way2rach/talisman'
}),
cache: new InMemoryCache(),
shouldBatch: true,
shouldBatch: true
})

export const blockClient = new ApolloClient({
link: new HttpLink({
// uri: `http://localhost:8000/subgraphs/name/eth-blocks`
uri: `https://gateway.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/9A6bkprqEG2XsZUYJ5B2XXp6ymz9fNcn4tVPxMWDztYC`,

}),
cache: new InMemoryCache(),
cache: new InMemoryCache()
})
Loading

0 comments on commit 217687b

Please sign in to comment.