refactor(StorageCleaner): 规范化页面组件目录结构

- 将子组件移至 components/ 子目录(OptionItem、AutoRefreshToggle、CleaningResult、StorageCleanerConfirm、StorageOptionsGrid、ErrorDisplay)
- 创建 __tests__/ 目录结构
- 更新所有相关导入路径

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
雨霖铃
2026-06-10 20:56:38 +08:00
parent 016173a9c5
commit 9c5f5c8cfe
9 changed files with 39 additions and 8 deletions
@@ -0,0 +1,35 @@
import { AlertCircle } from 'lucide-react';
import { useI18n } from '@/utils/chromeI18n';
import { cn } from '@/lib/utils';
interface ErrorDisplayProps extends React.HTMLAttributes<HTMLDivElement> {
error: string;
}
export default function ErrorDisplay({ error, className, ...props }: ErrorDisplayProps) {
const { t } = useI18n('storageCleaner');
return (
<div
className={cn(
'flex flex-col items-center justify-center py-8 min-h-[240px] sm:min-h-[360px] p-4 text-center',
className,
)}
{...props}
>
<div className="w-full max-w-xs flex flex-col items-center justify-center rounded-xl p-5 border border-destructive/20 bg-destructive/5 shadow-sm">
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10 text-destructive mb-3.5 shrink-0">
<AlertCircle className="h-5 w-5" />
</div>
<p className="text-sm font-semibold leading-relaxed text-destructive break-all px-1 mb-2">
{error}
</p>
<p className="text-xs font-medium leading-relaxed text-muted-foreground/90 px-2">
{t('storageCleaner:errorStandardOnly')}
</p>
</div>
</div>
);
}