refactor(ui): 移除空壳行业资讯 Tab + Provider URL 去重
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- SimpleSidebar: 移除空壳"行业资讯" Tab 和 Newspaper icon import - ModelsAPI.tsx: AVAILABLE_PROVIDERS 引用 LLM_PROVIDER_URLS 常量 - models.ts: PROVIDER_DEFAULTS 引用 api-urls.ts,消除重复 URL 定义 - 所有 Provider URL 现在统一在 api-urls.ts 维护
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* SimpleSidebar - Trae Solo 风格的简洁侧边栏
|
||||
*
|
||||
* 仅显示:对话列表 + 行业资讯
|
||||
* 仅显示:对话列表
|
||||
* 底部:模式切换 + 设置
|
||||
*/
|
||||
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
MessageSquare, Settings, LayoutGrid,
|
||||
Search, X, Newspaper,
|
||||
Settings, LayoutGrid,
|
||||
Search, X,
|
||||
} from 'lucide-react';
|
||||
import { ConversationList } from './ConversationList';
|
||||
|
||||
@@ -17,10 +17,7 @@ interface SimpleSidebarProps {
|
||||
onToggleMode?: () => void;
|
||||
}
|
||||
|
||||
type Tab = 'conversations' | 'news';
|
||||
|
||||
export function SimpleSidebar({ onOpenSettings, onToggleMode }: SimpleSidebarProps) {
|
||||
const [activeTab, setActiveTab] = useState<Tab>('conversations');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
|
||||
return (
|
||||
@@ -32,68 +29,30 @@ export function SimpleSidebar({ onOpenSettings, onToggleMode }: SimpleSidebarPro
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Tab 切换: 对话 / 行业资讯 */}
|
||||
<div className="flex border-b border-[#e8e6e1]/50 dark:border-gray-800">
|
||||
<button
|
||||
onClick={() => setActiveTab('conversations')}
|
||||
className={`flex-1 flex items-center justify-center gap-1.5 py-2.5 text-xs font-medium transition-colors ${
|
||||
activeTab === 'conversations'
|
||||
? 'text-gray-900 dark:text-gray-100 border-b-2 border-orange-500'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300'
|
||||
}`}
|
||||
>
|
||||
<MessageSquare className="w-3.5 h-3.5" />
|
||||
对话
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab('news')}
|
||||
className={`flex-1 flex items-center justify-center gap-1.5 py-2.5 text-xs font-medium transition-colors ${
|
||||
activeTab === 'news'
|
||||
? 'text-gray-900 dark:text-gray-100 border-b-2 border-orange-500'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300'
|
||||
}`}
|
||||
>
|
||||
<Newspaper className="w-3.5 h-3.5" />
|
||||
行业资讯
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 内容区域 */}
|
||||
<div className="flex-1 overflow-hidden">
|
||||
{activeTab === 'conversations' && (
|
||||
<div className="p-2 h-full overflow-y-auto">
|
||||
{/* 搜索框 */}
|
||||
<div className="relative mb-2">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索对话..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="w-full pl-9 pr-8 py-1.5 bg-white/60 dark:bg-gray-800 border border-[#e8e6e1] dark:border-gray-700 rounded-lg text-sm focus:outline-none focus:border-gray-400 transition-all text-gray-700 dark:text-gray-300 placeholder-gray-400"
|
||||
/>
|
||||
{searchQuery && (
|
||||
<button
|
||||
onClick={() => setSearchQuery('')}
|
||||
className="absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded text-gray-400"
|
||||
>
|
||||
<X className="w-3 h-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<ConversationList searchQuery={searchQuery} />
|
||||
<div className="p-2 h-full overflow-y-auto">
|
||||
{/* 搜索框 */}
|
||||
<div className="relative mb-2">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索对话..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="w-full pl-9 pr-8 py-1.5 bg-white/60 dark:bg-gray-800 border border-[#e8e6e1] dark:border-gray-700 rounded-lg text-sm focus:outline-none focus:border-gray-400 transition-all text-gray-700 dark:text-gray-300 placeholder-gray-400"
|
||||
/>
|
||||
{searchQuery && (
|
||||
<button
|
||||
onClick={() => setSearchQuery('')}
|
||||
className="absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded text-gray-400"
|
||||
>
|
||||
<X className="w-3 h-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === 'news' && (
|
||||
<div className="p-3 h-full overflow-y-auto">
|
||||
<div className="flex flex-col items-center justify-center py-12 text-gray-400 dark:text-gray-500">
|
||||
<Newspaper className="w-10 h-10 mb-3 opacity-50" />
|
||||
<p className="text-sm">行业资讯</p>
|
||||
<p className="text-xs mt-1">开发中,敬请期待</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<ConversationList searchQuery={searchQuery} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 底部操作栏 */}
|
||||
|
||||
Reference in New Issue
Block a user