chore: initial commit - maqt-desktop v0.2
- Phase 1-5: UI framework, auth, weapon schemes, color filters, system optimization - Industrial/tech design style with Chinese localization - Points to gch3n.online/delta backend API - Hardware monitor, filter editor, and all module pages
This commit is contained in:
77
src/components/optimization/OptimizeItem.tsx
Normal file
77
src/components/optimization/OptimizeItem.tsx
Normal file
@@ -0,0 +1,77 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface OptimizeItemData {
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
category: string;
|
||||
icon: string;
|
||||
status: 'pending' | 'optimized' | 'restored' | 'error';
|
||||
}
|
||||
|
||||
interface OptimizeItemProps {
|
||||
item: OptimizeItemData;
|
||||
onToggle: (id: string, action: 'optimize' | 'restore') => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const statusStyles: Record<string, string> = {
|
||||
pending: 'border-[#333]',
|
||||
optimized: 'border-[#ff4500]/50 bg-[#ff4500]/5',
|
||||
restored: 'border-[#333]',
|
||||
error: 'border-[#cc3300]/50 bg-[#cc3300]/5',
|
||||
};
|
||||
|
||||
const statusTextStyles: Record<string, string> = {
|
||||
pending: 'text-[#555]',
|
||||
optimized: 'text-[#ff4500]',
|
||||
restored: 'text-[#555]',
|
||||
error: 'text-[#cc3300]',
|
||||
};
|
||||
|
||||
const statusLabels: Record<string, string> = {
|
||||
pending: '待优化',
|
||||
optimized: '已优化',
|
||||
restored: '已恢复',
|
||||
error: '失败',
|
||||
};
|
||||
|
||||
export default function OptimizeItem({ item, onToggle, disabled }: OptimizeItemProps) {
|
||||
const isOptimized = item.status === 'optimized';
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`border transition-colors duration-75 bg-[#1a1a1a]/60 ${statusStyles[item.status]}`}
|
||||
>
|
||||
<div className="flex items-center gap-2 px-2 py-2">
|
||||
<div className={`w-1 h-1 shrink-0 rounded-full ${isOptimized ? 'bg-[#ff4500]' : 'bg-[#333]'}`} />
|
||||
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="material-symbols-outlined text-[12px] text-[#555]">{item.icon}</span>
|
||||
<span className="text-[9px] font-semibold tracking-[0.1em] uppercase text-[#e0e0e0] truncate">
|
||||
{item.label}
|
||||
</span>
|
||||
<span className={`text-[7px] font-mono tracking-wider px-1 py-[1px] border ${statusTextStyles[item.status]} border-current/30`}>
|
||||
{statusLabels[item.status]}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-[8px] text-[#555] mt-0.5 truncate">{item.description}</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => onToggle(item.id, isOptimized ? 'restore' : 'optimize')}
|
||||
disabled={disabled || item.status === 'error'}
|
||||
className={`w-[64px] shrink-0 py-1.5 text-[8px] font-semibold tracking-[0.1em] uppercase border transition-colors duration-75
|
||||
${isOptimized
|
||||
? 'border-[#555] text-[#555] hover:border-[#ff4500] hover:text-[#ff4500]'
|
||||
: 'border-[#555] text-[#888] hover:border-[#ff4500] hover:text-[#ff4500]'
|
||||
}
|
||||
disabled:opacity-40 disabled:cursor-not-allowed`}
|
||||
>
|
||||
{isOptimized ? '恢复' : '优化'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user