refactor(icons): 迁移 views/Concept 目录图标到 lucide-react
- @chakra-ui/icons → lucide-react - react-icons → lucide-react - 处理 Box/BoxIcon 命名冲突 - 涉及 6 个组件文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,87 +27,87 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { keyframes } from '@emotion/react';
|
||||
import {
|
||||
FaLayerGroup,
|
||||
FaExpand,
|
||||
FaCompress,
|
||||
FaSync,
|
||||
FaHome,
|
||||
FaChevronRight,
|
||||
FaBrain,
|
||||
FaMicrochip,
|
||||
FaRobot,
|
||||
FaMobileAlt,
|
||||
FaCar,
|
||||
FaBolt,
|
||||
FaRocket,
|
||||
FaShieldAlt,
|
||||
FaGlobe,
|
||||
FaIndustry,
|
||||
FaShoppingCart,
|
||||
FaCoins,
|
||||
FaHeartbeat,
|
||||
FaAtom,
|
||||
FaArrowUp,
|
||||
FaArrowDown,
|
||||
FaCubes,
|
||||
FaServer,
|
||||
FaCode,
|
||||
FaMagic,
|
||||
FaEye,
|
||||
FaPlane,
|
||||
FaSatellite,
|
||||
FaBatteryFull,
|
||||
FaSolarPanel,
|
||||
FaTags,
|
||||
FaExternalLinkAlt,
|
||||
} from 'react-icons/fa';
|
||||
Layers,
|
||||
Maximize2,
|
||||
Minimize2,
|
||||
RefreshCw,
|
||||
Home,
|
||||
ChevronRight,
|
||||
Brain,
|
||||
Cpu,
|
||||
Bot,
|
||||
Smartphone,
|
||||
Car,
|
||||
Zap,
|
||||
Rocket,
|
||||
Shield,
|
||||
Globe,
|
||||
Factory,
|
||||
ShoppingCart,
|
||||
Coins,
|
||||
Heart,
|
||||
Atom,
|
||||
ArrowUp,
|
||||
ArrowDown,
|
||||
Box as BoxIcon,
|
||||
Server,
|
||||
Code,
|
||||
Sparkles,
|
||||
Eye,
|
||||
Plane,
|
||||
Satellite,
|
||||
BatteryFull,
|
||||
Sun,
|
||||
Tags,
|
||||
ExternalLink,
|
||||
} from 'lucide-react';
|
||||
import { logger } from '../../../utils/logger';
|
||||
|
||||
// 一级分类图标映射
|
||||
const LV1_ICONS = {
|
||||
'人工智能': FaBrain,
|
||||
'半导体': FaMicrochip,
|
||||
'机器人': FaRobot,
|
||||
'消费电子': FaMobileAlt,
|
||||
'智能驾驶与汽车': FaCar,
|
||||
'新能源与电力': FaBolt,
|
||||
'空天经济': FaRocket,
|
||||
'国防军工': FaShieldAlt,
|
||||
'政策与主题': FaGlobe,
|
||||
'周期与材料': FaIndustry,
|
||||
'大消费': FaShoppingCart,
|
||||
'数字经济与金融科技': FaCoins,
|
||||
'全球宏观与贸易': FaGlobe,
|
||||
'医药健康': FaHeartbeat,
|
||||
'前沿科技': FaAtom,
|
||||
'人工智能': Brain,
|
||||
'半导体': Cpu,
|
||||
'机器人': Bot,
|
||||
'消费电子': Smartphone,
|
||||
'智能驾驶与汽车': Car,
|
||||
'新能源与电力': Zap,
|
||||
'空天经济': Rocket,
|
||||
'国防军工': Shield,
|
||||
'政策与主题': Globe,
|
||||
'周期与材料': Factory,
|
||||
'大消费': ShoppingCart,
|
||||
'数字经济与金融科技': Coins,
|
||||
'全球宏观与贸易': Globe,
|
||||
'医药健康': Heart,
|
||||
'前沿科技': Atom,
|
||||
};
|
||||
|
||||
// 二级分类图标映射
|
||||
const LV2_ICONS = {
|
||||
'AI基础设施': FaServer,
|
||||
'AI模型与软件': FaCode,
|
||||
'AI应用': FaMagic,
|
||||
'半导体设备': FaCubes,
|
||||
'半导体材料': FaAtom,
|
||||
'芯片设计与制造': FaMicrochip,
|
||||
'先进封装': FaCubes,
|
||||
'人形机器人整机': FaRobot,
|
||||
'机器人核心零部件': FaCubes,
|
||||
'其他类型机器人': FaRobot,
|
||||
'智能终端': FaMobileAlt,
|
||||
'XR与空间计算': FaEye,
|
||||
'华为产业链': FaMobileAlt,
|
||||
'自动驾驶解决方案': FaCar,
|
||||
'智能汽车产业链': FaCar,
|
||||
'车路协同': FaCar,
|
||||
'新型电池技术': FaBatteryFull,
|
||||
'电力设备与电网': FaBolt,
|
||||
'清洁能源': FaSolarPanel,
|
||||
'低空经济': FaPlane,
|
||||
'商业航天': FaSatellite,
|
||||
'无人作战与信息化': FaShieldAlt,
|
||||
'海军装备': FaShieldAlt,
|
||||
'军贸出海': FaGlobe,
|
||||
'AI基础设施': Server,
|
||||
'AI模型与软件': Code,
|
||||
'AI应用': Sparkles,
|
||||
'半导体设备': BoxIcon,
|
||||
'半导体材料': Atom,
|
||||
'芯片设计与制造': Cpu,
|
||||
'先进封装': BoxIcon,
|
||||
'人形机器人整机': Bot,
|
||||
'机器人核心零部件': BoxIcon,
|
||||
'其他类型机器人': Bot,
|
||||
'智能终端': Smartphone,
|
||||
'XR与空间计算': Eye,
|
||||
'华为产业链': Smartphone,
|
||||
'自动驾驶解决方案': Car,
|
||||
'智能汽车产业链': Car,
|
||||
'车路协同': Car,
|
||||
'新型电池技术': BatteryFull,
|
||||
'电力设备与电网': Zap,
|
||||
'清洁能源': Sun,
|
||||
'低空经济': Plane,
|
||||
'商业航天': Satellite,
|
||||
'无人作战与信息化': Shield,
|
||||
'海军装备': Shield,
|
||||
'军贸出海': Globe,
|
||||
};
|
||||
|
||||
// 根据涨跌幅获取背景渐变色(涨红跌绿)
|
||||
@@ -151,10 +151,10 @@ const formatChangePercent = (value) => {
|
||||
|
||||
// 获取图标
|
||||
const getIcon = (name, level) => {
|
||||
if (level === 'lv1') return LV1_ICONS[name] || FaLayerGroup;
|
||||
if (level === 'lv2') return LV2_ICONS[name] || FaCubes;
|
||||
if (level === 'lv3') return FaCubes;
|
||||
return FaTags;
|
||||
if (level === 'lv1') return LV1_ICONS[name] || Layers;
|
||||
if (level === 'lv2') return LV2_ICONS[name] || Box;
|
||||
if (level === 'lv3') return Box;
|
||||
return Tags;
|
||||
};
|
||||
|
||||
// 从 API 返回的名称中提取纯名称
|
||||
@@ -352,7 +352,7 @@ const GlassCard = ({ item, onClick, size = 'normal' }) => {
|
||||
{/* 外链图标 */}
|
||||
{isLeafConcept && (
|
||||
<Icon
|
||||
as={FaExternalLinkAlt}
|
||||
as={ExternalLink}
|
||||
boxSize={3}
|
||||
color="whiteAlpha.500"
|
||||
/>
|
||||
@@ -372,7 +372,7 @@ const GlassCard = ({ item, onClick, size = 'normal' }) => {
|
||||
<HStack spacing={1} align="center">
|
||||
{hasChange && (isPositive || isNegative) && (
|
||||
<Icon
|
||||
as={isPositive ? FaArrowUp : FaArrowDown}
|
||||
as={isPositive ? ArrowUp : ArrowDown}
|
||||
boxSize={3}
|
||||
color={getChangeTextColor(item.avg_change_pct)}
|
||||
/>
|
||||
@@ -766,7 +766,7 @@ const HierarchyView = ({
|
||||
<Center h="400px" position="relative">
|
||||
<AuroraBackground />
|
||||
<VStack spacing={4} position="relative" zIndex={1}>
|
||||
<Icon as={FaLayerGroup} boxSize={16} color="gray.600" />
|
||||
<Icon as={Layers} boxSize={16} color="gray.600" />
|
||||
<Text color="gray.400">加载失败:{error}</Text>
|
||||
<Button
|
||||
colorScheme="purple"
|
||||
@@ -787,7 +787,7 @@ const HierarchyView = ({
|
||||
<Center h="400px" position="relative">
|
||||
<AuroraBackground />
|
||||
<VStack spacing={4} position="relative" zIndex={1}>
|
||||
<Icon as={FaLayerGroup} boxSize={16} color="gray.600" />
|
||||
<Icon as={Layers} boxSize={16} color="gray.600" />
|
||||
<Text color="gray.400">暂无层级数据</Text>
|
||||
</VStack>
|
||||
</Center>
|
||||
@@ -832,14 +832,14 @@ const HierarchyView = ({
|
||||
{breadcrumbs.map((crumb, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{index > 0 && (
|
||||
<Icon as={FaChevronRight} color="whiteAlpha.400" boxSize={3} mx={1} />
|
||||
<Icon as={ChevronRight} color="whiteAlpha.400" boxSize={3} mx={1} />
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
bg={index === breadcrumbs.length - 1 ? 'purple.500' : 'transparent'}
|
||||
color={index === breadcrumbs.length - 1 ? 'white' : 'whiteAlpha.700'}
|
||||
leftIcon={index === 0 ? <FaHome /> : undefined}
|
||||
leftIcon={index === 0 ? <Home /> : undefined}
|
||||
onClick={() => handleBreadcrumbClick(crumb, index)}
|
||||
isDisabled={index === breadcrumbs.length - 1}
|
||||
fontWeight={index === breadcrumbs.length - 1 ? 'bold' : 'medium'}
|
||||
@@ -861,7 +861,7 @@ const HierarchyView = ({
|
||||
<Tooltip label="刷新涨跌幅" placement="top">
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon={<FaSync />}
|
||||
icon={<RefreshCw />}
|
||||
onClick={handleRefreshPrice}
|
||||
isLoading={priceLoading}
|
||||
bg="whiteAlpha.100"
|
||||
@@ -876,7 +876,7 @@ const HierarchyView = ({
|
||||
<Tooltip label={isFullscreen ? '退出全屏' : '全屏'} placement="top">
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon={isFullscreen ? <FaCompress /> : <FaExpand />}
|
||||
icon={isFullscreen ? <Minimize2 /> : <Maximize2 />}
|
||||
onClick={toggleFullscreen}
|
||||
bg="whiteAlpha.100"
|
||||
color="white"
|
||||
|
||||
Reference in New Issue
Block a user