fix: Replace unsafe .toFixed() calls with safeFixed() in analytics views
- AnalyticsView: avg_players, uptime_percentage - WipeAnalyticsView: success_rate, population curve, durations, CSV export - PlayerRetentionView: retention percentages, session duration, tooltip - MapAnalyticsView: rotation effectiveness, performance metrics, table All analytics views now use safe formatter utilities with optional chaining to prevent null/undefined runtime errors when displaying numeric data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { ref, onMounted } from 'vue'
|
||||
import { useApi } from '@/composables/useApi'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Key, KeyRound, Users, DollarSign, Server, UserPlus, ArrowRight, ScrollText, CreditCard, MonitorCog } from 'lucide-vue-next'
|
||||
import { safeCurrency, safeLocaleString } from '@/utils/formatters'
|
||||
|
||||
const api = useApi()
|
||||
const router = useRouter()
|
||||
@@ -36,11 +37,10 @@ const quickLinks = [
|
||||
]
|
||||
|
||||
function formatValue(value: number | undefined, format: string): string {
|
||||
if (value == null) return '\u2014'
|
||||
if (format === 'currency') {
|
||||
return `$${value.toFixed(2)}`
|
||||
return safeCurrency(value, '$', '\u2014')
|
||||
}
|
||||
return value.toLocaleString()
|
||||
return safeLocaleString(value, '\u2014')
|
||||
}
|
||||
|
||||
async function fetchStats() {
|
||||
|
||||
Reference in New Issue
Block a user