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

Console: Cache chain id on refresh, add alt for logo #179

Merged
merged 1 commit into from
Nov 3, 2020
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
9 changes: 7 additions & 2 deletions packages/govern-console/src/Providers/ChainId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import React, {
useState,
useMemo,
} from 'react'
import env from '../environment'

const CHAIN_ID = 'ARAGON_CONSOLE_CHAIN_ID'

type ChainIdContextProps = {
chainId: number
Expand All @@ -29,11 +30,15 @@ type ChainIdProviderProps = {
}

export default function ChainIdProvider({ children }: ChainIdProviderProps) {
const [chainId, setChainId] = useState(Number(env('CHAIN_ID')))
const [chainId, setChainId] = useState(
// Always default to rinkeby if there's no chain id cached
Number(localStorage.getItem(CHAIN_ID)) || 4,
)

const handleChangeChainId = useCallback(
chainId => {
setChainId(Number(chainId))
localStorage.setItem(CHAIN_ID, String(chainId))
},
[setChainId],
)
Expand Down
2 changes: 1 addition & 1 deletion packages/govern-console/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Header() {
align-items: center;
`}
>
<img src={AragonSvg} width="36" />
<img src={AragonSvg} width="36" alt="Grey Eagle Aragon logo"/>
<h1
css={`
flex-grow: 1;
Expand Down