mirror of
https://github.com/oceanprotocol/status-frontend.git
synced 2024-11-23 10:27:27 +01:00
layout & style updates
This commit is contained in:
parent
4e86f3b1c6
commit
54e872ba2d
@ -1,7 +1,28 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
module.exports = (phase, { defaultConfig }) => {
|
||||||
const nextConfig = {
|
/**
|
||||||
reactStrictMode: true,
|
* @type {import('next').NextConfig}
|
||||||
swcMinify: true,
|
*/
|
||||||
}
|
const nextConfig = {
|
||||||
|
webpack: (config, options) => {
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /\.svg$/,
|
||||||
|
issuer: /\.(tsx|ts)$/,
|
||||||
|
use: [{ loader: '@svgr/webpack', options: { icon: true } }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.gif$/,
|
||||||
|
// yay for webpack 5
|
||||||
|
// https://webpack.js.org/guides/asset-management/#loading-images
|
||||||
|
type: 'asset/resource'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
module.exports = nextConfig
|
return typeof defaultConfig.webpack === 'function'
|
||||||
|
? defaultConfig.webpack(config, options)
|
||||||
|
: config
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextConfig
|
||||||
|
}
|
||||||
|
4346
package-lock.json
generated
4346
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,8 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
|
"@svgr/webpack": "^6.5.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"next": "12.3.1",
|
"next": "12.3.1",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import '@oceanprotocol/typographies/css/ocean-typo.css'
|
||||||
import '../styles/globals.css'
|
import '../styles/globals.css'
|
||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from 'next/app'
|
||||||
|
|
||||||
|
@ -3,40 +3,33 @@ import React, { ReactElement, useEffect, useState } from 'react'
|
|||||||
import { Status, State, Summary, NetworkSummary } from '../@types'
|
import { Status, State, Summary, NetworkSummary } from '../@types'
|
||||||
import styles from '../styles/Home.module.css'
|
import styles from '../styles/Home.module.css'
|
||||||
import { getData, getNetworkSUmmary, getSummary } from '../utils/getData'
|
import { getData, getNetworkSUmmary, getSummary } from '../utils/getData'
|
||||||
import Logo from '../images/logo.svg'
|
import LogoAsset from '../images/logo.svg'
|
||||||
import Image from 'next/image'
|
|
||||||
|
function statusIcon(state: State): string {
|
||||||
|
if (state === State.Up) {
|
||||||
|
return '✅'
|
||||||
|
} else if (state === State.Down) {
|
||||||
|
return '🚨'
|
||||||
|
} else {
|
||||||
|
return '🚧'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function statusStyle(state: State) {
|
||||||
|
if (state === State.Down) {
|
||||||
|
return styles.down
|
||||||
|
} else if (state === State.Warning) {
|
||||||
|
return styles.warning
|
||||||
|
} else {
|
||||||
|
return styles.up
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function HomePage(): ReactElement {
|
export default function HomePage(): ReactElement {
|
||||||
const [network, setNetwork] = useState<string>('mainnet')
|
const [network, setNetwork] = useState('mainnet')
|
||||||
const [summary, setSummary] = useState<Summary[]>()
|
const [summary, setSummary] = useState<Summary[]>()
|
||||||
const [networks, setNetworks] = useState<NetworkSummary[]>()
|
const [networks, setNetworks] = useState<NetworkSummary[]>()
|
||||||
|
|
||||||
function statusIcon(state: State): string {
|
|
||||||
if (state === State.Up) {
|
|
||||||
return '✅'
|
|
||||||
} else if (state === State.Down) {
|
|
||||||
return '🚨'
|
|
||||||
} else {
|
|
||||||
return '🚧'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function statusStyle(state: State) {
|
|
||||||
if (state === State.Down) {
|
|
||||||
return styles.down
|
|
||||||
} else if (state === State.Warning) {
|
|
||||||
return styles.warning
|
|
||||||
} else {
|
|
||||||
return styles.up
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function networkStyle(currentNet: string) {
|
|
||||||
if (currentNet === network) {
|
|
||||||
return styles.networkSelected
|
|
||||||
} else return styles.networkUnselected
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getStatuses() {
|
async function getStatuses() {
|
||||||
const statusData = await getData()
|
const statusData = await getData()
|
||||||
@ -56,33 +49,19 @@ export default function HomePage(): ReactElement {
|
|||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</Head>
|
</Head>
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
<Image src={Logo} height="80rem" />
|
<LogoAsset className={styles.logo} />
|
||||||
{/* <img src={require('../images/logo.svg')} alt="Ocean Protocol Logo" /> */}
|
|
||||||
<h1 className={styles.title}>Ocean Status</h1>
|
<h1 className={styles.title}>Ocean Status</h1>
|
||||||
<p className={styles.description}>
|
<p className={styles.description}>
|
||||||
Current Status of Ocean Components{' '}
|
Current Status of Ocean Components{' '}
|
||||||
</p>
|
</p>
|
||||||
<div className={styles.grid}>
|
|
||||||
{networks && (
|
{networks?.map((network: NetworkSummary, i: number) => (
|
||||||
<>
|
<>
|
||||||
{networks.map((network: NetworkSummary, i: number) => (
|
<h2>{network.name}</h2>
|
||||||
<button
|
|
||||||
key={i}
|
<div className={styles.grid}>
|
||||||
className={`${styles.network} ${networkStyle(network.name)}`}
|
{summary?.map((value: Summary) => (
|
||||||
onClick={() => setNetwork(network.name)}
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
{network.name} {statusIcon(network.status)}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className={styles.grid}>
|
|
||||||
{summary && (
|
|
||||||
<>
|
|
||||||
{summary.map((value: Summary) => (
|
|
||||||
<div
|
<div
|
||||||
key={value.component}
|
key={value.component}
|
||||||
className={`${styles.card} ${statusStyle(value.status)}`}
|
className={`${styles.card} ${statusStyle(value.status)}`}
|
||||||
@ -91,9 +70,18 @@ export default function HomePage(): ReactElement {
|
|||||||
<p>{value?.status}</p>
|
<p>{value?.status}</p>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</>
|
</div>
|
||||||
)}
|
</>
|
||||||
</div>
|
// <button
|
||||||
|
// key={i}
|
||||||
|
// className={`${styles.network} ${networkStyle(network.name)}`}
|
||||||
|
// onClick={() => setNetwork(network.name)}
|
||||||
|
// >
|
||||||
|
// <span>
|
||||||
|
// {network.name} {statusIcon(network.status)}
|
||||||
|
// </span>
|
||||||
|
// </button>
|
||||||
|
))}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer className={styles.footer}></footer>
|
<footer className={styles.footer}></footer>
|
||||||
|
@ -1,38 +1,27 @@
|
|||||||
.container {
|
.container {
|
||||||
padding: 0 2rem;
|
padding: 0 2rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 40rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
font-family: 'Sharp Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
font-family: 'Sharp Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
||||||
Helvetica, Arial, sans-serif;
|
Helvetica, Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
border-top: 1px solid #eaeaea;
|
border-top: 1px solid #eaeaea;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer a {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
line-height: 1.15;
|
line-height: 1.15;
|
||||||
font-size: 4rem;
|
font-size: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title,
|
.title,
|
||||||
@ -132,8 +121,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
height: 1em;
|
fill: var(--font-color-heading);
|
||||||
margin-left: 0.5rem;
|
height: 3rem;
|
||||||
|
width: 3rem;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
@ -142,16 +133,3 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.card,
|
|
||||||
.footer {
|
|
||||||
border-color: #222;
|
|
||||||
}
|
|
||||||
.code {
|
|
||||||
background: #111;
|
|
||||||
}
|
|
||||||
.logo img {
|
|
||||||
filter: invert(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -15,7 +15,7 @@ export async function getData(): Promise<Status[][]> {
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export function getSummary(network: string, data: Status[][]): Summary[] {
|
|||||||
return summary
|
return summary
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,11 +66,12 @@ export function getNetworkSUmmary(data: Status[][]): NetworkSummary[] {
|
|||||||
networks.forEach((network) => {
|
networks.forEach((network) => {
|
||||||
const summary = getSummary(network, data)
|
const summary = getSummary(network, data)
|
||||||
let status = State.Up
|
let status = State.Up
|
||||||
summary.forEach((service) => {
|
|
||||||
|
summary?.forEach((service) => {
|
||||||
if (service.status === State.Down) return (status = State.Down)
|
if (service.status === State.Down) return (status = State.Down)
|
||||||
})
|
})
|
||||||
if (status === State.Up) {
|
if (status === State.Up) {
|
||||||
summary.forEach((service) => {
|
summary?.forEach((service) => {
|
||||||
if (service.status === State.Warning) return (status = State.Warning)
|
if (service.status === State.Warning) return (status = State.Warning)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user