feat: 简化系统状态卡片,移除型号、大小及核心数显示
This commit is contained in:
1 parent
63efceceb4
commit
cfa4f4745c
1 file changed
-14
@@ -39,14 +39,6 @@ function formatUptime(seconds: number) {
|
||||
return `${m} 分钟`
|
||||
}
|
||||
|
||||
function formatBytes(bytes: number) {
|
||||
if (!bytes || bytes <= 0) return '0 B'
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
const i = Math.min(units.length - 1, Math.floor(Math.log(bytes) / Math.log(1024)))
|
||||
const value = bytes / 1024 ** i
|
||||
return `${value >= 10 ? Math.round(value) : value.toFixed(1)} ${units[i]}`
|
||||
}
|
||||
|
||||
function UsageBar({ percent }: { percent: number }) {
|
||||
return (
|
||||
<div className="mt-3 h-2 w-full overflow-hidden rounded-full bg-slate-100">
|
||||
@@ -180,9 +172,6 @@ export default function Home() {
|
||||
{stats.cpu.usagePercent}%
|
||||
</span>
|
||||
<UsageBar percent={stats.cpu.usagePercent} />
|
||||
<p className="mt-2 text-xs text-slate-500">
|
||||
{stats.cpu.model || '未知型号'} · {stats.cpu.cores} 核
|
||||
</p>
|
||||
</StatItem>
|
||||
|
||||
<StatItem
|
||||
@@ -201,9 +190,6 @@ export default function Home() {
|
||||
{stats.memory.usagePercent}%
|
||||
</span>
|
||||
<UsageBar percent={stats.memory.usagePercent} />
|
||||
<p className="mt-2 text-xs text-slate-500">
|
||||
{formatBytes(stats.memory.used)} / {formatBytes(stats.memory.total)}
|
||||
</p>
|
||||
</StatItem>
|
||||
|
||||
<StatItem
|
||||
|
||||
Reference in new issue
Block a user