-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
332/warning when pinata envs not set locally (#659)
* Added `localWarning` for PINATA keys * Displaying localWarning if any * Added alternative warning display: As a permanent toast notification * Refactor: Renamed WarningPopupContent `message` to `warning` * Added warning icon to toast notification * Moved localWarning from Header to state/application * Changed warning popup key to a more generic value * Removed banner with warning in favor of the popup notification
- Loading branch information
1 parent
8ae1455
commit 596abcf
Showing
6 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useContext } from 'react' | ||
import styled, { ThemeContext } from 'styled-components/macro' | ||
|
||
import { ThemedText } from 'theme' | ||
import { AutoColumn } from 'components/Column' | ||
import { AutoRow } from 'components/Row' | ||
import { AlertCircle } from 'react-feather' | ||
|
||
const RowNoFlex = styled(AutoRow)` | ||
flex-wrap: nowrap; | ||
` | ||
|
||
export function WarningPopup({ warning }: { warning: string | JSX.Element }) { | ||
const theme = useContext(ThemeContext) | ||
|
||
return ( | ||
<RowNoFlex> | ||
<div style={{ paddingRight: 16 }}> | ||
<AlertCircle color={theme.red1} size={24} /> | ||
</div> | ||
<AutoColumn gap="sm"> | ||
<ThemedText.Body fontWeight={'bold'} color={theme.danger}> | ||
{warning} | ||
</ThemedText.Body> | ||
</AutoColumn> | ||
</RowNoFlex> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ApplicationState } from '@src/state/application/reducer' | ||
import { localWarning } from 'state/application/localWarning' | ||
|
||
const popupList: ApplicationState['popupList'] = [] | ||
|
||
if (localWarning) { | ||
popupList.push({ | ||
key: 'localWarning', | ||
show: true, | ||
removeAfterMs: null, | ||
content: { | ||
warning: localWarning, | ||
}, | ||
}) | ||
} | ||
|
||
export const initialState: ApplicationState = { chainId: null, openModal: null, popupList } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PINATA_API_KEY, PINATA_SECRET_API_KEY } from 'constants/ipfs' | ||
import { isLocal } from 'utils/environments' | ||
|
||
let warningMsg | ||
|
||
if ((!PINATA_SECRET_API_KEY || !PINATA_API_KEY) && isLocal) { | ||
warningMsg = | ||
"Pinata env vars not set. Order appData upload won't work! " + | ||
'Set REACT_APP_PINATA_API_KEY and REACT_APP_PINATA_SECRET_API_KEY' | ||
} | ||
|
||
export const localWarning = warningMsg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters