@@ -2,6 +2,13 @@ import React, { useEffect, useState, useRef } from 'react';
22import { getStats , getHealth , listMemories } from '../api/client.js' ;
33import { useI18n } from '../i18n/index.js' ;
44
5+ function fmtNum ( n : number ) : string {
6+ if ( n >= 100_000_000 ) return ( n / 100_000_000 ) . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) + 'δΊΏ' ;
7+ if ( n >= 10_000 ) return ( n / 10_000 ) . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) + 'δΈ' ;
8+ if ( n >= 1_000 ) return ( n / 1_000 ) . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) + 'k' ;
9+ return String ( n ) ;
10+ }
11+
512// βββ Mini Canvas Bar Chart ββββββββββββββββββββββββββββββββββββββββββββββββββ
613
714function BarChart ( { data, colors, height = 220 } : { data : { label : string ; value : number } [ ] ; colors : string [ ] ; height ?: number } ) {
@@ -229,7 +236,7 @@ export default function Stats() {
229236 < div className = "card-grid" >
230237 < div className = "stat-card" >
231238 < div className = "label" > { t ( 'stats.totalMemories' ) } </ div >
232- < div className = "value" > { stats . total_memories } </ div >
239+ < div className = "value" > { fmtNum ( stats . total_memories || 0 ) } </ div >
233240 </ div >
234241 < div className = "stat-card" >
235242 < div className = "label" > { t ( 'stats.core' ) } </ div >
@@ -245,11 +252,11 @@ export default function Stats() {
245252 </ div >
246253 < div className = "stat-card" >
247254 < div className = "label" > { t ( 'stats.relations' ) } </ div >
248- < div className = "value" > { stats . total_relations } </ div >
255+ < div className = "value" > { fmtNum ( stats . total_relations || 0 ) } </ div >
249256 </ div >
250257 < div className = "stat-card" >
251258 < div className = "label" > { t ( 'stats.accessLogs' ) } </ div >
252- < div className = "value" > { stats . total_access_logs } </ div >
259+ < div className = "value" > { fmtNum ( stats . total_access_logs || 0 ) } </ div >
253260 </ div >
254261 </ div >
255262
0 commit comments