mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-07 01:56:53 +00:00
🎨 fix(theme): align UI controls with global radius tokens
Remove hard-coded and capped border radius overrides so shared controls and feature actions consistently follow the active theme radius. - Replace fixed radius utilities with semantic theme-aware radius tokens - Remove redundant `rounded-full` and pixel-based overrides from header, toolbar, Playground, and utility actions - Drop unused `StatusBadge` rounded prop usage - Keep existing component behavior intact while improving global theme consistency
This commit is contained in:
@@ -2,8 +2,10 @@ import { useMemo } from 'react'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import { PieChart } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import { useChartTheme } from '@/lib/use-chart-theme'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
import { useThemeCustomization } from '@/context/theme-customization-provider'
|
||||
import { formatShare, formatTokens } from '../lib/format'
|
||||
import type { RankingPeriod, VendorRanking, VendorShareSeries } from '../types'
|
||||
import { VendorLink } from './entity-links'
|
||||
@@ -84,6 +86,11 @@ type MarketShareSectionProps = {
|
||||
export function MarketShareSection(props: MarketShareSectionProps) {
|
||||
const { t } = useTranslation()
|
||||
const { resolvedTheme, themeReady } = useChartTheme()
|
||||
const { customization } = useThemeCustomization()
|
||||
const barRadius = useThemeRadiusPx(
|
||||
'--radius-sm',
|
||||
`${customization.preset}:${customization.radius}`
|
||||
)
|
||||
|
||||
const colourMap = useMemo(
|
||||
() => buildVendorColourMap(props.history.vendors.map((v) => v.name)),
|
||||
@@ -112,7 +119,9 @@ export function MarketShareSection(props: MarketShareSectionProps) {
|
||||
stack: true,
|
||||
paddingInner: 0.12,
|
||||
legends: { visible: false },
|
||||
bar: { style: { cornerRadius: 1 } },
|
||||
bar: {
|
||||
style: barRadius == null ? {} : { cornerRadius: barRadius },
|
||||
},
|
||||
color: { specified: colourMap },
|
||||
axes: [
|
||||
{
|
||||
@@ -175,7 +184,7 @@ export function MarketShareSection(props: MarketShareSectionProps) {
|
||||
},
|
||||
animationAppear: { duration: 500 },
|
||||
}
|
||||
}, [colourMap, orderedPoints])
|
||||
}, [barRadius, colourMap, orderedPoints])
|
||||
|
||||
const visible = props.rows.slice(0, MAX_VENDORS_IN_LIST)
|
||||
const half = Math.ceil(visible.length / 2)
|
||||
|
||||
@@ -2,8 +2,10 @@ import { useMemo } from 'react'
|
||||
import { VChart } from '@visactor/react-vchart'
|
||||
import { BarChart3, Trophy } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
||||
import { useChartTheme } from '@/lib/use-chart-theme'
|
||||
import { VCHART_OPTION } from '@/lib/vchart'
|
||||
import { useThemeCustomization } from '@/context/theme-customization-provider'
|
||||
import { formatTokens } from '../lib/format'
|
||||
import type { ModelHistorySeries, ModelRanking, RankingPeriod } from '../types'
|
||||
import { ModelLeaderboard } from './model-leaderboard'
|
||||
@@ -32,6 +34,11 @@ type ModelsSectionProps = {
|
||||
export function ModelsSection(props: ModelsSectionProps) {
|
||||
const { t } = useTranslation()
|
||||
const { resolvedTheme, themeReady } = useChartTheme()
|
||||
const { customization } = useThemeCustomization()
|
||||
const barRadius = useThemeRadiusPx(
|
||||
'--radius-sm',
|
||||
`${customization.preset}:${customization.radius}`
|
||||
)
|
||||
|
||||
// Order points so the largest model appears at the bottom of every stack.
|
||||
const orderedPoints = useMemo(() => {
|
||||
@@ -59,7 +66,9 @@ export function ModelsSection(props: ModelsSectionProps) {
|
||||
yField: 'tokens',
|
||||
seriesField: 'model',
|
||||
stack: true,
|
||||
bar: { style: { cornerRadius: 1 } },
|
||||
bar: {
|
||||
style: barRadius == null ? {} : { cornerRadius: barRadius },
|
||||
},
|
||||
legends: { visible: false },
|
||||
axes: [
|
||||
{
|
||||
@@ -132,7 +141,7 @@ export function ModelsSection(props: ModelsSectionProps) {
|
||||
},
|
||||
animationAppear: { duration: 500 },
|
||||
}
|
||||
}, [orderedPoints, t])
|
||||
}, [barRadius, orderedPoints, t])
|
||||
|
||||
return (
|
||||
<section className='bg-card overflow-hidden rounded-lg border'>
|
||||
|
||||
Reference in New Issue
Block a user