refactor: 优化代码结构并修复类型问题
- 移除未使用的TabPane组件 - 修复类型定义和导入方式 - 优化mock数据源的环境变量判断逻辑 - 更新文档结构并归档旧文件 - 添加新的UI组件和Memo组件 - 调整API路径和响应处理
This commit is contained in:
@@ -42,7 +42,6 @@ import {
|
||||
} from '@ant-design/icons';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
const { Option } = Select;
|
||||
const { Search } = Input;
|
||||
const { Title, Text, Paragraph } = Typography;
|
||||
@@ -554,81 +553,68 @@ const StrategyMarketplacePage: React.FC = () => {
|
||||
</Col>
|
||||
|
||||
<Col span={24}>
|
||||
<Tabs activeKey={activeTab} onChange={setActiveTab}>
|
||||
<TabPane
|
||||
tab={<span><ShopOutlined /> Marketplace</span>}
|
||||
key="marketplace"
|
||||
>
|
||||
<Row gutter={16}>
|
||||
<Col span={6}>
|
||||
<Select
|
||||
style={{ width: '100%', marginBottom: 16 }}
|
||||
value={categoryFilter}
|
||||
onChange={setCategoryFilter}
|
||||
>
|
||||
<Option value="all">All Categories</Option>
|
||||
<Option value="PRICING">Pricing</Option>
|
||||
<Option value="ADVERTISING">Advertising</Option>
|
||||
<Option value="PRODUCT_SELECTION">Product Selection</Option>
|
||||
<Option value="INVENTORY">Inventory</Option>
|
||||
<Option value="LOGISTICS">Logistics</Option>
|
||||
<Option value="MARKETING">Marketing</Option>
|
||||
</Select>
|
||||
</Col>
|
||||
</Row>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
items={[
|
||||
{ key: 'marketplace', label: <span><ShopOutlined /> Marketplace</span>, children: (
|
||||
<>
|
||||
<Row gutter={16}>
|
||||
<Col span={6}>
|
||||
<Select
|
||||
style={{ width: '100%', marginBottom: 16 }}
|
||||
value={categoryFilter}
|
||||
onChange={setCategoryFilter}
|
||||
>
|
||||
<Option value="all">All Categories</Option>
|
||||
<Option value="PRICING">Pricing</Option>
|
||||
<Option value="ADVERTISING">Advertising</Option>
|
||||
<Option value="PRODUCT_SELECTION">Product Selection</Option>
|
||||
<Option value="INVENTORY">Inventory</Option>
|
||||
<Option value="LOGISTICS">Logistics</Option>
|
||||
<Option value="MARKETING">Marketing</Option>
|
||||
</Select>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
{filteredStrategies.length === 0 ? (
|
||||
<Empty description="No strategies found" />
|
||||
) : (
|
||||
filteredStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)}
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={<span><StarOutlined /> Featured</span>}
|
||||
key="featured"
|
||||
>
|
||||
{featuredStrategies.length === 0 ? (
|
||||
<Empty description="No featured strategies" />
|
||||
) : (
|
||||
featuredStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)}
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={<span><FireOutlined /> Trending</span>}
|
||||
key="trending"
|
||||
>
|
||||
{trendingStrategies.length === 0 ? (
|
||||
<Empty description="No trending strategies" />
|
||||
) : (
|
||||
trendingStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)}
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={<span><BulbOutlined /> Recommendations</span>}
|
||||
key="recommendations"
|
||||
>
|
||||
{recommendations.length === 0 ? (
|
||||
<Empty description="No recommendations available" />
|
||||
) : (
|
||||
recommendations.map(rec => renderRecommendationCard(rec))
|
||||
)}
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={<span><SettingOutlined /> My Strategies</span>}
|
||||
key="my-strategies"
|
||||
>
|
||||
<Table
|
||||
columns={myStrategiesColumns}
|
||||
dataSource={myStrategies}
|
||||
rowKey="id"
|
||||
pagination={{ pageSize: 10 }}
|
||||
/>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
{filteredStrategies.length === 0 ? (
|
||||
<Empty description="No strategies found" />
|
||||
) : (
|
||||
filteredStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)}
|
||||
</>
|
||||
)},
|
||||
{ key: 'featured', label: <span><StarOutlined /> Featured</span>, children: (
|
||||
featuredStrategies.length === 0 ? (
|
||||
<Empty description="No featured strategies" />
|
||||
) : (
|
||||
featuredStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)
|
||||
)},
|
||||
{ key: 'trending', label: <span><FireOutlined /> Trending</span>, children: (
|
||||
trendingStrategies.length === 0 ? (
|
||||
<Empty description="No trending strategies" />
|
||||
) : (
|
||||
trendingStrategies.map(strategy => renderStrategyCard(strategy))
|
||||
)
|
||||
)},
|
||||
{ key: 'recommendations', label: <span><BulbOutlined /> Recommendations</span>, children: (
|
||||
recommendations.length === 0 ? (
|
||||
<Empty description="No recommendations available" />
|
||||
) : (
|
||||
recommendations.map(rec => renderRecommendationCard(rec))
|
||||
)
|
||||
)},
|
||||
{ key: 'my-strategies', label: <span><SettingOutlined /> My Strategies</span>, children: (
|
||||
<Table
|
||||
columns={myStrategiesColumns}
|
||||
dataSource={myStrategies}
|
||||
rowKey="id"
|
||||
pagination={{ pageSize: 10 }}
|
||||
/>
|
||||
)},
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user