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: hover click transaction style exception #2725

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
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ body {
}
}

&[data-is-open='true'] {
&[data-is-expand-show='true'] {
transform: rotate(90deg);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const History = () => {
return (
<ArrowOpenRightIcon
className={styles.arrow}
data-is-open={expandedRow === idx}
data-is-expand-show={expandedRow === idx}
onClick={() => handleExpandClick(idx)}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
color: var(--main-text-color);
}
}

.goBack {
margin-right: 8px;
cursor: pointer;

& path {
stroke: var(--main-text-color);
}
}

.address {
font-family: 'JetBrains Mono';
}
Expand Down
9 changes: 4 additions & 5 deletions packages/neuron-ui/src/components/HistoryDetailPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react'
import { Link, useParams } from 'react-router-dom'
import { useNavigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { scriptToAddress } from '@nervosnetwork/ckb-sdk-utils'
import { getTransaction, showErrorMessage } from 'services/remote'
Expand All @@ -10,6 +10,7 @@ import ScriptTag from 'components/ScriptTag'
import Tabs from 'widgets/Tabs'
import Table from 'widgets/Table'
import CopyZone from 'widgets/CopyZone'
import { GoBack } from 'widgets/Icons/icon'

import {
ErrorCode,
Expand All @@ -18,7 +19,6 @@ import {
uniformTimeFormatter,
shannonToCKBFormatter,
isSuccessResponse,
RoutePath,
} from 'utils'
import { HIDE_BALANCE } from 'utils/const'

Expand All @@ -37,6 +37,7 @@ const InfoItem = ({ label, value, className }: { label: string; value: React.Rea

const HistoryDetailPage = () => {
const { hash } = useParams()
const navigate = useNavigate()
const {
app: { pageNotice },
chain: { networkID },
Expand Down Expand Up @@ -216,9 +217,7 @@ const HistoryDetailPage = () => {
}}
head={
<div>
<Link className={styles.breadcrumb} to={RoutePath.History}>
{`${t('history.title')} / `}
</Link>
<GoBack className={styles.goBack} onClick={() => navigate(-1)} />
<span className={styles.breadcrumbNav}>{`${t('history.title-detail')}`}</span>
</div>
}
Expand Down
9 changes: 8 additions & 1 deletion packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useMemo, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { Link, useNavigate } from 'react-router-dom'
import { Trans, useTranslation } from 'react-i18next'
import { showTransactionDetails } from 'services/remote'
import { useState as useGlobalState, useDispatch, updateTransactionList } from 'states'
Expand Down Expand Up @@ -157,6 +157,7 @@ const Overview = () => {
} = useGlobalState()
const dispatch = useDispatch()
const [t] = useTranslation()
const navigate = useNavigate()

useEffect(() => {
if (id) {
Expand All @@ -179,6 +180,11 @@ const Overview = () => {
}
}, [])

const onRecentActivityClick = useCallback((_, item: State.Transaction) => {
const { hash } = item
navigate(`${RoutePath.HistoryDetailPage}/${hash}`)
}, [])

const recentItems = useMemo(() => {
return items.slice(0, 10)
}, [items])
Expand Down Expand Up @@ -286,6 +292,7 @@ const Overview = () => {
dataSource={recentItems}
noDataContent={t('overview.no-recent-activities')}
onRowDoubleClick={onRecentActivityDoubleClick}
onRowClick={onRecentActivityClick}
/>
</PageContainer>
)
Expand Down
12 changes: 10 additions & 2 deletions packages/neuron-ui/src/containers/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import { useLocation, NavLink, useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -74,7 +74,15 @@ const Navbar = () => {
} = neuronWallet
const [t, i18n] = useTranslation()
useOnLocaleChange(i18n)
const selectedKey = menuItems.find(item => item.key === pathname || item.children?.some(v => v.key === pathname))?.key
const [selectedKey, setSelectedKey] = useState<string>()
const computedKey = menuItems.find(item => item.key === pathname || item.children?.some(v => v.key === pathname))?.key

useEffect(() => {
if (computedKey) {
setSelectedKey(computedKey)
}
}, [computedKey])

const [menuExpanded, setMenuExpanded] = useState(true)
const onClickExpand = useCallback(() => {
setMenuExpanded(v => !v)
Expand Down
4 changes: 4 additions & 0 deletions packages/neuron-ui/src/widgets/Icons/GoBack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/neuron-ui/src/widgets/Icons/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { ReactComponent as ExplorerIconSvg } from './ExplorerIcon.svg'
import { ReactComponent as DetailIconSvg } from './DetailIcon.svg'
import { ReactComponent as CheckUpdateIconSvg } from './CheckUpdateIcon.svg'
import { ReactComponent as LanguageSelectSvg } from './LanguageSelect.svg'
import { ReactComponent as GoBackSvg } from './GoBack.svg'

import styles from './icon.module.scss'

Expand Down Expand Up @@ -140,3 +141,4 @@ export const EyesClose = WrapSvg(EyesCloseSvg)
export const Success = WrapSvg(SuccessSvg)
export const CheckUpdateIcon = WrapSvg(CheckUpdateIconSvg)
export const LanguageSelect = WrapSvg(LanguageSelectSvg)
export const GoBack = WrapSvg(GoBackSvg)
5 changes: 4 additions & 1 deletion packages/neuron-ui/src/widgets/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ const Table = <T extends Record<string, any>>(props: TableProps<T>) => {
key={dataKey ? item[dataKey] : idx}
className={styles.trClassName}
data-idx={idx}
data-is-expand={expandedRow === idx}
>
{columnList.map(({ dataIndex, key, render, align, className: bodyTdClassName, tdClassName }) => (
<td
align={align ?? 'left'}
key={key ?? dataIndex}
className={`${tdClassName ?? bodyTdClassName} ${expandedRow === idx ? styles.noBorder : ''}`}
className={`${tdClassName ?? bodyTdClassName} ${
expandedRow === idx && rowExtendRender ? styles.noBorder : ''
}`}
>
{render ? render(item[dataIndex], idx, item, showBalance) : item[dataIndex]}
</td>
Expand Down
10 changes: 10 additions & 0 deletions packages/neuron-ui/src/widgets/Table/table.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ $head-height: 52px;
tr {
height: 58px;
cursor: pointer;
&:hover {
&[data-is-expand='false'] {
background-color: var(--hover-background-color);
}
}
&:last-child {
td {
border-bottom: none;
}
}
}
td {
padding: 0 0 0 18px;
Expand Down