🔗 feat: add navigation to topup page from balance cards

- Add click-to-navigate functionality on balance cards in both Detail and TokensTable components
- Implement navigation to '/console/topup' when clicking on current balance
- Add useNavigate hook and necessary imports
- Keep consistent navigation behavior across components

Components affected:
- web/src/pages/Detail/index.js
- web/src/components/TokensTable.js
This commit is contained in:
Apple\Apple
2025-05-26 23:30:26 +08:00
parent a7c79a9e34
commit d542b529cb
3 changed files with 10 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { initVChartSemiTheme } from '@visactor/vchart-semi-theme';
import { useNavigate } from 'react-router-dom';
import {
Card,
@@ -44,6 +45,7 @@ import { useTranslation } from 'react-i18next';
const Detail = (props) => {
const { t } = useTranslation();
const navigate = useNavigate();
const { Text } = Typography;
const formRef = useRef();
let now = new Date();
@@ -452,6 +454,7 @@ const Detail = (props) => {
icon: <IconMoneyExchangeStroked size="large" />,
color: 'bg-blue-50',
avatarColor: 'blue',
onClick: () => navigate('/console/topup'),
},
{
title: t('历史消耗'),
@@ -621,6 +624,7 @@ const Detail = (props) => {
shadows='hover'
className={`${stat.color} border-0 !rounded-2xl w-full`}
headerLine={false}
onClick={stat.onClick}
>
<div className="flex items-center">
<Avatar