8000 DAO-83 only show network settings on mainnet by yuetloo · Pull Request #1569 · aragon/client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DAO-83 only show network settings on mainnet #1569

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

Merged
merged 2 commits into from
Jul 28, 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
8 changes: 6 additions & 2 deletions src/apps/Organization/Organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
import LocalIdentityBadge from '../../components/IdentityBadge/LocalIdentityBadge'
import appIds from '../../known-app-ids'
import { getProviderString } from 'use-wallet'
import { sanitizeNetworkType, getNetworkConfig } from '../../network-config'
import {
sanitizeNetworkType,
getNetworkConfig,
isOnMainnet,
} from '../../network-config'
import { AppType, DaoAddressType } from '../../prop-types'
import { useRouting, ARAGONID_ENS_DOMAIN } from '../../routing'
import airdrop, { testTokensEnabled } from '../../testnet/airdrop'
Expand Down Expand Up @@ -106,7 +110,7 @@ const Organization = React.memo(function Organization({
const checksummedDaoAddr =
daoAddress.address && toChecksumAddress(daoAddress.address)
const enableTransactions = wallet.connected && wallet.account
const isMainnet = network.type === 'main'
const isMainnet = isOnMainnet(network.type)
const shortAddresses = layoutName !== 'large'

const organizationText = checksummedDaoAddr ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { useRouting } from '../../../routing'
import iconNetwork from '../../../assets/global-preferences-network.svg'
import iconCustomLabels from '../../../assets/global-preferences-custom-labels.svg'
import iconNotifications from '../../../assets/global-preferences-notifications.svg'
import { useWallet } from '../../../wallet'
import { isOnMainnet } from '../../../network-config'

function GlobalPreferencesButton() {
const theme = useTheme()
Expand All @@ -28,6 +30,9 @@ function GlobalPreferencesButton() {
const [opened, setOpened] = useState(false)
const containerRef = useRef()

const { networkType } = useWallet()
const isMainnet = isOnMainnet(networkType)

const handleToggle = useCallback(() => setOpened(opened => !opened), [])
const handleClose = useCallback(() => setOpened(false), [])
const handleItemClick = useCallback(
Expand Down Expand Up @@ -102,11 +107,13 @@ function GlobalPreferencesButton() {
icon={iconCustomLabels}
label="Custom labels"
/>
<Item
=> handleItemClick('network')}
icon={iconNetwork}
label="Network"
/>
{isMainnet && (
<Item
=> handleItemClick('network')}
icon={iconNetwork}
label="Network"
/>
)}
<Item
=> handleItemClick('notifications')}
icon={iconNotifications}
Expand Down
4 changes: 4 additions & 0 deletions src/network-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,7 @@ export function useNetworkConfig() {
const { networkType } = useWallet()
return getNetworkConfig(networkType)
}

export function isOnMainnet(networkType) {
return networkType === 'main'
}
20 changes: 13 additions & 7 deletions src/onboarding/Onboarding/OnboardingTopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import PropTypes from 'prop-types'
import { Button, GU, IconSettings, useTheme } from '@aragon/ui'
import AccountModule from '../../components/AccountModule/AccountModule'
import HomeButton from '../../components/HomeButton/HomeButton'
import { useWallet } from '../../wallet'
import { isOnMainnet } from '../../network-config'

function OnboardingTopBar({ status, solid }) {
const theme = useTheme()
const { networkType } = useWallet()
const isMainnet = isOnMainnet(networkType)

const handleSettingsClick = useCallback(() => {
let path = '/'
Expand Down Expand Up @@ -71,13 +75,15 @@ function OnboardingTopBar({ status, solid }) {
>
<AccountModule />
</div>
<Button
display="icon"
icon={<IconSettings />}
label="Settings"
size="medium"
>
/>
{isMainnet && (
<Button
display="icon"
icon={<IconSettings />}
label="Settings"
size="medium"
>
/>
)}
</div>
</div>
</React.Fragment>
Expand Down
0