diff --git a/packages/neuron-ui/public/css/fonts.css b/packages/neuron-ui/public/css/fonts.css index cac08b5ad6..f461d01884 100644 --- a/packages/neuron-ui/public/css/fonts.css +++ b/packages/neuron-ui/public/css/fonts.css @@ -18,4 +18,10 @@ font-family: 'ProximaNova-Semibold'; src: url('../fonts/ProximaNova-Semibold.otf') format('opentype'), url('../fonts/ProximaNova-Semibold.ttf') format('opentype'); -} \ No newline at end of file +} + +@font-face { + font-family: 'D-DIN-PRO'; + src: url('../fonts/D-DIN-PRO-500-Medium.otf') format('opentype'), + url('../fonts/D-DIN-PRO-500-Medium.ttf') format('opentype'); +} diff --git a/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.otf b/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.otf new file mode 100755 index 0000000000..d72d454eb9 Binary files /dev/null and b/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.otf differ diff --git a/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.ttf b/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.ttf new file mode 100755 index 0000000000..ca0abecb19 Binary files /dev/null and b/packages/neuron-ui/public/fonts/D-DIN-PRO-500-Medium.ttf differ diff --git a/packages/neuron-ui/src/components/BalanceSyncingIcon/balanceSyncIcon.module.scss b/packages/neuron-ui/src/components/BalanceSyncingIcon/balanceSyncIcon.module.scss index a1563ce800..b88f591b6c 100644 --- a/packages/neuron-ui/src/components/BalanceSyncingIcon/balanceSyncIcon.module.scss +++ b/packages/neuron-ui/src/components/BalanceSyncingIcon/balanceSyncIcon.module.scss @@ -1,55 +1,7 @@ -$arrow: 10px; +.confirm { + margin-left: 4px; -.container { - display: inline; - position: relative; - font-size: 0.75rem; - color: var(--nervos-green); - border-radius: 2px; - z-index: 1; - - svg { - width: 1rem; - height: 0.75rem; - pointer-events: none; - position: relative; - top: 1px; - } - - &::after { - display: none; - content: attr(data-content); - position: absolute; - top: calc(100% + 7px); - left: 50%; - transform: translateX(-50%); - background: #fff; - font-size: 0.75rem; - color: #000000; - padding: 10px 15px; - box-shadow: 0 0 6px rgba(0, 0, 0, 0.22); - min-width: 150px; - pointer-events: none; - } - - &::before { - z-index: 1; - display: none; - content: ''; - top: 2px; - left: 50%; - transform: translateX(-50%); - position: absolute; - border: $arrow solid transparent; - border-bottom-color: #fff; - filter: drop-shadow(0 -2px 1px rgba(0, 0, 0, 0.12)); - pointer-events: none; - } - - &:hover { - &::after, - &::before { - display: block; - } + path { + fill: #FFFFFF; } -} +} \ No newline at end of file diff --git a/packages/neuron-ui/src/components/BalanceSyncingIcon/index.tsx b/packages/neuron-ui/src/components/BalanceSyncingIcon/index.tsx index be761394e2..ce4884e44a 100644 --- a/packages/neuron-ui/src/components/BalanceSyncingIcon/index.tsx +++ b/packages/neuron-ui/src/components/BalanceSyncingIcon/index.tsx @@ -1,8 +1,6 @@ import React from 'react' -import { useTranslation } from 'react-i18next' import { ConnectionStatus, SyncStatus } from 'utils' -import { ReactComponent as BalanceSyncing } from 'widgets/Icons/BalanceSyncing.svg' -import { ReactComponent as BalanceSyncFailed } from 'widgets/Icons/BalanceSyncFailed.svg' +import { Confirming } from 'widgets/Icons/icon' import styles from './balanceSyncIcon.module.scss' export interface BalanceSyncIconProps { @@ -11,40 +9,14 @@ export interface BalanceSyncIconProps { } const BalanceSyncIcon = ({ connectionStatus, syncStatus }: BalanceSyncIconProps) => { - const [t] = useTranslation() - if (ConnectionStatus.Connecting === connectionStatus) { - return ( -
- -
- ) + if (ConnectionStatus.Connecting === connectionStatus || ConnectionStatus.Offline === connectionStatus) { + return } - if (ConnectionStatus.Offline === connectionStatus) { - return ( -
- -
- ) - } - switch (syncStatus) { - case SyncStatus.SyncNotStart: { - return ( -
- -
- ) - } - case SyncStatus.Syncing: - case SyncStatus.SyncPending: { - return ( -
- -
- ) - } - default: { + case SyncStatus.SyncCompleted: return null + default: { + return } } } diff --git a/packages/neuron-ui/src/components/Overview/index.tsx b/packages/neuron-ui/src/components/Overview/index.tsx index cb615e7eeb..d845f8fc6e 100644 --- a/packages/neuron-ui/src/components/Overview/index.tsx +++ b/packages/neuron-ui/src/components/Overview/index.tsx @@ -1,8 +1,6 @@ -import React, { useCallback, useMemo, useEffect } from 'react' -import { useNavigate } from 'react-router-dom' +import React, { useCallback, useMemo, useEffect, useState } from 'react' +import { Link } from 'react-router-dom' import { Trans, useTranslation } from 'react-i18next' -import Balance from 'components/Balance' -import PageContainer from 'components/PageContainer' import { showTransactionDetails } from 'services/remote' import { useState as useGlobalState, useDispatch, updateTransactionList } from 'states' @@ -15,13 +13,20 @@ import { backToTop, CONSTANTS, RoutePath, - getCurrentUrl, - getSyncStatus, nftFormatter, useFirstLoadApp, } from 'utils' import { UANTokenName, UANTonkenSymbol } from 'components/UANDisplay' +import PageContainer from 'components/PageContainer' +import Table from 'widgets/Table' +import { ReactComponent as Send } from 'widgets/Icons/OverviewSend.svg' +import { ReactComponent as Receive } from 'widgets/Icons/OverviewReceive.svg' +import { ReactComponent as BalanceRight } from 'widgets/Icons/BalanceRight.svg' +import { ArrowOpenRight, Confirming, PasswordHide, PasswordShow } from 'widgets/Icons/icon' +import BalanceSyncIcon from 'components/BalanceSyncingIcon' +import CopyZone from 'widgets/CopyZone' +import { HIDE_BALANCE } from 'utils/const' import styles from './overview.module.scss' const { PAGE_SIZE, CONFIRMATION_THRESHOLD } = CONSTANTS @@ -55,30 +60,159 @@ const genTypeLabel = ( } } +const TransactionStatus = ({ + item, + cacheTipBlockNumber, + bestKnownBlockNumber, +}: { + item: Omit & { status: State.Transaction['status'] | 'confirming' } + cacheTipBlockNumber: number + bestKnownBlockNumber: number +}) => { + const [t] = useTranslation() + let confirmations = '' + let { status } = item + if (item.blockNumber !== undefined) { + const confirmationCount = + item.blockNumber === null || item.status === 'failed' + ? 0 + : 1 + Math.max(cacheTipBlockNumber, bestKnownBlockNumber) - +item.blockNumber + + if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) { + status = 'confirming' + + if (confirmationCount === 1) { + confirmations = t('overview.confirmation', { + confirmationCount: localNumberFormatter(confirmationCount), + }) + } else if (confirmationCount > 1) { + confirmations = `${t('overview.confirmations', { + confirmationCount: localNumberFormatter(confirmationCount), + })}` + } + } + } + return ( +
+ {status === 'confirming' ? : null} + {t(`overview.statusLabel.${status}`)} + {confirmations ? {confirmations} : null} +
+ ) +} + +const Amount = ({ item, show }: { item: State.Transaction; show: boolean }) => { + let amount = '--' + let sudtAmount = '' + let isReceive = false + + if (item.blockNumber !== undefined) { + if (item.nftInfo) { + // NFT + const { type, data } = item.nftInfo + amount = show ? `${type === 'receive' ? '+' : '-'}${nftFormatter(data)}` : `${HIDE_BALANCE}mNFT` + isReceive = type === 'receive' + } else if (item.sudtInfo?.sUDT) { + if (item.sudtInfo.sUDT.decimal) { + sudtAmount = sUDTAmountFormatter(sudtValueToAmount(item.sudtInfo.amount, item.sudtInfo.sUDT.decimal)) + } + } else { + amount = show ? `${shannonToCKBFormatter(item.value, true)} CKB` : `${HIDE_BALANCE} CKB` + isReceive = !amount.includes('-') + } + } + return sudtAmount ? ( + <> + {show ? sudtAmount : HIDE_BALANCE}  + + + ) : ( + {amount} + ) +} + +const TracsactionType = ({ + item, + cacheTipBlockNumber, + bestKnownBlockNumber, +}: { + item: Omit & { status: State.Transaction['status'] | 'confirming' } + cacheTipBlockNumber: number + bestKnownBlockNumber: number +}) => { + const [t] = useTranslation() + let typeLabel: string = '--' + let { status } = item + let typeTransProps: { + i18nKey: string + components: JSX.Element[] + } = { + i18nKey: '', + components: [], + } + + if (item.blockNumber !== undefined) { + const confirmationCount = + item.blockNumber === null || item.status === 'failed' + ? 0 + : 1 + Math.max(cacheTipBlockNumber, bestKnownBlockNumber) - +item.blockNumber + + if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) { + status = 'confirming' + } + if (item.nftInfo) { + // NFT + const { type } = item.nftInfo + typeLabel = `${t(`overview.${genTypeLabel(type, status)}`)}` + } else if (item.sudtInfo?.sUDT) { + // Asset Account + if (['create', 'destroy'].includes(item.type)) { + // create/destroy an account + typeTransProps = { + i18nKey: `overview.${item.type}SUDT`, + components: [ + , + ], + } + } else { + // send/receive to/from an account + const type = +item.sudtInfo.amount <= 0 ? 'send' : 'receive' + typeLabel = `UDT ${t(`overview.${genTypeLabel(type, status)}`)}` + } + } else if (item.type === 'create' || item.type === 'destroy') { + // normal tx + if (item.assetAccountType === 'CKB') { + typeLabel = `${t(`overview.${item.type}`, { name: 'CKB' })}` + } else { + typeLabel = `${t(`overview.${item.type}`, { name: 'Unknown' })}` + } + } else { + typeLabel = item.nervosDao ? 'Nervos DAO' : t(`overview.${genTypeLabel(item.type, status)}`) + } + } + return typeTransProps.i18nKey ? : <>{typeLabel} +} + const Overview = () => { const { app: { pageNotice }, wallet: { id, balance = '' }, chain: { - syncState: { cacheTipBlockNumber, bestKnownBlockNumber, bestKnownBlockTimestamp }, + syncState: { cacheTipBlockNumber, bestKnownBlockNumber, syncStatus }, transactions: { items = [] }, connectionStatus, - networkID, }, - settings: { networks }, } = useGlobalState() const dispatch = useDispatch() const [t] = useTranslation() - const navigate = useNavigate() - useFirstLoadApp(dispatch) - - const syncStatus = getSyncStatus({ - bestKnownBlockNumber, - bestKnownBlockTimestamp, - cacheTipBlockNumber, - currentTimestamp: Date.now(), - url: getCurrentUrl(networkID, networks), - }) useEffect(() => { if (id) { @@ -94,14 +228,10 @@ const Overview = () => { walletID: id, })(dispatch) }, [id, dispatch]) - const onGoToHistory = useCallback(() => { - navigate(RoutePath.History) - }, [navigate]) - const onRecentActivityDoubleClick = useCallback((e: React.SyntheticEvent) => { - const cellElement = e.target as HTMLTableCellElement - if (cellElement?.parentElement?.dataset?.hash) { - showTransactionDetails(cellElement.parentElement.dataset.hash) + const onRecentActivityDoubleClick = useCallback((_, item: State.Transaction) => { + if (item?.hash) { + showTransactionDetails(item?.hash) } }, []) @@ -109,190 +239,103 @@ const Overview = () => { return items.slice(0, 10) }, [items]) - const RecentActivites = useMemo(() => { - const activities = recentItems.map(item => { - let confirmations = '' - let typeLabel: string = '--' - let amount = '--' - let amountValue = '' - let { status } = item - let typeTransProps: { - i18nKey: string - components: JSX.Element[] - } = { - i18nKey: '', - components: [], - } - - if (item.blockNumber !== undefined) { - const confirmationCount = - item.blockNumber === null || item.status === 'failed' - ? 0 - : 1 + Math.max(cacheTipBlockNumber, bestKnownBlockNumber) - +item.blockNumber - - if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) { - status = 'confirming' as any - - if (confirmationCount === 1) { - confirmations = t('overview.confirmation', { - confirmationCount: localNumberFormatter(confirmationCount), - }) - } else if (confirmationCount > 1) { - confirmations = `${t('overview.confirmations', { - confirmationCount: localNumberFormatter(confirmationCount), - })}` - } - } - - if (item.nftInfo) { - // NFT - const { type, data } = item.nftInfo - typeLabel = `${t(`overview.${genTypeLabel(type, status)}`)}` - amount = `${type === 'receive' ? '+' : '-'}${nftFormatter(data)}` - } else if (item.sudtInfo?.sUDT) { - // Asset Account - if (['create', 'destroy'].includes(item.type)) { - // create/destroy an account - typeTransProps = { - i18nKey: `overview.${item.type}SUDT`, - components: [ - , - ], - } - } else { - // send/receive to/from an account - const type = +item.sudtInfo.amount <= 0 ? 'send' : 'receive' - typeLabel = `UDT ${t(`overview.${genTypeLabel(type, status)}`)}` - } - if (item.sudtInfo.sUDT.decimal) { - amount = `${sUDTAmountFormatter(sudtValueToAmount(item.sudtInfo.amount, item.sudtInfo.sUDT.decimal))} ${ - item.sudtInfo.sUDT.symbol - }` - amountValue = sUDTAmountFormatter(sudtValueToAmount(item.sudtInfo.amount, item.sudtInfo.sUDT.decimal)) - } - } else { - // normal tx - amount = `${shannonToCKBFormatter(item.value)} CKB` - if (item.type === 'create' || item.type === 'destroy') { - if (item.assetAccountType === 'CKB') { - typeLabel = `${t(`overview.${item.type}`, { name: 'CKB' })}` - } else { - typeLabel = `${t(`overview.${item.type}`, { name: 'Unknown' })}` - } - } else { - typeLabel = item.nervosDao ? 'Nervos DAO' : t(`overview.${genTypeLabel(item.type, status)}`) - } - } - } - - return { - ...item, - status, - statusLabel: t(`overview.statusLabel.${status}`), - amount, - confirmations, - typeLabel, - amountValue, - typeTransProps, - } - }) - return ( -
- - - - {['date', 'type', 'amount', 'status'].map(field => { - const title = t(`overview.${field}`) - return ( - - ) - })} - - - - {activities.map(item => { - const { - confirmations, - createdAt, - status, - hash, - statusLabel, - timestamp, - typeLabel, - amount, - typeTransProps, - amountValue, - sudtInfo, - } = item - const time = uniformTimeFormatter(timestamp || createdAt) + useFirstLoadApp(dispatch) - return ( - - - {typeTransProps.i18nKey ? ( - - ) : ( - - )} - {amountValue ? ( - - ) : ( - - )} - - - ) - })} - -
- {title} -
{time.split(' ')[0]} - - {typeLabel} - {amountValue}  - - {amount} -
- {statusLabel} - {confirmations ? {confirmations} : null} -
-
-
- ) - }, [recentItems, cacheTipBlockNumber, bestKnownBlockNumber, t, onRecentActivityDoubleClick]) + const [showBalance, setShowBalance] = useState(true) + const onChangeShowBalance = useCallback(() => { + setShowBalance(v => !v) + }, [setShowBalance]) return ( -
-

{t('navbar.overview')}

+
- + + {t('overview.balance')} + {showBalance && } + {!!showBalance || } + + + {showBalance ? shannonToCKBFormatter(balance) : HIDE_BALANCE} + + CKB + +
- -

{t('overview.recent-activities')}

- {items.length ? ( - <> - {RecentActivites} - {items.length > 10 ? ( -
- {}} tabIndex={0}> - {t('overview.more')} - -
- ) : null} - - ) : ( -
{t('overview.no-recent-activities')}
- )} + + +
{t('overview.send')}
+ + + +
{t('overview.receive')}
+
+ +

