Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove alert #767

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions wallet-web/components/AppAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { IconButton } from '@material-ui/core'
import { Close } from '@material-ui/icons'
import { Alert, AlertProps, AlertTitle } from '@material-ui/lab'
import React, { useState } from 'react'

export const AppAlert = ({
message,
severity = 'info',
title,
}: {
message: string
severity?: AlertProps['severity']
title?: string
}) => {
const [showAlert, setShowAlert] = useState(true)

return showAlert ? (
<Alert
severity={severity}
action={
<IconButton size="small" onClick={() => setShowAlert(false)}>
<Close />
</IconButton>
}
>
<AlertTitle>{title}</AlertTitle>
{message}
</Alert>
) : null
}
20 changes: 1 addition & 19 deletions wallet-web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { useState } from 'react'
import { Alert, AlertTitle } from '@material-ui/lab'
import Head from 'next/head'
import { ThemeProvider } from '@material-ui/core/styles'
import CssBaseline from '@material-ui/core/CssBaseline'
import { theme } from '../lib/theme'
import type { AppProps } from 'next/app'
import { ValidatorClientContext } from '../contexts/ValidatorClient'
import { Close } from '@material-ui/icons'
import { IconButton } from '@material-ui/core'

import { AppAlert } from '../components/AppAlert'
// TODO: should it perhaps be pulled from some config or also user provided?
export const BONDING_CONTRACT_ADDRESS: string =
'punk10pyejy66429refv3g35g2t7am0was7yalwrzen'
Expand Down Expand Up @@ -49,21 +46,6 @@ export default function Application(props: AppProps) {
<ValidatorClientContext.Provider value={{ client, setClient }}>
<ThemeProvider theme={theme}>
<CssBaseline />
{showAlert && (
<Alert
severity="info"
action={
<IconButton size="small" onClick={() => setShowAlert(false)}>
<Close />
</IconButton>
}
>
<AlertTitle>Network maintenance</AlertTitle>
Testnet Milhon is currently down for maintenance. You may find
that certain features in the wallet do not work during this
period.
</Alert>
)}
<Component {...pageProps} />
</ThemeProvider>
</ValidatorClientContext.Provider>
Expand Down