Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
1414569b
authored
Jun 18, 2026
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(stat): enhance log stat cards with compact number formatting and improved layout
parent
df013946
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
16 deletions
+49
-16
web/default/src/features/dashboard/components/models/log-stat-cards.tsx
+47
-14
web/default/src/features/pricing/components/model-perf-badge.tsx
+2
-2
No files found.
web/default/src/features/dashboard/components/models/log-stat-cards.tsx
View file @
1414569b
...
...
@@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
*/
import
{
useEffect
,
useState
}
from
'react'
import
{
useAuthStore
}
from
'@/stores/auth-store'
import
{
formatNumber
,
formatQuota
}
from
'@/lib/format'
import
{
format
CompactNumber
,
format
Number
,
formatQuota
}
from
'@/lib/format'
import
{
computeTimeRange
}
from
'@/lib/time'
import
{
cn
}
from
'@/lib/utils'
import
{
Skeleton
}
from
'@/components/ui/skeleton'
import
{
getUserQuotaDates
}
from
'@/features/dashboard/api'
import
{
useModelStatCardsConfig
}
from
'@/features/dashboard/hooks/use-dashboard-config'
...
...
@@ -38,6 +39,21 @@ interface LogStatCardsProps {
onDataUpdate
?:
(
data
:
QuotaDataItem
[],
loading
:
boolean
)
=>
void
}
const
MAX_INLINE_STAT_CHARS
=
9
function
formatStatNumber
(
value
:
number
)
{
const
fullValue
=
formatNumber
(
value
)
const
displayValue
=
fullValue
.
length
>
MAX_INLINE_STAT_CHARS
?
formatCompactNumber
(
value
)
:
fullValue
return
{
displayValue
,
fullValue
,
}
}
export
function
LogStatCards
(
props
:
LogStatCardsProps
)
{
const
statCardsConfig
=
useModelStatCardsConfig
()
const
user
=
useAuthStore
((
state
)
=>
state
.
auth
.
user
)
...
...
@@ -100,27 +116,41 @@ export function LogStatCards(props: LogStatCardsProps) {
tpm
:
stats
?.
totalTokens
??
0
,
}
const
items
=
statCardsConfig
.
map
((
config
)
=>
(
{
title
:
config
.
title
,
value
:
const
items
=
statCardsConfig
.
map
((
config
)
=>
{
const
rawValue
=
config
.
getValue
(
adaptedStats
,
timeRangeMinutes
)
const
formatted
=
config
.
key
===
'quota'
?
formatQuota
(
config
.
getValue
(
adaptedStats
,
timeRangeMinutes
))
:
formatNumber
(
config
.
getValue
(
adaptedStats
,
timeRangeMinutes
)),
desc
:
config
.
description
,
icon
:
config
.
icon
,
}))
?
{
displayValue
:
formatQuota
(
rawValue
),
fullValue
:
formatQuota
(
rawValue
),
}
:
formatStatNumber
(
rawValue
)
return
{
title
:
config
.
title
,
value
:
formatted
.
displayValue
,
fullValue
:
formatted
.
fullValue
,
desc
:
config
.
description
,
icon
:
config
.
icon
,
}
})
return
(
<
div
className=
'overflow-hidden rounded-lg border'
>
<
div
className=
'divide-border/60 grid grid-cols-2 divide-x sm:grid-cols-3 lg:grid-cols-5'
>
<
div
className=
'divide-border/60 grid
min-w-0
grid-cols-2 divide-x sm:grid-cols-3 lg:grid-cols-5'
>
{
items
.
map
((
it
,
idx
)
=>
{
const
Icon
=
it
.
icon
return
(
<
div
key=
{
it
.
title
}
className=
{
`px-3 py-2.5 sm:px-5 sm:py-4 ${idx === items.length - 1 && items.length % 2 !== 0 ? 'col-span-2 sm:col-span-1' : ''}`
}
className=
{
cn
(
'min-w-0 px-3 py-2.5 sm:px-5 sm:py-4'
,
idx
===
items
.
length
-
1
&&
items
.
length
%
2
!==
0
&&
'col-span-2 sm:col-span-1'
)
}
>
<
div
className=
'flex items-center gap-2'
>
<
div
className=
'flex
min-w-0
items-center gap-2'
>
<
Icon
className=
'text-muted-foreground/60 size-3.5 shrink-0'
/>
<
div
className=
'text-muted-foreground truncate text-xs font-medium tracking-wider uppercase'
>
{
it
.
title
}
...
...
@@ -128,7 +158,7 @@ export function LogStatCards(props: LogStatCardsProps) {
</
div
>
{
loading
?
(
<
div
className=
'mt-2
space-y
-1.5'
>
<
div
className=
'mt-2
flex flex-col gap
-1.5'
>
<
Skeleton
className=
'h-7 w-20'
/>
<
Skeleton
className=
'h-3.5 w-28'
/>
</
div
>
...
...
@@ -143,7 +173,10 @@ export function LogStatCards(props: LogStatCardsProps) {
</>
)
:
(
<>
<
div
className=
'text-foreground mt-1.5 font-mono text-lg font-bold tracking-tight tabular-nums sm:mt-2 sm:text-2xl'
>
<
div
className=
'text-foreground mt-1.5 max-w-full truncate font-mono text-lg font-bold tracking-tight tabular-nums sm:mt-2 sm:text-2xl'
title=
{
it
.
fullValue
}
>
{
it
.
value
}
</
div
>
<
div
className=
'text-muted-foreground/60 mt-1 hidden text-xs md:block'
>
...
...
web/default/src/features/pricing/components/model-perf-badge.tsx
View file @
1414569b
...
...
@@ -45,8 +45,8 @@ function formatCompactLatency(ms: number): string {
function
formatCompactThroughput
(
tps
:
number
):
string
{
if
(
!
Number
.
isFinite
(
tps
)
||
tps
<=
0
)
return
'—'
if
(
tps
>=
1
_000
)
return
`
${
formatCompactNumber
(
tps
/
1
_000
)}
Kt
ps
`
return
`
${
formatCompactNumber
(
tps
)}
t
ps
`
if
(
tps
>=
1
_000
)
return
`
${
formatCompactNumber
(
tps
/
1
_000
)}
Kt`
return
`
${
formatCompactNumber
(
tps
)}
t`
}
export
const
ModelPerfBadge
=
memo
(
function
ModelPerfBadge
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment