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 dashboard links to latest blocks and transactions #537

Merged
merged 1 commit into from
Jun 14, 2023
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
1 change: 1 addition & 0 deletions .changelog/537.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix dashboard links to latest blocks and transactions
10 changes: 8 additions & 2 deletions src/app/pages/DashboardPage/LatestBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import { NUMBER_OF_ITEMS_ON_DASHBOARD } from '../../config'
import { COLORS } from '../../../styles/theme/colors'
import { AppErrors } from '../../../types/errors'
import { useRequiredScopeParam } from '../../hooks/useScopeParam'
import { RouteUtils } from '../../utils/route-utils'

const limit = NUMBER_OF_ITEMS_ON_DASHBOARD

export const LatestBlocks: FC = () => {
const { t } = useTranslation()
const { network, layer } = useRequiredScopeParam()
const scope = useRequiredScopeParam()
const { network, layer } = scope
if (layer === Layer.consensus) {
throw AppErrors.UnsupportedLayer
// Listing the latest consensus blocks is not yet implemented.
Expand All @@ -31,7 +33,11 @@ export const LatestBlocks: FC = () => {
component="h3"
title={t('blocks.latest')}
action={
<Link component={RouterLink} to="blocks" sx={{ color: COLORS.brandExtraDark }}>
<Link
component={RouterLink}
to={RouteUtils.getLatestBlocksRoute(scope)}
sx={{ color: COLORS.brandExtraDark }}
>
{t('common.viewAll')}
</Link>
}
Expand Down
10 changes: 8 additions & 2 deletions src/app/pages/DashboardPage/LatestTransactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import { NUMBER_OF_ITEMS_ON_DASHBOARD } from '../../config'
import { COLORS } from '../../../styles/theme/colors'
import { AppErrors } from '../../../types/errors'
import { useRequiredScopeParam } from '../../hooks/useScopeParam'
import { RouteUtils } from '../../utils/route-utils'

const limit = NUMBER_OF_ITEMS_ON_DASHBOARD

export const LatestTransactions: FC = () => {
const { t } = useTranslation()
const { network, layer } = useRequiredScopeParam()
const scope = useRequiredScopeParam()
const { network, layer } = scope
if (layer === Layer.consensus) {
throw AppErrors.UnsupportedLayer
// Listing the latest consensus transactions is not yet supported.
Expand All @@ -31,7 +33,11 @@ export const LatestTransactions: FC = () => {
component="h3"
title={t('transactions.latest')}
action={
<Link component={RouterLink} to="transactions" sx={{ color: COLORS.brandExtraDark }}>
<Link
component={RouterLink}
to={RouteUtils.getLatestTransactionsRoute(scope)}
sx={{ color: COLORS.brandExtraDark }}
>
{t('common.viewAll')}
</Link>
}
Expand Down