feat: optimize dashboard/search UX and simplify extension architecture

Redesign Dashboard with compact tool grid and recently used tools
Improve TopBar search UX with Cmd/Ctrl+K shortcut and better history navigation
Reorganize project structure into src/
Migrate i18n from react-i18next to chrome.i18n
Remove runtime language switch and settings page
Remove HTML/Markdown conversion tools
Clean up unused code, dead animations, redundant comments, and imports
Improve component consistency with shadcn/ui patterns
Replace hardcoded strings/colors with i18n tokens and theme tokens
Add comprehensive project documentation and coding standards
Fix CI artifact upload workflow and multiple TypeScript/test issues

Includes various refactors, UI polish, i18n cleanup, CI improvements,
and maintenance updates across the codebase.
This commit is contained in:
LingandRX
2026-05-28 22:39:25 +08:00
committed by GitHub
parent d4c29a1bf4
commit 945780def8
200 changed files with 1557 additions and 4380 deletions
+61
View File
@@ -0,0 +1,61 @@
import { useCallback, useMemo, useState } from 'react';
import TextInputArea from '@/components/TextInputArea';
import { formatByteSize, getTextStats } from '@/utils/textStatistics';
import { useI18n } from '@/utils/chromeI18n';
import { useContextMenuData } from '@/utils/useContextMenuData';
import { cn } from '@/lib/utils';
export default function Index() {
const { t } = useI18n('textStatistics');
const [text, setText] = useState('');
const handleContextMenuData = useCallback((payload: string) => {
setText(payload);
}, []);
useContextMenuData({ featureKey: 'textStatistics', onData: handleContextMenuData });
const stats = useMemo(() => getTextStats(text), [text]);
const statItems = [
{ label: t('textStatistics:characters'), value: stats.characters },
{ label: t('textStatistics:words'), value: stats.words },
{ label: t('textStatistics:lines'), value: stats.lines },
{ label: t('textStatistics:bytes'), value: formatByteSize(stats.bytes) },
];
return (
<div className="p-4 w-full space-y-4">
{/* 文本输入区域 */}
<TextInputArea
value={text}
onChange={setText}
placeholder={t('textStatistics:placeholder')}
minRows={10}
maxRows={18}
showClear={true}
allowCopy={true}
/>
{/* 统计结果展示区域 */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
{statItems.map((item) => (
<div
key={item.label}
className={cn(
'flex flex-col justify-center items-center p-4 text-center rounded-xl border border-border bg-card shadow-sm text-card-foreground',
'hover:-translate-y-0.5 hover:shadow-md hover:border-primary/50 focus-within:ring-1 focus-within:ring-ring',
)}
>
<span className="text-xs font-medium text-muted-foreground tracking-wider mb-1 select-none">
{item.label}
</span>
<span className="font-mono text-lg md:text-2xl font-extrabold text-primary break-all tracking-tight leading-none tabular-nums select-all">
{item.value}
</span>
</div>
))}
</div>
</div>
);
}