{t('overview.recent-activities')}

+ {items.length > 10 && ( + + {t('overview.more')} + + + )} + + } + columns={[ + { + title: t('overview.date'), + dataIndex: 'date', + align: 'left', + render: (_, __, item) => { + const time = uniformTimeFormatter(item.timestamp || item.createdAt) + return time.split(' ')[0] + }, + }, + { + title: t('overview.type'), + dataIndex: 'type', + align: 'left', + render(_, __, item) { + return ( + + ) + }, + }, + { + title: t('overview.amount'), + dataIndex: 'amount', + align: 'left', + isBalance: true, + render(_, __, item, show) { + return + }, + }, + { + title: t('overview.status'), + dataIndex: 'status', + align: 'left', + className: styles.txStatusTh, + render(_, __, item) { + return ( + + ) + }, + }, + ]} + dataSource={recentItems} + noDataContent={t('overview.no-recent-activities')} + onRowDoubleClick={onRecentActivityDoubleClick} + /> ) } diff --git a/packages/neuron-ui/src/components/Overview/overview.module.scss b/packages/neuron-ui/src/components/Overview/overview.module.scss index 140b41296b..13e95aee6a 100644 --- a/packages/neuron-ui/src/components/Overview/overview.module.scss +++ b/packages/neuron-ui/src/components/Overview/overview.module.scss @@ -1,182 +1,111 @@ @import '../../styles/mixin.scss'; +@import '../../styles/theme.scss'; -$success-color: #3cc68a; -$failed-color: #d50000; -$pending-color: #b3b3b3; -$confirming-color: #b3b3b3; - -.overview { +.mid { + height: 200px; display: grid; grid-template: - 'page-title page-title' auto - 'balance balance' auto - 'activities-title activities-title' auto - 'activities activities' auto - 'more-link more-link' auto/ - 1fr auto; -} - -.pageTitle, -.recentActivitiesTitle { - @include bold-text; - font-size: 1.375rem; - color: #000; - margin: 0; -} - -.pageTitle { - @include page-title; - grid-area: page-title; -} - -.recentActivitiesTitle { - grid-area: activities-title; - margin-top: 20px; - margin-bottom: 10px; - font-size: 1rem; - font-weight: 500; -} - -.balance { - grid-area: balance; - display: flex; - align-items: center; - font-size: 1.25rem; - font-weight: 600; -} - -.recentActivities { - grid-area: activities; - padding: 0px 11px 16px; - background-color: #fff; - - table { - border-collapse: collapse; - width: 100%; - table-layout: fixed; - } - - tr { - height: 46px; - border-bottom: 1px solid #b3b3b3; - padding: 0 15px; - } - - tbody { - tr:hover { - background-color: #eee; + 'balance send receive' 200px / + 2fr 1fr 1fr; + grid-column-gap: 16px; + margin-bottom: 16px; + .balance { + grid-area: balance; + border-radius: 16px; + background-color: #26C786; + position: relative; + padding: 24px 16px; + color: var(--primary-text-color); + + & > .backgroundImg { + position: absolute; + top: 0px; + right: 0px; } - } - th { - text-align: left; - font-size: 0.75rem; - font-weight: 600; - color: #000; - line-height: 1em; - padding: 16px 0; - - &[data-field='date'] { - width: 100px; + & > .copyBalance { + .balanceValue { + font-family: 'D-DIN-PRO'; + font-weight: 500; + font-size: 36px; + } } - &[data-field='status'] { - width: 130px; + + & > .balanceUnit { + font-size: 16px; + font-weight: 500; + margin-left: 8px; } - } - td { - font-size: 0.875rem; - line-height: 1em; - padding: 8px 2px; - color: #000; - white-space: nowrap; - } + & > .balanceTitle { + font-weight: 500; + font-size: 16px; + display: flex; + align-items: center; + margin-bottom: 36px; - .tokenName { - max-width: 50%; - display: inline-flex; - line-height: 24px; + & > svg { + margin-left: 8px; - &::after { - min-width: 300px; - } - & > span { - max-width: 100%; + path { + fill: var(--svg-fill-color); + } + } } } - - .symbol { - max-width: 90%; - display: inline-flex; - - &::after { - max-width: 400px; - } + .send { + grid-area: send; + } + .receive { + grid-area: receive; } - .txStatus { - & > div::after { - position: absolute; - display: block; - content: ''; - border-radius: 50%; - width: 8px; - height: 8px; - left: 0; - top: 50%; - transform: translateY(-50%); - } - - &[data-status='pending'] > div::after { - background-color: $pending-color; - filter: drop-shadow(0 0 1px $pending-color); - animation: blink 5s infinite; - } - - &[data-status='confirming'] > div::after { - background-color: $pending-color; - filter: drop-shadow(0 0 1px $pending-color); - animation: blink 5s infinite; - } - - &[data-status='success'] > div::after { - background-color: $success-color; - filter: drop-shadow(0 0 1px $success-color); - } - - &[data-status='failed'] > div::after { - background-color: $failed-color; - filter: drop-shadow(0 0 1px $failed-color); + & > a { + border: none; + background: var(--secondary-background-color); + border-radius: 16px; + font-size: 16px; + font-weight: 500; + color: var(--primary-color); + text-align: center; + padding-top: 48px; + + @media (prefers-color-scheme: dark) { + & > svg { + :first-child { + fill: var(--primary-color); + } + :not(:first-child) { + fill: #14221C; + } + } } + } +} - & > div { - display: flex; - flex-direction: column; - position: relative; - padding-left: 20px; +.txStatusTh { + padding-left: 34px !important; +} - & > span:first-child { - flex: 1; - } +.txStatus { + display: flex; + position: relative; + padding-left: 16px; + align-items: center; - & > span:nth-child(2) { - color: #626262; - font-size: 0.625rem; - line-height: 0.8125rem; - margin-top: 3px; - } - } + .confirmText { + color: #999; + font-size: 12px; + margin-left: 4px; } -} -.linkToHistory { - grid-area: more-link; - font-size: 0.75rem; - color: #000; - margin-top: 13px; + .confirm { + position: absolute; + left: -4px; + } - & > span:hover { - color: var(--nervos-green); + &[data-status="failed"] { + color: #FF1E1E; } } @@ -196,3 +125,39 @@ $confirming-color: #b3b3b3; opacity: 1; } } + +.transactionTablleHead { + display: flex; + padding: 18px 16px; + justify-content: space-between; + align-items: center; + + .recentActivitiesTitle { + font-weight: 500; + font-size: 16px; + color: var(--main-text-color); + margin: 0; + } + + .linkToHistory { + font-size: 14px; + color: #8DA394; + cursor: pointer; + + &:hover { + color: var(--activity-color); + + & > svg > path { + stroke: var(--activity-color); + } + } + + & > svg { + margin-left: 4px; + } + } +} + +.isReceive { + color: $main-color; +} diff --git a/packages/neuron-ui/src/components/PageContainer/index.tsx b/packages/neuron-ui/src/components/PageContainer/index.tsx index 6debba269d..af006c8c9e 100755 --- a/packages/neuron-ui/src/components/PageContainer/index.tsx +++ b/packages/neuron-ui/src/components/PageContainer/index.tsx @@ -139,7 +139,7 @@ const PageContainer: React.FC = props => { )} - {children} +
{children}
) } diff --git a/packages/neuron-ui/src/components/PageContainer/pageContainer.module.scss b/packages/neuron-ui/src/components/PageContainer/pageContainer.module.scss index db6fd8deb1..9b85f459bf 100755 --- a/packages/neuron-ui/src/components/PageContainer/pageContainer.module.scss +++ b/packages/neuron-ui/src/components/PageContainer/pageContainer.module.scss @@ -1,11 +1,15 @@ .page { background: var(--main-background-color); color: var(--main-text-color); - padding: 0 24px 24px; + padding: 0 24px; position: relative; + display: flex; + flex-direction: column; + height: 100vh; .head { display: flex; + flex: 0 0 auto; align-items: center; height: 72px; margin: 0; @@ -76,6 +80,7 @@ } .syncNotification { + flex: 0 0 auto; background: var(--warn-background-color); border-radius: 16px; padding: 10px 0; @@ -99,4 +104,9 @@ transform: translateY(-50%); cursor: pointer; } -} \ No newline at end of file +} + +.body { + flex: 1 1 auto; + padding-bottom: 24px; +} diff --git a/packages/neuron-ui/src/styles/index.scss b/packages/neuron-ui/src/styles/index.scss index fbe0292a43..1e3be0d41f 100755 --- a/packages/neuron-ui/src/styles/index.scss +++ b/packages/neuron-ui/src/styles/index.scss @@ -14,6 +14,11 @@ [type='submit'], button { -webkit-appearance: none !important; + color: inherit; +} + +a { + text-decoration: none; } ul { diff --git a/packages/neuron-ui/src/styles/theme.scss b/packages/neuron-ui/src/styles/theme.scss index 1df408a883..7a3a44b39c 100644 --- a/packages/neuron-ui/src/styles/theme.scss +++ b/packages/neuron-ui/src/styles/theme.scss @@ -42,7 +42,7 @@ body { --secondary-text-color: #8DA394; --link-color: #{$main-color}; --third-background-color: #2D3534; - --notice-background-color: rgba(255, 140, 0, 0.2); + --notice-background-color: #093F29; --notice-text-color: #F78C2A; --border-color: #343E3C; --input-border-color: #343E3C; diff --git a/packages/neuron-ui/src/utils/const.ts b/packages/neuron-ui/src/utils/const.ts index 419adb3478..31a715e29c 100644 --- a/packages/neuron-ui/src/utils/const.ts +++ b/packages/neuron-ui/src/utils/const.ts @@ -63,3 +63,5 @@ export const DEPRECATED_CODE_HASH: Record = { AcpOnLina: '0x0fb343953ee78c9986b091defb6252154e0bb51044fd2879fde5b27314506111', AcpOnAggron: '0x86a1c6987a4acbe1a887cca4c9dd2ac9fcb07405bbeda51b861b18bbf7492c4b', } + +export const HIDE_BALANCE = '******' diff --git a/packages/neuron-ui/src/widgets/CopyZone/copyZone.module.scss b/packages/neuron-ui/src/widgets/CopyZone/copyZone.module.scss index d7ec95224d..50ea5e06de 100644 --- a/packages/neuron-ui/src/widgets/CopyZone/copyZone.module.scss +++ b/packages/neuron-ui/src/widgets/CopyZone/copyZone.module.scss @@ -1,9 +1,10 @@ +@import '../../styles/theme.scss'; + .container { position: relative; display: inline-block; - padding: 0 3px; - &::before { + .hoverShow { position: absolute; top: 0; left: 0; @@ -12,17 +13,27 @@ display: none; justify-content: center; align-items: center; - content: attr(data-prompt); - font-size: 0.875rem; - font-weight: 500; - color: #666; - background-color: rgba(224, 224, 224, 0.9); + font-weight: 400; + color: $main-color; + background-color: rgba(0, 0, 0, 0.8); backdrop-filter: blur(1px); user-select: none; white-space: nowrap; + border-radius: 16px; + + & > svg { + margin-right: 4px; + } } - &:hover::before { - display: flex; + &:hover { + padding-right: 14px; + .hoverShow { + display: flex; + } + + .copyIcon { + visibility: visible; + } } } diff --git a/packages/neuron-ui/src/widgets/CopyZone/index.tsx b/packages/neuron-ui/src/widgets/CopyZone/index.tsx index 72852312e3..c5b275de96 100644 --- a/packages/neuron-ui/src/widgets/CopyZone/index.tsx +++ b/packages/neuron-ui/src/widgets/CopyZone/index.tsx @@ -1,5 +1,6 @@ import React, { useState, useCallback, useRef } from 'react' import { useTranslation } from 'react-i18next' +import { Copy, SuccessNoBorder } from 'widgets/Icons/icon' import styles from './copyZone.module.scss' type CopyZoneProps = React.PropsWithChildren<{ @@ -27,12 +28,15 @@ const CopyZone = ({ children, content, name, style, className = '' }: CopyZonePr
+
+ {copied ? : } + {prompt} +
{children}
) diff --git a/packages/neuron-ui/src/widgets/Icons/BalanceRight.svg b/packages/neuron-ui/src/widgets/Icons/BalanceRight.svg new file mode 100755 index 0000000000..dfd822b136 --- /dev/null +++ b/packages/neuron-ui/src/widgets/Icons/BalanceRight.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/packages/neuron-ui/src/widgets/Icons/OverviewReceive.svg b/packages/neuron-ui/src/widgets/Icons/OverviewReceive.svg new file mode 100755 index 0000000000..550f4b59af --- /dev/null +++ b/packages/neuron-ui/src/widgets/Icons/OverviewReceive.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/neuron-ui/src/widgets/Icons/OverviewSend.svg b/packages/neuron-ui/src/widgets/Icons/OverviewSend.svg new file mode 100755 index 0000000000..da9c312d81 --- /dev/null +++ b/packages/neuron-ui/src/widgets/Icons/OverviewSend.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/neuron-ui/src/widgets/Icons/SuccessNoBorder.svg b/packages/neuron-ui/src/widgets/Icons/SuccessNoBorder.svg new file mode 100755 index 0000000000..f58789c7a1 --- /dev/null +++ b/packages/neuron-ui/src/widgets/Icons/SuccessNoBorder.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/neuron-ui/src/widgets/Icons/icon.tsx b/packages/neuron-ui/src/widgets/Icons/icon.tsx index e92c4be2ae..6937950aba 100644 --- a/packages/neuron-ui/src/widgets/Icons/icon.tsx +++ b/packages/neuron-ui/src/widgets/Icons/icon.tsx @@ -27,6 +27,7 @@ import { ReactComponent as TooltipSvg } from './Tooltip.svg' import { ReactComponent as OpenFolderSvg } from './OpenFolder.svg' import { ReactComponent as SuccessInfoSvg } from './SuccessInfo.svg' import { ReactComponent as ErrorSvg } from './Error.svg' +import { ReactComponent as SuccessNoBorderSvg } from './SuccessNoBorder.svg' import { ReactComponent as LoadingSvg } from './Loading.svg' import { ReactComponent as AttentionSvg } from './ExperimentalAttention.svg' import { ReactComponent as AttentionOutlineSvg } from './AttentionOutline.svg' @@ -43,6 +44,7 @@ import { ReactComponent as MenuExpandSvg } from './MenuExpand.svg' import { ReactComponent as ArrowEndSvg } from './ArrowEnd.svg' import { ReactComponent as ArrowNextSvg } from './ArrowNext.svg' import { ReactComponent as ConfirmingSvg } from './Confirming.svg' +import { ReactComponent as CopySvg } from './Copy.svg' import styles from './icon.module.scss' @@ -100,3 +102,5 @@ export const MenuExpand = WrapSvg(MenuExpandSvg) export const ArrowEnd = WrapSvg(ArrowEndSvg) export const ArrowNext = WrapSvg(ArrowNextSvg) export const Confirming = WrapSvg(ConfirmingSvg) +export const SuccessNoBorder = WrapSvg(SuccessNoBorderSvg) +export const Copy = WrapSvg(CopySvg)