chore(StockQuoteCard): 删除未使用的组件
- 删除 CompanyInfo.tsx(未被引用) - 删除 KeyMetrics.tsx(未被引用) - 更新 index.ts 移除相关导出 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,87 +0,0 @@
|
|||||||
/**
|
|
||||||
* CompanyInfo - 公司信息原子组件
|
|
||||||
* 显示公司基本信息(成立日期、注册资本、所在地、官网、简介)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React, { memo } from 'react';
|
|
||||||
import { Box, Flex, HStack, Text, Link, Icon, Divider } from '@chakra-ui/react';
|
|
||||||
import { Calendar, Coins, MapPin, Globe } from 'lucide-react';
|
|
||||||
import { formatRegisteredCapital, formatDate } from '../../CompanyOverview/utils';
|
|
||||||
import { STOCK_CARD_THEME } from './theme';
|
|
||||||
|
|
||||||
export interface CompanyBasicInfo {
|
|
||||||
establish_date?: string;
|
|
||||||
reg_capital?: number;
|
|
||||||
province?: string;
|
|
||||||
city?: string;
|
|
||||||
website?: string;
|
|
||||||
company_intro?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CompanyInfoProps {
|
|
||||||
basicInfo: CompanyBasicInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CompanyInfo: React.FC<CompanyInfoProps> = memo(({ basicInfo }) => {
|
|
||||||
const { labelColor, valueColor, borderColor } = STOCK_CARD_THEME;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Divider borderColor={borderColor} my={4} />
|
|
||||||
<Flex gap={8}>
|
|
||||||
{/* 左侧:公司关键属性 (flex=1) */}
|
|
||||||
<Box flex="1" minWidth="0">
|
|
||||||
<HStack spacing={4} flexWrap="wrap" fontSize="14px">
|
|
||||||
<HStack spacing={1}>
|
|
||||||
<Icon as={Calendar} color={labelColor} boxSize={4} />
|
|
||||||
<Text color={labelColor}>成立:</Text>
|
|
||||||
<Text color={valueColor} fontWeight="bold">
|
|
||||||
{formatDate(basicInfo.establish_date)}
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
|
||||||
<HStack spacing={1}>
|
|
||||||
<Icon as={Coins} color={labelColor} boxSize={4} />
|
|
||||||
<Text color={labelColor}>注册资本:</Text>
|
|
||||||
<Text color={valueColor} fontWeight="bold">
|
|
||||||
{formatRegisteredCapital(basicInfo.reg_capital)}
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
|
||||||
<HStack spacing={1}>
|
|
||||||
<Icon as={MapPin} color={labelColor} boxSize={4} />
|
|
||||||
<Text color={labelColor}>所在地:</Text>
|
|
||||||
<Text color={valueColor} fontWeight="bold">
|
|
||||||
{basicInfo.province} {basicInfo.city}
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
|
||||||
<HStack spacing={1}>
|
|
||||||
<Icon as={Globe} color={labelColor} boxSize={4} />
|
|
||||||
{basicInfo.website ? (
|
|
||||||
<Link
|
|
||||||
href={basicInfo.website}
|
|
||||||
isExternal
|
|
||||||
color={valueColor}
|
|
||||||
fontWeight="bold"
|
|
||||||
_hover={{ color: labelColor }}
|
|
||||||
>
|
|
||||||
访问官网
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<Text color={valueColor}>暂无官网</Text>
|
|
||||||
)}
|
|
||||||
</HStack>
|
|
||||||
</HStack>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
{/* 右侧:公司简介 (flex=2) */}
|
|
||||||
<Box flex="2" minWidth="0" borderLeftWidth="1px" borderColor={borderColor} pl={8}>
|
|
||||||
<Text fontSize="14px" color={labelColor} noOfLines={2}>
|
|
||||||
<Text as="span" fontWeight="bold" color={valueColor}>公司简介:</Text>
|
|
||||||
{basicInfo.company_intro || '暂无'}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
</Flex>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
CompanyInfo.displayName = 'CompanyInfo';
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/**
|
|
||||||
* KeyMetrics - 关键指标原子组件
|
|
||||||
*
|
|
||||||
* 显示估值和市值相关指标:
|
|
||||||
* - 市盈率 (PE)
|
|
||||||
* - 流通市值
|
|
||||||
* - 发行总股本
|
|
||||||
* - 流通股本
|
|
||||||
* - 换手率
|
|
||||||
* - 52周波动
|
|
||||||
*
|
|
||||||
* 注意:标题由外层 GlassSection 提供
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React, { memo } from 'react';
|
|
||||||
import { VStack, HStack, Text } from '@chakra-ui/react';
|
|
||||||
import { formatPrice } from './formatters';
|
|
||||||
import { DEEP_SPACE_THEME as T } from './theme';
|
|
||||||
|
|
||||||
export interface KeyMetricsProps {
|
|
||||||
/** 市盈率 */
|
|
||||||
pe: number;
|
|
||||||
/** 流通市值(已格式化字符串) */
|
|
||||||
marketCap: string;
|
|
||||||
/** 发行总股本(亿股) */
|
|
||||||
totalShares?: number;
|
|
||||||
/** 流通股本(亿股) */
|
|
||||||
floatShares?: number;
|
|
||||||
/** 换手率(%) */
|
|
||||||
turnoverRate?: number;
|
|
||||||
/** 52周最低价 */
|
|
||||||
week52Low: number;
|
|
||||||
/** 52周最高价 */
|
|
||||||
week52High: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指标行组件 - 内部使用
|
|
||||||
*/
|
|
||||||
interface MetricRowProps {
|
|
||||||
label: string;
|
|
||||||
value: string | number;
|
|
||||||
valueColor?: string;
|
|
||||||
highlight?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MetricRow: React.FC<MetricRowProps> = ({
|
|
||||||
label,
|
|
||||||
value,
|
|
||||||
valueColor = T.textWhite,
|
|
||||||
highlight = false,
|
|
||||||
}) => (
|
|
||||||
<HStack justify="space-between" fontSize="13px">
|
|
||||||
<Text color={T.textMuted}>{label}</Text>
|
|
||||||
<Text
|
|
||||||
color={valueColor}
|
|
||||||
fontWeight={highlight ? '700' : '600'}
|
|
||||||
fontSize={highlight ? '15px' : '13px'}
|
|
||||||
textShadow={highlight ? `0 0 10px ${valueColor}40` : undefined}
|
|
||||||
>
|
|
||||||
{value}
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关键指标展示组件
|
|
||||||
*
|
|
||||||
* 纯展示组件,不包含标题
|
|
||||||
* 应由 GlassSection 包装以提供标题
|
|
||||||
*/
|
|
||||||
export const KeyMetrics: React.FC<KeyMetricsProps> = memo(({
|
|
||||||
pe,
|
|
||||||
marketCap,
|
|
||||||
totalShares,
|
|
||||||
floatShares,
|
|
||||||
turnoverRate,
|
|
||||||
week52Low,
|
|
||||||
week52High,
|
|
||||||
}) => (
|
|
||||||
<VStack align="stretch" spacing={2}>
|
|
||||||
<MetricRow
|
|
||||||
label="市盈率 (PE)"
|
|
||||||
value={pe ? pe.toFixed(2) : '-'}
|
|
||||||
valueColor={T.cyan}
|
|
||||||
highlight
|
|
||||||
/>
|
|
||||||
<MetricRow
|
|
||||||
label="流通市值"
|
|
||||||
value={marketCap || '-'}
|
|
||||||
valueColor={T.textPrimary}
|
|
||||||
highlight
|
|
||||||
/>
|
|
||||||
<MetricRow
|
|
||||||
label="发行总股本"
|
|
||||||
value={totalShares ? `${totalShares}亿股` : '-'}
|
|
||||||
/>
|
|
||||||
<MetricRow
|
|
||||||
label="流通股本"
|
|
||||||
value={floatShares ? `${floatShares}亿股` : '-'}
|
|
||||||
/>
|
|
||||||
<MetricRow
|
|
||||||
label="换手率"
|
|
||||||
value={turnoverRate !== undefined ? `${turnoverRate.toFixed(2)}%` : '-'}
|
|
||||||
valueColor={turnoverRate && turnoverRate > 5 ? T.orange : T.textWhite}
|
|
||||||
/>
|
|
||||||
<MetricRow
|
|
||||||
label="52周波动"
|
|
||||||
value={`${formatPrice(week52Low)} - ${formatPrice(week52High)}`}
|
|
||||||
/>
|
|
||||||
</VStack>
|
|
||||||
));
|
|
||||||
|
|
||||||
KeyMetrics.displayName = 'KeyMetrics';
|
|
||||||
@@ -13,9 +13,7 @@
|
|||||||
// ============================================
|
// ============================================
|
||||||
export { PriceDisplay } from './PriceDisplay';
|
export { PriceDisplay } from './PriceDisplay';
|
||||||
export { SecondaryQuote } from './SecondaryQuote';
|
export { SecondaryQuote } from './SecondaryQuote';
|
||||||
export { KeyMetrics } from './KeyMetrics';
|
|
||||||
export { MainForceInfo } from './MainForceInfo';
|
export { MainForceInfo } from './MainForceInfo';
|
||||||
export { CompanyInfo } from './CompanyInfo';
|
|
||||||
export { StockHeader } from './StockHeader';
|
export { StockHeader } from './StockHeader';
|
||||||
export { MetricRow } from './MetricRow';
|
export { MetricRow } from './MetricRow';
|
||||||
|
|
||||||
@@ -47,9 +45,7 @@ export * from './formatters';
|
|||||||
// ============================================
|
// ============================================
|
||||||
export type { PriceDisplayProps } from './PriceDisplay';
|
export type { PriceDisplayProps } from './PriceDisplay';
|
||||||
export type { SecondaryQuoteProps } from './SecondaryQuote';
|
export type { SecondaryQuoteProps } from './SecondaryQuote';
|
||||||
export type { KeyMetricsProps } from './KeyMetrics';
|
|
||||||
export type { MainForceInfoProps } from './MainForceInfo';
|
export type { MainForceInfoProps } from './MainForceInfo';
|
||||||
export type { CompanyInfoProps, CompanyBasicInfo } from './CompanyInfo';
|
|
||||||
export type { StockHeaderProps } from './StockHeader';
|
export type { StockHeaderProps } from './StockHeader';
|
||||||
export type { MetricRowProps } from './MetricRow';
|
export type { MetricRowProps } from './MetricRow';
|
||||||
export type { GlassSectionProps } from './GlassSection';
|
export type { GlassSectionProps } from './GlassSection';
|
||||||
|
|||||||
Reference in New Issue
Block a user