Skip to content

Commit

Permalink
chore: auto detect network per environment (#473)
Browse files Browse the repository at this point in the history
* feat(detect-env): update images

* feat(detect-env): add versioning, environments, footer note
  • Loading branch information
2075 authored Nov 1, 2022
1 parent 8e2956b commit f7ad7fc
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
Empty file removed pkg/app/.env.development
Empty file.
2 changes: 1 addition & 1 deletion pkg/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gamedao-haiku/app",
"version": "0.1.0",
"version": "1.0.0-rc.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
Binary file added pkg/app/public/img/zero-blk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/app/public/img/zero-wht-mono.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pkg/app/public/svg/z-ctrl-45-wht.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 20 additions & 15 deletions pkg/app/src/constants/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,53 @@ import { Environment } from 'src/queries'

const developmentEndpoints: Endpoints = [
{
image: '/img/zero.png',
name: 'Local env',
image: '/svg/z-ctrl-45-wht.svg',
name: 'Local Testnet',
url: 'http://localhost:9080/v1/graphql',
healthCheck: 'http://localhost:9080/healthz',
chain: 'wss://localhost:9080',
},
{
image: '/svg/z-ctrl-45-wht.svg',
name: 'Rococo Parachain Testnet',
url: 'https://graph.rococo.sub.zero.io/v1/graphql',
healthCheck: 'https://graph.rococo.sub.zero.io/health',
chain: 'wss://node.rococo.sub.zero.io',
},
]

const productionEndpoints: Endpoints = [
{
image: '/img/zero.png',
name: 'Developent',
image: '/svg/z-ctrl-45-wht.svg',
name: 'Development',
url: 'https://graph.dev.sub.zero.io/v1/graphql',
healthCheck: 'https://graph.dev.sub.zero.io/health',
chain: 'wss://node.dev.sub.zero.io',
default: true,
default: ( ENVIRONMENT === Environment.Development ) ? true : false,
},
{
image: '/img/zero.png',
image: '/svg/z-ctrl-45-wht.svg',
name: 'Staging',
url: 'https://graph.stage.sub.zero.io/v1/graphql',
healthCheck: 'https://graph.stage.sub.zero.io/health',
chain: 'wss://node.stage.sub.zero.io',
default: ( ENVIRONMENT === Environment.Staging ) ? true : false,
},
{
image: '/img/zero.png',
name: 'Rococo',
url: 'https://graph.rococo.sub.zero.io/v1/graphql',
healthCheck: 'https://graph.rococo.sub.zero.io/health',
chain: 'wss://node.rococo.sub.zero.io',
},
{
image: '/img/zero.png',
image: '/svg/z-ctrl-45-wht.svg',
name: 'Mainnet',
url: 'https://graph.prod.sub.zero.io/v1/graphql',
healthCheck: 'https://graph.prod.sub.zero.io/health',
chain: 'wss://node.prod.sub.zero.io',
default: ( ENVIRONMENT === Environment.Production ) ? true : false,
},

]

export const ENDPOINTS: Endpoints =
ENVIRONMENT === Environment.Development ? [...developmentEndpoints, ...productionEndpoints] : productionEndpoints
ENVIRONMENT === Environment.Development
? [...developmentEndpoints, ...productionEndpoints]
: productionEndpoints

export const getConnectedEndpoint = () => ENDPOINTS.find((e) => e.default)

2 changes: 1 addition & 1 deletion pkg/app/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TMPProposal } from 'src/@types/proposal'
import { Environment } from 'src/queries'

export const ENVIRONMENT: Environment = (
process.env.NEXT_PUBLIC_ENVIRONMENT || 'production'
process.env.NEXT_PUBLIC_ENVIRONMENT || 'Development'
).toUpperCase() as Environment

export const sessionUpdateInterval: number = 5 * 60 * 1000
Expand Down
16 changes: 9 additions & 7 deletions pkg/app/src/layouts/default/modules/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react'
import NextLink from 'next/link'

import { ENVIRONMENT } from 'src/constants'

import { Box, Container, Grid, Link as MUILink, Stack, Typography } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import { SiDiscord, SiGithub, SiLinkedin, SiTelegram, SiTwitter } from 'react-icons/si'
import { getConnectedEndpoint } from 'src/constants/endpoints'

import { FontIcons } from 'components/Icons/icons'

const Logo = () => <img src="/svg/g-col-block.svg" height="48" />
const Logo = () => <img src="/v3/svg/GameDAO-color-v-blk.svg" height="48" />

const Link = ({ href, children }) => (
<Box>
Expand Down Expand Up @@ -113,16 +115,16 @@ export function Footer() {

<Grid container direction="column">
<Typography variant="small">
{`© 2019-${new Date().getFullYear()} `}GameDAO AG, Vaduz, Liechtenstein. Powered by Zero
Reality.
</Typography>
<Typography variant="small">
<NextLink href="/imprint">Imprint</NextLink>.{' '}
{`© 2019-${new Date().getFullYear()} `}GameDAO AG, Vaduz, Liechtenstein. Powered by{' '}
<a href="https://zero.io">Zero Reality</a>. <NextLink href="/imprint">Imprint</NextLink>.{' '}
<NextLink href="/tos">Terms + Conditions</NextLink>.
</Typography>
<Typography variant="small">
{process.env.APP_NAME} {process.env.APP_VERSION} build {process.env.BUILD_TIME}
{process.env.VERCEL_GIT_COMMIT_SHA} {process.env.VERCEL_ENV}
{' — '}
{process.env.VERCEL_GIT_COMMIT_SHA} {' — '} {process.env.VERCEL_ENV}
{' — '}
ENVIRONMENT: {ENVIRONMENT}
</Typography>
</Grid>
</Grid>
Expand Down

0 comments on commit f7ad7fc

Please sign in to comment.