diff --git a/frontend/src/components/common/index.ts b/frontend/src/components/common/index.ts index 4c982e5..0088dd1 100644 --- a/frontend/src/components/common/index.ts +++ b/frontend/src/components/common/index.ts @@ -1,3 +1 @@ -export { TLogo } from './TLogo'; -export { ThemeToggle } from './ThemeToggle'; -export { TPattern } from './TPattern'; \ No newline at end of file +// common UI helpers — add exports here as new shared components are created diff --git a/frontend/src/components/layout/index.ts b/frontend/src/components/layout/index.ts index 8083781..4a7b1bf 100644 --- a/frontend/src/components/layout/index.ts +++ b/frontend/src/components/layout/index.ts @@ -1,4 +1,3 @@ export { AppShell } from './AppShell'; -export { ContentLayout } from './ContentLayout'; -export { FooterLayout } from './FooterLayout'; -export { HeaderLayout } from './HeaderLayout'; +export { Sidebar } from './Sidebar'; +export { Topbar } from './Topbar'; diff --git a/frontend/src/components/layout/shell-config.ts b/frontend/src/components/layout/shell-config.ts index 29ada36..d23f21a 100644 --- a/frontend/src/components/layout/shell-config.ts +++ b/frontend/src/components/layout/shell-config.ts @@ -1,5 +1,3 @@ -import { appTabs } from '../../router/tabs'; - export const shellFrameClassName = 'mx-auto w-full max-w-[1680px] px-8'; export const shellMeta = { @@ -8,5 +6,3 @@ export const shellMeta = { status: 'ONLINE', surface: 'Desktop Web', } as const; - -export const shellModuleSummary = appTabs.map((tab) => tab.label).join(' / '); diff --git a/frontend/src/components/ui/Badge.tsx b/frontend/src/components/ui/Badge.tsx index d217b05..325d1b6 100644 --- a/frontend/src/components/ui/Badge.tsx +++ b/frontend/src/components/ui/Badge.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface BadgeProps { children: React.ReactNode; @@ -7,32 +6,29 @@ interface BadgeProps { size?: 'sm' | 'md'; } +const colorMap: Record = { + accent: { bg: 'var(--accent)', text: '#fff' }, + green: { bg: 'var(--success)', text: '#fff' }, + orange: { bg: 'var(--warn)', text: '#fff' }, + red: { bg: 'var(--danger)', text: '#fff' }, +}; + export const Badge: React.FC = ({ children, color = 'accent', size = 'sm', }) => { - const { theme } = useTheme(); - - const colorStyles = { - accent: { bg: theme.gradientAccent, text: '#fff' }, - green: { bg: theme.green, text: '#fff' }, - orange: { bg: theme.orange, text: '#fff' }, - red: { bg: '#ff4444', text: '#fff' }, - }; - - const sizeStyles = { + const sizeStyles: Record = { sm: 'px-2 py-0.5 text-xs', md: 'px-3 py-1 text-sm', }; + const c = colorMap[color] ?? colorMap.accent; + return ( {children} diff --git a/frontend/src/components/ui/Button.tsx b/frontend/src/components/ui/Button.tsx index f27bd10..d8df314 100644 --- a/frontend/src/components/ui/Button.tsx +++ b/frontend/src/components/ui/Button.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface ButtonProps { variant?: 'primary' | 'secondary'; @@ -18,8 +17,6 @@ export const Button: React.FC = ({ disabled = false, className = '', }) => { - const { theme } = useTheme(); - const baseStyles = ` inline-flex items-center justify-center font-semibold rounded-xl cursor-pointer @@ -27,13 +24,13 @@ export const Button: React.FC = ({ disabled:cursor-not-allowed disabled:opacity-50 `; - const sizeStyles = { + const sizeStyles: Record = { sm: 'px-3 py-1.5 text-xs', md: 'px-5 py-3 text-sm', lg: 'px-8 py-5 text-base', }; - const variantStyles = { + const variantStyles: Record = { primary: ` bg-gradient-to-r from-t-accent to-t-accent-dark text-white hover:shadow-t-accent hover:-translate-y-0.5 @@ -50,9 +47,6 @@ export const Button: React.FC = ({ onClick={onClick} disabled={disabled} className={`${baseStyles} ${sizeStyles[size]} ${variantStyles[variant]} ${className}`} - style={{ - color: variant === 'primary' ? '#fff' : theme.text2, - }} > {children} diff --git a/frontend/src/components/ui/Card.tsx b/frontend/src/components/ui/Card.tsx index 97f49ab..e757612 100644 --- a/frontend/src/components/ui/Card.tsx +++ b/frontend/src/components/ui/Card.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface CardProps { accent?: boolean; @@ -18,9 +17,7 @@ export const Card: React.FC = ({ className = '', onClick, }) => { - const { theme, isDark } = useTheme(); - - const paddingStyles = { + const paddingStyles: Record = { sm: 'p-4', md: 'p-5', lg: 'p-8', @@ -30,22 +27,22 @@ export const Card: React.FC = ({
{accent && (
)} {children} diff --git a/frontend/src/components/ui/Input.tsx b/frontend/src/components/ui/Input.tsx index fe6e4fd..5acbc10 100644 --- a/frontend/src/components/ui/Input.tsx +++ b/frontend/src/components/ui/Input.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface InputProps { value: string; @@ -18,8 +17,6 @@ export const Input: React.FC = ({ className = '', type = 'text', }) => { - const { theme } = useTheme(); - return ( = ({ onKeyDown={onKeyDown} placeholder={placeholder} className={` - w-full px-4 py-3 text-sm - bg-t-bg-card border border-t-border rounded-lg - text-t-text outline-none - focus:border-t-accent focus:ring-1 focus:ring-t-accent - placeholder:text-t-text3 + w-full px-4 py-3 text-sm rounded-lg outline-none + focus:ring-1 + placeholder:text-[color:var(--muted)] ${className} `} style={{ - backgroundColor: theme.bgCard, - borderColor: theme.border, - color: theme.text, + backgroundColor: 'var(--surface)', + borderColor: 'var(--border)', + border: '1px solid var(--border)', + color: 'var(--fg)', + }} + onFocus={(e) => { + e.currentTarget.style.borderColor = 'var(--accent)'; + e.currentTarget.style.boxShadow = '0 0 0 1px var(--accent)'; + }} + onBlur={(e) => { + e.currentTarget.style.borderColor = 'var(--border)'; + e.currentTarget.style.boxShadow = 'none'; }} /> ); diff --git a/frontend/src/components/ui/ProgressBar.tsx b/frontend/src/components/ui/ProgressBar.tsx index 52e216b..400e021 100644 --- a/frontend/src/components/ui/ProgressBar.tsx +++ b/frontend/src/components/ui/ProgressBar.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface ProgressBarProps { percent: number; @@ -7,36 +6,39 @@ interface ProgressBarProps { showLabel?: boolean; } +const colorBg: Record = { + accent: 'linear-gradient(90deg, var(--accent), var(--accent-hover))', + green: 'linear-gradient(90deg, var(--success), #00ff88)', + orange: 'linear-gradient(90deg, var(--warn), #ffaa00)', + red: 'var(--danger)', +}; + export const ProgressBar: React.FC = ({ percent, color = 'accent', showLabel = false, }) => { - const { theme } = useTheme(); - - const colorStyles = { - accent: theme.gradientAccent, - green: `linear-gradient(90deg, ${theme.green}, #00ff88)`, - orange: `linear-gradient(90deg, ${theme.orange}, #ffaa00)`, - red: '#ff4444', - }; - return (
{showLabel && ( - {percent}% + + {percent}% + )}
); diff --git a/frontend/src/components/ui/ScoreBar.tsx b/frontend/src/components/ui/ScoreBar.tsx index 6e7ee55..d0f36a2 100644 --- a/frontend/src/components/ui/ScoreBar.tsx +++ b/frontend/src/components/ui/ScoreBar.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; interface ScoreBarProps { score: number; // 0-100 @@ -12,27 +11,25 @@ export const ScoreBar: React.FC = ({ label, accent = false, }) => { - const { theme } = useTheme(); - return (
{label && (
{label}
)}
{score}
@@ -42,7 +39,7 @@ export const ScoreBar: React.FC = ({ key={i} className="w-2 h-4 rounded-sm" style={{ - backgroundColor: i < score / 10 ? theme.accent : theme.bgHover, + backgroundColor: i < score / 10 ? 'var(--accent)' : 'var(--border)', }} /> ))} diff --git a/frontend/src/pages/Compliance/ChatPanel.tsx b/frontend/src/pages/Compliance/ChatPanel.tsx index 2231851..4a7fe29 100644 --- a/frontend/src/pages/Compliance/ChatPanel.tsx +++ b/frontend/src/pages/Compliance/ChatPanel.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { useTheme } from '../../contexts'; import type { ComplianceChunk } from '../../types'; interface ChatPanelProps { @@ -29,7 +28,6 @@ export const ChatPanel: React.FC = ({ '法规的具体要求是什么?', ], }) => { - const { theme } = useTheme(); const activeChunk = chunks.find(c => c.id === activeChunkId); return ( @@ -40,8 +38,8 @@ export const ChatPanel: React.FC = ({ top: 0, bottom: 0, width: 420, - background: theme.bgCard, - borderLeft: `1px solid ${theme.border}`, + background: 'var(--surface)', + borderLeft: '1px solid var(--border)', display: 'flex', flexDirection: 'column', zIndex: 50, @@ -51,14 +49,14 @@ export const ChatPanel: React.FC = ({ {/* Chat Header */}
-
合规对话
-
+
合规对话
+
段落 #{activeChunk?.index} · {activeChunk?.regulations.length} 条法规
@@ -68,7 +66,7 @@ export const ChatPanel: React.FC = ({ width: 32, height: 32, borderRadius: 8, - background: theme.bgHover, + background: 'var(--rail-hover)', border: 'none', cursor: 'pointer', display: 'flex', @@ -77,7 +75,7 @@ export const ChatPanel: React.FC = ({ }} > - +
@@ -85,15 +83,15 @@ export const ChatPanel: React.FC = ({ {/* Current Chunk Info */}
-
+
{activeChunk?.intent}
= ({ width: 32, height: 32, borderRadius: 8, - background: theme.gradientAccent, + background: 'linear-gradient(90deg, var(--accent), var(--accent-hover))', display: 'flex', alignItems: 'center', justifyContent: 'center', @@ -136,13 +134,15 @@ export const ChatPanel: React.FC = ({
{msg.content}
@@ -154,7 +154,7 @@ export const ChatPanel: React.FC = ({ width: 32, height: 32, borderRadius: 8, - background: theme.gradientAccent, + background: 'linear-gradient(90deg, var(--accent), var(--accent-hover))', display: 'flex', alignItems: 'center', justifyContent: 'center', @@ -165,15 +165,15 @@ export const ChatPanel: React.FC = ({
-
- 分析中... +
+ 分析中...
)} @@ -193,10 +193,10 @@ export const ChatPanel: React.FC = ({ style={{ padding: '6px 12px', fontSize: 12, - background: theme.bgHover, - border: `1px solid ${theme.border}`, + background: 'var(--rail-hover)', + border: '1px solid var(--border)', borderRadius: 6, - color: theme.text2, + color: 'var(--muted)', cursor: 'pointer', }} >{q} @@ -206,7 +206,7 @@ export const ChatPanel: React.FC = ({ {/* Chat Input */}
@@ -219,10 +219,10 @@ export const ChatPanel: React.FC = ({ flex: 1, padding: 12, fontSize: 14, - background: theme.bgHover, - border: `1px solid ${theme.border}`, + background: 'var(--rail-hover)', + border: '1px solid var(--border)', borderRadius: 8, - color: theme.text, + color: 'var(--fg)', outline: 'none', }} /> @@ -233,8 +233,10 @@ export const ChatPanel: React.FC = ({ padding: '12px 20px', fontSize: 14, fontWeight: 600, - background: chatLoading || !chatInput.trim() ? theme.bgHover : theme.gradientAccent, - color: chatLoading || !chatInput.trim() ? theme.text3 : '#fff', + background: chatLoading || !chatInput.trim() + ? 'var(--rail-hover)' + : 'linear-gradient(90deg, var(--accent), var(--accent-hover))', + color: chatLoading || !chatInput.trim() ? 'var(--muted)' : '#fff', border: 'none', borderRadius: 8, cursor: chatLoading || !chatInput.trim() ? 'not-allowed' : 'pointer',