fix(FinancialPanorama): 优化 loading 状态,Tabs 立即显示
- 移除 SubTabContainer 的 loading 条件渲染,Tabs 始终可见 - 各 Tab 组件内部处理 loading 状态,显示 Spinner - 传递 loading 和 loadingTab 到 componentProps - 修改 BalanceSheetTab、IncomeStatementTab、CashflowTab、 FinancialMetricsTab、MetricsCategoryTab 支持 loading 属性 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Box, VStack, HStack, Heading, Badge, Text } from '@chakra-ui/react';
|
||||
import { Box, VStack, HStack, Heading, Badge, Text, Spinner, Center } from '@chakra-ui/react';
|
||||
import { CashflowTable } from '../components';
|
||||
import type { CashflowData } from '../types';
|
||||
|
||||
export interface CashflowTabProps {
|
||||
cashflow: CashflowData[];
|
||||
loading?: boolean;
|
||||
showMetricChart: (name: string, key: string, data: unknown[], path: string) => void;
|
||||
calculateYoYChange: (value: number, period: string, data: unknown[], path: string) => { change: number; intensity: number };
|
||||
getCellBackground: (change: number, intensity: number) => string;
|
||||
@@ -20,6 +21,7 @@ export interface CashflowTabProps {
|
||||
|
||||
const CashflowTab: React.FC<CashflowTabProps> = ({
|
||||
cashflow,
|
||||
loading,
|
||||
showMetricChart,
|
||||
calculateYoYChange,
|
||||
getCellBackground,
|
||||
@@ -28,6 +30,15 @@ const CashflowTab: React.FC<CashflowTabProps> = ({
|
||||
bgColor,
|
||||
hoverBg,
|
||||
}) => {
|
||||
// 加载中状态
|
||||
if (loading && (!Array.isArray(cashflow) || cashflow.length === 0)) {
|
||||
return (
|
||||
<Center py={12}>
|
||||
<Spinner size="lg" color="#D4AF37" thickness="3px" />
|
||||
</Center>
|
||||
);
|
||||
}
|
||||
|
||||
const tableProps = {
|
||||
showMetricChart,
|
||||
calculateYoYChange,
|
||||
|
||||
Reference in New Issue
Block a user