chore: run bun format to automatically format the frontend code
This commit is contained in:
+1
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { api } from '@/lib/api'
|
||||
|
||||
import type {
|
||||
FlowQuotaDataItem,
|
||||
QuotaDataItem,
|
||||
|
||||
@@ -16,14 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import {
|
||||
Fragment,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import type { EventParamsDefinition, IVChart } from '@visactor/vchart'
|
||||
@@ -39,6 +31,14 @@ import {
|
||||
Route,
|
||||
WalletCards,
|
||||
} from 'lucide-react'
|
||||
import {
|
||||
Fragment,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { MultiSelect } from '@/components/multi-select'
|
||||
@@ -90,6 +90,7 @@ import { useChartTheme } from '@/lib/use-chart-theme'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
import { FlowNodeFilterControl } from './flow-node-filter'
|
||||
|
||||
interface FlowChartsProps {
|
||||
@@ -172,9 +173,7 @@ const FLOW_OTHER_NODE_LABEL_KEYS: Record<FlowNodeKind, string> = {
|
||||
|
||||
type FlowChartPointerEvent = EventParamsDefinition['pointerdown']
|
||||
|
||||
function chartRecordValue(
|
||||
value: unknown
|
||||
): Record<string, unknown> | undefined {
|
||||
function chartRecordValue(value: unknown): Record<string, unknown> | undefined {
|
||||
return value && typeof value === 'object'
|
||||
? (value as Record<string, unknown>)
|
||||
: undefined
|
||||
@@ -469,7 +468,9 @@ export function FlowCharts(props: FlowChartsProps) {
|
||||
overflowMode,
|
||||
flowRole,
|
||||
activeFlowNode ? flowNodeFilterKey(activeFlowNode) : '',
|
||||
activeFlowLink ? `${activeFlowLink.source}\u0000${activeFlowLink.target}` : '',
|
||||
activeFlowLink
|
||||
? `${activeFlowLink.source}\u0000${activeFlowLink.target}`
|
||||
: '',
|
||||
selectedNodes.map(flowNodeFilterKey).join(','),
|
||||
selectedUsers.join(','),
|
||||
visibleStages.join(','),
|
||||
|
||||
@@ -16,8 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useMemo } from 'react'
|
||||
import { Filter, X } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
|
||||
+5
-4
@@ -16,13 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import { AreaChart, BarChart3, WalletCards } from 'lucide-react'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
|
||||
import { useThemeCustomization } from '@/context/theme-customization-provider'
|
||||
import { useTheme } from '@/context/theme-provider'
|
||||
import {
|
||||
@@ -34,6 +32,9 @@ import type {
|
||||
ConsumptionDistributionChartType,
|
||||
QuotaDataItem,
|
||||
} from '@/features/dashboard/types'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
|
||||
let themeManagerPromise: Promise<
|
||||
(typeof import('@visactor/vchart'))['ThemeManager']
|
||||
|
||||
@@ -18,10 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { formatCompactNumber, formatNumber, 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'
|
||||
@@ -34,6 +31,10 @@ import type {
|
||||
QuotaDataItem,
|
||||
DashboardFilters,
|
||||
} from '@/features/dashboard/types'
|
||||
import { formatCompactNumber, formatNumber, formatQuota } from '@/lib/format'
|
||||
import { computeTimeRange } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
interface LogStatCardsProps {
|
||||
filters?: DashboardFilters
|
||||
|
||||
@@ -16,13 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffect, useMemo, useState, useRef } from 'react'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import { PieChart as PieChartIcon } from 'lucide-react'
|
||||
import { useEffect, useMemo, useState, useRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
|
||||
import { useThemeCustomization } from '@/context/theme-customization-provider'
|
||||
import { useTheme } from '@/context/theme-provider'
|
||||
import {
|
||||
@@ -34,6 +32,9 @@ import type {
|
||||
ModelAnalyticsChartTab,
|
||||
QuotaDataItem,
|
||||
} from '@/features/dashboard/types'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
|
||||
let themeManagerPromise: Promise<
|
||||
(typeof import('@visactor/vchart'))['ThemeManager']
|
||||
|
||||
+4
-3
@@ -16,10 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useState } from 'react'
|
||||
import { Save, Settings2 } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import {
|
||||
@@ -30,7 +31,6 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import {
|
||||
CONSUMPTION_DISTRIBUTION_CHART_OPTIONS,
|
||||
MODEL_ANALYTICS_CHART_OPTIONS,
|
||||
@@ -42,6 +42,7 @@ import type {
|
||||
DashboardChartPreferences,
|
||||
ModelAnalyticsChartTab,
|
||||
} from '@/features/dashboard/types'
|
||||
import type { TimeGranularity } from '@/lib/time'
|
||||
|
||||
interface ModelsChartPreferencesProps {
|
||||
preferences: DashboardChartPreferences
|
||||
|
||||
+9
-7
@@ -16,12 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useState } from 'react'
|
||||
import { Filter, RotateCcw, Calendar, Search } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { DateTimePicker } from '@/components/datetime-picker'
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
@@ -34,8 +34,6 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { DateTimePicker } from '@/components/datetime-picker'
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import {
|
||||
TIME_GRANULARITY_OPTIONS,
|
||||
TIME_RANGE_PRESETS,
|
||||
@@ -48,6 +46,9 @@ import type {
|
||||
DashboardChartPreferences,
|
||||
DashboardFilters,
|
||||
} from '@/features/dashboard/types'
|
||||
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
interface ModelsFilterProps {
|
||||
preferences: DashboardChartPreferences
|
||||
@@ -103,7 +104,8 @@ export function ModelsFilter(props: ModelsFilterProps) {
|
||||
|
||||
const [open, setOpen] = useState(false)
|
||||
const [filters, setFilters] = useState<DashboardFilters>(
|
||||
() => props.currentFilters ?? buildDefaultDashboardFilters(props.preferences)
|
||||
() =>
|
||||
props.currentFilters ?? buildDefaultDashboardFilters(props.preferences)
|
||||
)
|
||||
const [selectedRange, setSelectedRange] = useState<number | null>(() =>
|
||||
detectQuickRangeDays(props.currentFilters)
|
||||
|
||||
+3
-2
@@ -16,11 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useMemo } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Gauge, HeartPulse, Timer } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { getPerfMetricsSummary } from '@/features/performance-metrics/api'
|
||||
import {
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
getSuccessRateTextClass,
|
||||
} from '@/features/performance-metrics/lib/format'
|
||||
import type { PerfModelSummary } from '@/features/performance-metrics/types'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const PERFORMANCE_WINDOW_HOURS = 24
|
||||
const TOP_MODEL_LIMIT = 6
|
||||
|
||||
+4
-3
@@ -17,10 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { RichContent } from '@/components/rich-content'
|
||||
import { formatDateTimeObject } from '@/lib/time'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
|
||||
import { Dialog } from '@/components/dialog'
|
||||
import { RichContent } from '@/components/rich-content'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { formatDateTimeObject } from '@/lib/time'
|
||||
|
||||
interface AnnouncementDetailModalProps {
|
||||
open: boolean
|
||||
|
||||
+6
-4
@@ -16,16 +16,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { memo, useState } from 'react'
|
||||
import { Megaphone } from 'lucide-react'
|
||||
import { memo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { getAnnouncementColorClass } from '@/lib/colors'
|
||||
import { formatDateTimeObject } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { useAnnouncements } from '@/features/dashboard/hooks/use-status-data'
|
||||
import { getPreviewText } from '@/features/dashboard/lib'
|
||||
import type { AnnouncementItem } from '@/features/dashboard/types'
|
||||
import { getAnnouncementColorClass } from '@/lib/colors'
|
||||
import { formatDateTimeObject } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { PanelWrapper } from '../ui/panel-wrapper'
|
||||
import { AnnouncementDetailModal } from './announcement-detail-dialog'
|
||||
|
||||
|
||||
@@ -18,16 +18,17 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { Zap, ExternalLink, Gauge } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { getBgColorClass } from '@/lib/colors'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
import { CopyButton } from '@/components/copy-button'
|
||||
import { StatusBadge } from '@/components/status-badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
getLatencyColorClass,
|
||||
openExternalSpeedTest,
|
||||
} from '@/features/dashboard/lib/api-info'
|
||||
import type { ApiInfoItem, PingStatus } from '@/features/dashboard/types'
|
||||
import { getBgColorClass } from '@/lib/colors'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface ApiInfoItemProps {
|
||||
item: ApiInfoItem
|
||||
|
||||
@@ -16,9 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useState, useCallback } from 'react'
|
||||
import { Route } from 'lucide-react'
|
||||
import { useState, useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { useApiInfo } from '@/features/dashboard/hooks/use-status-data'
|
||||
import {
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
getDefaultPingStatus,
|
||||
} from '@/features/dashboard/lib/api-info'
|
||||
import type { PingStatusMap, ApiInfoItem } from '@/features/dashboard/types'
|
||||
|
||||
import { PanelWrapper } from '../ui/panel-wrapper'
|
||||
import { ApiInfoItemComponent } from './api-info-item'
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { HelpCircle } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
@@ -28,6 +29,7 @@ import { Markdown } from '@/components/ui/markdown'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { useFAQ } from '@/features/dashboard/hooks/use-status-data'
|
||||
import type { FAQItem } from '@/features/dashboard/types'
|
||||
|
||||
import { PanelWrapper } from '../ui/panel-wrapper'
|
||||
|
||||
export function FAQPanel() {
|
||||
|
||||
+10
-8
@@ -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 { useMemo, useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Link } from '@tanstack/react-router'
|
||||
import {
|
||||
@@ -38,21 +37,24 @@ import {
|
||||
type LucideIcon,
|
||||
} from 'lucide-react'
|
||||
import { motion, useReducedMotion } from 'motion/react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from 'sonner'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { getUserModels } from '@/lib/api'
|
||||
import { MOTION_TRANSITION } from '@/lib/motion'
|
||||
import { ROLE } from '@/lib/roles'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
import {
|
||||
CardStaggerContainer,
|
||||
CardStaggerItem,
|
||||
} from '@/components/page-transition'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { fetchTokenKey, getApiKeys } from '@/features/keys/api'
|
||||
import type { ApiKey } from '@/features/keys/types'
|
||||
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
||||
import { getUserModels } from '@/lib/api'
|
||||
import { MOTION_TRANSITION } from '@/lib/motion'
|
||||
import { ROLE } from '@/lib/roles'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
import {
|
||||
useApiInfo,
|
||||
useDashboardContentVisibility,
|
||||
|
||||
+3
-2
@@ -16,11 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useMemo } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Gauge, HeartPulse, Timer } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { getPerfMetricsSummary } from '@/features/performance-metrics/api'
|
||||
import {
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
getSuccessRateTextClass,
|
||||
} from '@/features/performance-metrics/lib/format'
|
||||
import type { PerfModelSummary } from '@/features/performance-metrics/types'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const PERFORMANCE_WINDOW_HOURS = 24
|
||||
const TOP_MODEL_LIMIT = 6
|
||||
|
||||
@@ -16,22 +16,24 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useMemo } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Link } from '@tanstack/react-router'
|
||||
import { ArrowRight, Flame, ShieldCheck, TrendingDown } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
import { StaggerContainer, StaggerItem } from '@/components/page-transition'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { getUserQuotaDates } from '@/features/dashboard/api'
|
||||
import { useSummaryCardsConfig } from '@/features/dashboard/hooks/use-dashboard-config'
|
||||
import type { QuotaDataItem } from '@/features/dashboard/types'
|
||||
import { useStatus } from '@/hooks/use-status'
|
||||
import { getCurrencyLabel, isCurrencyDisplayEnabled } from '@/lib/currency'
|
||||
import { formatNumber, formatQuota } from '@/lib/format'
|
||||
import { computeTimeRange } from '@/lib/time'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useStatus } from '@/hooks/use-status'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { StaggerContainer, StaggerItem } from '@/components/page-transition'
|
||||
import { getUserQuotaDates } from '@/features/dashboard/api'
|
||||
import { useSummaryCardsConfig } from '@/features/dashboard/hooks/use-dashboard-config'
|
||||
import type { QuotaDataItem } from '@/features/dashboard/types'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
import { StatCard } from '../ui/stat-card'
|
||||
|
||||
const SUMMARY_SPARKLINE_BUCKETS = 12
|
||||
|
||||
@@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import { Activity, RotateCw } from 'lucide-react'
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { getUptimeStatus } from '@/features/dashboard/api'
|
||||
@@ -27,6 +27,8 @@ import type {
|
||||
UptimeGroupResult,
|
||||
UptimeMonitor,
|
||||
} from '@/features/dashboard/types'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { PanelWrapper } from '../ui/panel-wrapper'
|
||||
|
||||
const STATUS_COLOR_MAP: Record<number, string> = {
|
||||
|
||||
@@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { type ReactNode } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface PanelWrapperProps {
|
||||
title: ReactNode
|
||||
|
||||
@@ -16,10 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useId, type ReactNode } from 'react'
|
||||
import { type LucideIcon } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useId, type ReactNode } from 'react'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
type StatCardTone = 'rose' | 'teal' | 'gray'
|
||||
type StatCardSparklineVariant = 'bars' | 'line'
|
||||
|
||||
@@ -16,16 +16,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffect, useMemo, useState, useRef, useCallback } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import { Users, Loader2 } from 'lucide-react'
|
||||
import { useEffect, useMemo, useState, useRef, useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
import { useTheme } from '@/context/theme-provider'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { useTheme } from '@/context/theme-provider'
|
||||
import { getUserQuotaDataByUsers } from '@/features/dashboard/api'
|
||||
import {
|
||||
TIME_GRANULARITY_OPTIONS,
|
||||
@@ -40,6 +39,8 @@ import type {
|
||||
ProcessedUserChartData,
|
||||
UserChartsFilters,
|
||||
} from '@/features/dashboard/types'
|
||||
import { getRollingDateRange, type TimeGranularity } from '@/lib/time'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
|
||||
let themeManagerPromise: Promise<
|
||||
(typeof import('@visactor/vchart'))['ThemeManager']
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
type LucideIcon,
|
||||
} from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { safeDivide } from '@/features/dashboard/lib'
|
||||
|
||||
interface StatCardConfig {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useStatus } from '@/hooks/use-status'
|
||||
|
||||
import type { AnnouncementItem, ApiInfoItem, FAQItem } from '../types'
|
||||
|
||||
/**
|
||||
|
||||
+7
-5
@@ -16,12 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useState, useCallback, useMemo, lazy, Suspense } from 'react'
|
||||
import { getRouteApi, useNavigate } from '@tanstack/react-router'
|
||||
import { Eye, EyeOff } from 'lucide-react'
|
||||
import { useState, useCallback, useMemo, lazy, Suspense } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { ROLE } from '@/lib/roles'
|
||||
|
||||
import { SectionPageLayout } from '@/components/layout'
|
||||
import { FadeIn } from '@/components/page-transition'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
@@ -30,8 +31,9 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip'
|
||||
import { SectionPageLayout } from '@/components/layout'
|
||||
import { FadeIn } from '@/components/page-transition'
|
||||
import { ROLE } from '@/lib/roles'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
import { ModelsChartPreferences } from './components/models/models-chart-preferences'
|
||||
import { ModelsFilter } from './components/models/models-filter-dialog'
|
||||
import { OverviewDashboard } from './components/overview/overview-dashboard'
|
||||
|
||||
+3
-2
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import type { TFunction } from 'i18next'
|
||||
|
||||
import { createSectionRegistry } from '@/features/system-settings/utils/section-registry'
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user