chore: run bun format to automatically format the frontend code

This commit is contained in:
t0ng7u
2026-07-01 06:38:41 +08:00
parent e514db20f7
commit 5bf3468362
679 changed files with 2719 additions and 1717 deletions
+3 -2
View File
@@ -17,14 +17,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { dataScheme as vchartDefaultDataScheme } from '@visactor/vchart/esm/theme/color-scheme/builtin/default'
import { getCurrencyDisplay } from '@/lib/currency'
import { formatChartTime, type TimeGranularity } from '@/lib/time'
import { MAX_CHART_TREND_POINTS } from '@/features/dashboard/constants'
import type {
QuotaDataItem,
ProcessedChartData,
ProcessedUserChartData,
} from '@/features/dashboard/types'
import { getCurrencyDisplay } from '@/lib/currency'
import { formatChartTime, type TimeGranularity } from '@/lib/time'
type TFunction = (key: string) => string
type TooltipLineItem = {
+1 -1
View File
@@ -16,7 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
import {
DASHBOARD_CHART_PREFERENCES_STORAGE_KEY,
DEFAULT_DASHBOARD_CHART_PREFERENCES,
@@ -32,6 +31,7 @@ import type {
DashboardFilters,
ModelAnalyticsChartTab,
} from '@/features/dashboard/types'
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
function isTimeGranularity(value: unknown): value is TimeGranularity {
return value === 'hour' || value === 'day' || value === 'week'
@@ -1,5 +1,6 @@
import assert from 'node:assert/strict'
import { describe, test } from 'node:test'
import type { FlowUserFilterOption } from '../types'
import {
compactFlowSelectionLabel,
+2 -4
View File
@@ -297,8 +297,7 @@ describe('dashboard flow data', () => {
assert.equal(
result.filterOptions.nodes.some(
(option) =>
option.kind === 'model' && option.value === 'model:model-c'
(option) => option.kind === 'model' && option.value === 'model:model-c'
),
true
)
@@ -779,8 +778,7 @@ describe('dashboard flow data', () => {
)
const dimmedLink = values.links.find(
(link: Record<string, unknown>) =>
link.source === 'model:claude-4-sonnet' &&
link.target === 'channel:101'
link.source === 'model:claude-4-sonnet' && link.target === 'channel:101'
)
const nodeOpacity = flowSpec.node.style.fillOpacity
const linkOpacity = flowSpec.link.style.fillOpacity
+18 -19
View File
@@ -138,7 +138,9 @@ const SENSITIVE_FLOW_KINDS = new Set<FlowNodeKind>([
'channel',
])
const OTHER_FLOW_NODE_ID_SET = new Set<string>(Object.values(OTHER_FLOW_NODE_IDS))
const OTHER_FLOW_NODE_ID_SET = new Set<string>(
Object.values(OTHER_FLOW_NODE_IDS)
)
function numberValue(value: unknown): number {
const n = Number(value)
@@ -146,7 +148,9 @@ function numberValue(value: unknown): number {
}
function isFlowNodeKind(value: unknown): value is FlowNodeKind {
return typeof value === 'string' && FLOW_NODE_KIND_SET.has(value as FlowNodeKind)
return (
typeof value === 'string' && FLOW_NODE_KIND_SET.has(value as FlowNodeKind)
)
}
function rowMetrics(row: FlowQuotaDataItem): FlowMetrics {
@@ -399,7 +403,9 @@ function selectedNodeFiltersExceptKind(
selectedNodes: readonly FlowNodeFilter[] | undefined,
kind: FlowNodeKind
): FlowNodeFilter[] | undefined {
const filtered = (selectedNodes ?? []).filter((filter) => filter.kind !== kind)
const filtered = (selectedNodes ?? []).filter(
(filter) => filter.kind !== kind
)
return filtered.length > 0 ? filtered : undefined
}
@@ -932,14 +938,13 @@ function buildNodeFilterOptions(
}
}
return options
.sort(
(a, b) =>
(stageOrder.get(a.kind) ?? 0) - (stageOrder.get(b.kind) ?? 0) ||
b.valueRaw - a.valueRaw ||
a.label.localeCompare(b.label) ||
a.value.localeCompare(b.value)
)
return options.sort(
(a, b) =>
(stageOrder.get(a.kind) ?? 0) - (stageOrder.get(b.kind) ?? 0) ||
b.valueRaw - a.valueRaw ||
a.label.localeCompare(b.label) ||
a.value.localeCompare(b.value)
)
}
export function buildFlowFilterOptions(
@@ -1041,17 +1046,11 @@ function sankeyDatumValue(
return sankeyDatumSource(datum)[key]
}
function sankeyDatumFlag(
datum: Record<string, unknown>,
key: string
): boolean {
function sankeyDatumFlag(datum: Record<string, unknown>, key: string): boolean {
return sankeyDatumValue(datum, key) === true
}
export function flowSankeyDatumValue(
datum: unknown,
key: string
): unknown {
export function flowSankeyDatumValue(datum: unknown, key: string): unknown {
const record = recordValue(datum)
return record ? sankeyDatumValue(record, key) : undefined
}