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

fix: Fix network type label #2811

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 18 additions & 1 deletion packages/neuron-ui/src/components/NetworkSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ import { useOnWindowResize, useToggleChoiceGroupBorder } from 'utils'
import { LIGHT_CLIENT_TESTNET } from 'utils/const'
import styles from './networkSetting.module.scss'

const getNetworkLabelI18nkey = (type: 'ckb' | 'ckb_testnet' | 'ckb_dev' | string) => {
switch (type) {
case 'ckb': {
return 'settings.network.mainnet'
}
case 'ckb_testnet': {
return 'settings.network.testnet'
}
case LIGHT_CLIENT_TESTNET: {
return 'settings.network.lightTestnet'
}
default: {
return 'settings.network.devnet'
}
}
}

const NetworkSetting = ({ chain = chainState, settings: { networks = [] } }: State.AppWithNeuronWallet) => {
const [t] = useTranslation()
const [showEditorDialog, setShowEditorDialog] = useState(false)
Expand Down Expand Up @@ -87,7 +104,7 @@ const NetworkSetting = ({ chain = chainState, settings: { networks = [] } }: Sta
label: (
<div className={styles.networkLabel}>
<p>{`${network.name} (${network.remote})`}</p>
<div className={styles.tag}>{network.chain}</div>
<div className={styles.tag}>{t(getNetworkLabelI18nkey(network.chain))}</div>
</div>
),
suffix: (
Expand Down
25 changes: 0 additions & 25 deletions packages/neuron-ui/src/components/NetworkTypeLabel/index.tsx

This file was deleted.