fix: bug
This commit is contained in:
@@ -7,11 +7,10 @@ interface BaseStatusPanelProps {
|
||||
className?: string
|
||||
}
|
||||
|
||||
const TOTAL_BASES = 62
|
||||
|
||||
export function BaseStatusPanel({ keyLocations, className = '' }: BaseStatusPanelProps) {
|
||||
const stats = useMemo(() => {
|
||||
const bases = (keyLocations || []).filter((loc) => loc.type === 'Base')
|
||||
const total = bases.length
|
||||
let attacked = 0
|
||||
let severe = 0
|
||||
let moderate = 0
|
||||
@@ -24,7 +23,7 @@ export function BaseStatusPanel({ keyLocations, className = '' }: BaseStatusPane
|
||||
else if (lvl === 2) moderate++
|
||||
else if (lvl === 1) light++
|
||||
}
|
||||
return { attacked, severe, moderate, light }
|
||||
return { total, attacked, severe, moderate, light }
|
||||
}, [keyLocations])
|
||||
|
||||
return (
|
||||
@@ -38,7 +37,7 @@ export function BaseStatusPanel({ keyLocations, className = '' }: BaseStatusPane
|
||||
<div className="flex flex-col gap-1.5 text-xs tabular-nums">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="text-military-text-secondary">总基地数</span>
|
||||
<strong>{TOTAL_BASES}</strong>
|
||||
<strong>{stats.total}</strong>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="flex items-center gap-1 text-military-text-secondary">
|
||||
|
||||
Reference in New Issue
Block a user