Skip to content

Commit

Permalink
Merge branch 'nervosnetwork:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY authored Jul 9, 2024
2 parents 6f70955 + 79df3c0 commit f145d5f
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 28 deletions.
11 changes: 7 additions & 4 deletions packages/neuron-ui/src/components/MultisigAddress/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import {
useOnLocaleChange,
isMainnet as isMainnetUtil,
shannonToCKBFormatter,
useExitOnWalletChange,
Expand Down Expand Up @@ -30,6 +29,7 @@ import {
Edit,
Confirming,
Question,
LineDownArrow,
} from 'widgets/Icons/icon'
import AttentionCloseDialog from 'widgets/Icons/Attention.png'
import { HIDE_BALANCE, NetworkType } from 'utils/const'
Expand Down Expand Up @@ -84,8 +84,7 @@ const LearnMore = React.memo(({ t }: { t: TFunction }) => (
))

const MultisigAddress = () => {
const [t, i18n] = useTranslation()
useOnLocaleChange(i18n)
const [t] = useTranslation()
useExitOnWalletChange()
const {
wallet: { id: walletId, addresses },
Expand Down Expand Up @@ -402,6 +401,7 @@ const MultisigAddress = () => {
<div className={styles.action}>
<Tooltip
tipClassName={styles.tip}
className={styles.tipContent}
tip={
<div className={styles.actionOptions}>
{(!multisigBanlances[item.fullPayload] || multisigBanlances[item.fullPayload] === '0'
Expand All @@ -424,7 +424,10 @@ const MultisigAddress = () => {
trigger="click"
showTriangle
>
<div className={styles.hoverBtn}>{t('multisig-address.table.more')}</div>
<div className={styles.hoverBtn}>
{t('multisig-address.table.more')}
<LineDownArrow className={styles.expand} />
</div>
</Tooltip>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,36 @@
padding-right: 30px;
&:hover {
color: var(--primary-color);
.expand {
path {
stroke: var(--primary-color);
}
}
}
}

.expand {
margin-left: 2px;
width: 12px;
path {
stroke: var(--secondary-text-color);
}
}

.tipContent {
&[data-tip-show='true'] {
.hoverBtn {
color: var(--primary-color);
}
.expand {
transform: rotate(180deg);
path {
stroke: var(--primary-color);
}
}
}
}

.action {
padding-right: 20px;
.tip {
Expand Down
6 changes: 2 additions & 4 deletions packages/neuron-ui/src/components/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Navigation as NavigationSubject,
Command as CommandSubject,
} from 'services/subjects'
import { useOnLocalStorageChange, useOnLocaleChange } from 'utils'
import { useOnLocalStorageChange } from 'utils'
import PageContainer from 'components/PageContainer'
import WalletSetting from 'components/WalletSetting'
import GeneralSetting from 'components/GeneralSetting'
Expand All @@ -28,9 +28,7 @@ const Settings = () => {
const dispatch = useDispatch()
const globalState = useGlobalState()
const navigate = useNavigate()
const [t, i18n] = useTranslation()

useOnLocaleChange(i18n)
const [t] = useTranslation()

useEffect(() => {
const onNavigate = (url: string) => navigate(url)
Expand Down
16 changes: 3 additions & 13 deletions packages/neuron-ui/src/components/SignAndVerify/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import { TFunction } from 'i18next'
import { useTranslation } from 'react-i18next'
import { showErrorMessage, signMessage, verifyMessage } from 'services/remote'
import { ControllerResponse } from 'services/remote/remoteApiWrapper'
import {
ErrorCode,
isSuccessResponse,
shannonToCKBFormatter,
useExitOnWalletChange,
useGoBack,
useOnLocaleChange,
} from 'utils'
import { ErrorCode, isSuccessResponse, shannonToCKBFormatter, useExitOnWalletChange, useGoBack } from 'utils'
import { useState as useGlobalState } from 'states'
import Button from 'widgets/Button'
import Balance from 'widgets/Balance'
Expand All @@ -33,15 +26,13 @@ interface PasswordDialogProps {
}

const PasswordDialog = ({ show, walletName, onCancel, onSubmit }: PasswordDialogProps) => {
const [t, i18n] = useTranslation()
const [t] = useTranslation()
const [password, setPassword] = useState('')
const [error, setError] = useState('')
const [loading, setLoading] = useState(false)

const disabled = !password || loading

useOnLocaleChange(i18n)

useEffect(() => {
if (!show) {
setPassword('')
Expand Down Expand Up @@ -131,7 +122,7 @@ const Notifications = ({ notification, onDismiss, t, failReason }: Notifications
) : null

const SignAndVerify = () => {
const [t, i18n] = useTranslation()
const [t] = useTranslation()
const [notification, setNotification] = useState<Notification>(null)
const [failReason, setFailReason] = useState<string | undefined>('')
const [showDialog, setShowDialog] = useState(true)
Expand All @@ -141,7 +132,6 @@ const SignAndVerify = () => {
const [address, setAddress] = useState('')
const { wallet } = useGlobalState()
const [isDropdownOpen, setIsDropdownOpen] = useState(false)
useOnLocaleChange(i18n)
useExitOnWalletChange()

const handlePasswordDialogOpen = useCallback(() => {
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-ui/src/containers/LockWindow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import DarkUnLockMp4 from 'widgets/Icons/dark-unlock.mp4'
import UnLockMp4 from 'widgets/Icons/unlock.mp4'
import SplitPasswordInput from 'widgets/SplitPasswordInput'
import { useTranslation } from 'react-i18next'
import { clsx, isSuccessResponse } from 'utils'
import { clsx, isSuccessResponse, useOnLocaleChange } from 'utils'
import { isDark, signMessage, unlockWindow } from 'services/remote'
import { retryUnlockWindow } from 'services/localCache'
import { MILLISECS_PER_HOUR, MILLISECS_PER_MIN, MILLISECS_PER_SEC } from 'utils/getSyncLeftTime'
Expand All @@ -34,7 +34,8 @@ const getWaitMillisecs = (retryTimes: number) => {

const LockWindow = ({ children }: { children: React.ReactNode }) => {
const dispatch = useDispatch()
const [t] = useTranslation()
const [t, i18n] = useTranslation()
useOnLocaleChange(i18n)
useEffect(() => {
getLockWindowInfo(dispatch)
}, [])
Expand Down
5 changes: 2 additions & 3 deletions packages/neuron-ui/src/containers/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useEffect, useState } from 'react'
import { useNavigate, useLocation, Outlet } from 'react-router-dom'
import { Trans, useTranslation } from 'react-i18next'
import { useState as useGlobalState, useDispatch, dismissGlobalAlertDialog } from 'states'
import { useMigrate, useOnDefaultContextMenu, useOnLocaleChange, wakeScreen } from 'utils'
import { useMigrate, useOnDefaultContextMenu, wakeScreen } from 'utils'
import AlertDialog from 'widgets/AlertDialog'
import Dialog from 'widgets/Dialog'
import Button from 'widgets/Button'
Expand All @@ -28,7 +28,7 @@ const MainContent = () => {
} = useGlobalState()
const dispatch = useDispatch()
const { networkID } = chain
const [t, i18n] = useTranslation()
const [t] = useTranslation()

const network = useMemo(() => networks.find(n => n.id === networkID), [networks, networkID])

Expand Down Expand Up @@ -74,7 +74,6 @@ const MainContent = () => {
navigate,
dispatch,
})
useOnLocaleChange(i18n)
const onContextMenu = useOnDefaultContextMenu(t)
const onCancelGlobalDialog = useCallback(() => {
dismissGlobalAlertDialog()(dispatch)
Expand Down
3 changes: 1 addition & 2 deletions packages/neuron-ui/src/containers/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { AppUpdater as AppUpdaterSubject } from 'services/subjects'
import Badge from 'widgets/Badge'
import Logo from 'widgets/Icons/Logo.png'
import { Overview, History, NervosDAO, Settings, Experimental, MenuExpand, ArrowNext } from 'widgets/Icons/icon'
import { RoutePath, clsx, isSuccessResponse, useOnLocaleChange } from 'utils'
import { RoutePath, clsx, isSuccessResponse } from 'utils'
import Tooltip from 'widgets/Tooltip'
import styles from './navbar.module.scss'

Expand Down Expand Up @@ -74,7 +74,6 @@ const Navbar = () => {
updater: { version, isUpdated },
} = neuronWallet
const [t, i18n] = useTranslation()
useOnLocaleChange(i18n)
const [isClickedSetting, setIsClickedSetting] = useState<boolean>(false)
const selectedKey = menuItems.find(item => item.key === pathname || item.children?.some(v => v.key === pathname))?.key

Expand Down

0 comments on commit f145d5f

Please sign in to comment.