Skip to content

Commit 5ef97b2

Browse files
committed
fix(models, integrations): dedup ChevronArrow/provider colors, fix UTC date rendering
- Extract PROVIDER_COLORS and getProviderColor to model-colors.ts to eliminate identical definitions in model-comparison-charts and model-timeline-chart - Remove duplicate private ChevronArrow from integration-card; import the exported one from model-primitives instead - Add timeZone: 'UTC' to formatShortDate so ISO date-only strings (parsed as UTC midnight) render the correct calendar day in all timezones
1 parent d4199fe commit 5ef97b2

File tree

4 files changed

+25
-77
lines changed

4 files changed

+25
-77
lines changed

apps/sim/app/(landing)/integrations/components/integration-card.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ComponentType, SVGProps } from 'react'
22
import Link from 'next/link'
33
import type { Integration } from '@/app/(landing)/integrations/data/types'
4+
import { ChevronArrow } from '@/app/(landing)/models/components/model-primitives'
45
import { IntegrationIcon } from './integration-icon'
56

67
interface IntegrationCardProps {
@@ -81,39 +82,3 @@ export function IntegrationRow({ integration, IconComponent }: IntegrationRowPro
8182
</>
8283
)
8384
}
84-
85-
/**
86-
* Animated chevron arrow matching the footer/landing pattern.
87-
* Line scales in from left, chevron translates right on hover.
88-
*/
89-
function ChevronArrow() {
90-
return (
91-
<svg
92-
className='h-3 w-3 shrink-0 text-[var(--landing-text-subtle)]'
93-
viewBox='0 0 10 10'
94-
fill='none'
95-
xmlns='http://www.w3.org/2000/svg'
96-
aria-hidden='true'
97-
>
98-
<line
99-
x1='0'
100-
y1='5'
101-
x2='9'
102-
y2='5'
103-
stroke='currentColor'
104-
strokeWidth='1.33'
105-
strokeLinecap='square'
106-
className='origin-left scale-x-0 transition-transform duration-200 ease-out [transform-box:fill-box] group-hover/link:scale-x-100'
107-
/>
108-
<path
109-
d='M3.5 2L6.5 5L3.5 8'
110-
stroke='currentColor'
111-
strokeWidth='1.33'
112-
strokeLinecap='square'
113-
strokeLinejoin='miter'
114-
fill='none'
115-
className='transition-transform duration-200 ease-out group-hover/link:translate-x-[30%]'
116-
/>
117-
</svg>
118-
)
119-
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const PROVIDER_COLORS: Record<string, string> = {
2+
anthropic: '#D97757',
3+
openai: '#E8E8E8',
4+
google: '#4285F4',
5+
xai: '#555555',
6+
mistral: '#F7D046',
7+
groq: '#F55036',
8+
cerebras: '#6D5BF7',
9+
deepseek: '#4D6BFE',
10+
fireworks: '#FF6D3A',
11+
bedrock: '#FF9900',
12+
}
13+
14+
const DEFAULT_COLOR = '#888888'
15+
16+
export function getProviderColor(providerId: string): string {
17+
return PROVIDER_COLORS[providerId] ?? DEFAULT_COLOR
18+
}

apps/sim/app/(landing)/models/components/model-comparison-charts.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,14 @@
33
import type { ComponentType } from 'react'
44
import { useMemo } from 'react'
55
import Link from 'next/link'
6+
import { getProviderColor } from '@/app/(landing)/models/components/model-colors'
67
import type { CatalogModel } from '@/app/(landing)/models/utils'
78
import {
89
formatPrice,
910
formatTokenCount,
1011
MODEL_CATALOG_PROVIDERS,
1112
} from '@/app/(landing)/models/utils'
1213

13-
const PROVIDER_COLORS: Record<string, string> = {
14-
anthropic: '#D97757',
15-
openai: '#E8E8E8',
16-
google: '#4285F4',
17-
xai: '#555555',
18-
mistral: '#F7D046',
19-
groq: '#F55036',
20-
cerebras: '#6D5BF7',
21-
deepseek: '#4D6BFE',
22-
fireworks: '#FF6D3A',
23-
bedrock: '#FF9900',
24-
}
25-
26-
const DEFAULT_COLOR = '#888888'
27-
28-
function getColor(providerId: string): string {
29-
return PROVIDER_COLORS[providerId] ?? DEFAULT_COLOR
30-
}
31-
3214
/** Providers that host other providers' models — deprioritized to avoid duplicates. */
3315
const RESELLER_PROVIDERS = new Set([
3416
'azure-openai',
@@ -128,7 +110,7 @@ function StackedCostChart({ models }: ChartProps) {
128110
{data.entries.map(({ model, input, output, total }) => {
129111
const totalPct = data.maxTotal > 0 ? (total / data.maxTotal) * 100 : 0
130112
const inputPct = total > 0 ? (input / total) * 100 : 0
131-
const color = getColor(model.providerId)
113+
const color = getProviderColor(model.providerId)
132114

133115
return (
134116
<Link
@@ -201,7 +183,7 @@ function ContextWindowChart({ models }: ChartProps) {
201183
<div className='flex flex-col gap-1.5'>
202184
{data.entries.map(({ model, value }) => {
203185
const pct = data.maxValue > 0 ? (value / data.maxValue) * 100 : 0
204-
const color = getColor(model.providerId)
186+
const color = getProviderColor(model.providerId)
205187

206188
return (
207189
<Link

apps/sim/app/(landing)/models/components/model-timeline-chart.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,16 @@
22

33
import { useMemo } from 'react'
44
import Link from 'next/link'
5+
import { getProviderColor } from '@/app/(landing)/models/components/model-colors'
56
import type { CatalogModel } from '@/app/(landing)/models/utils'
67

7-
const PROVIDER_COLORS: Record<string, string> = {
8-
anthropic: '#D97757',
9-
openai: '#E8E8E8',
10-
google: '#4285F4',
11-
xai: '#555555',
12-
mistral: '#F7D046',
13-
groq: '#F55036',
14-
cerebras: '#6D5BF7',
15-
deepseek: '#4D6BFE',
16-
fireworks: '#FF6D3A',
17-
bedrock: '#FF9900',
18-
}
19-
20-
const DEFAULT_COLOR = '#888888'
21-
22-
function getColor(providerId: string): string {
23-
return PROVIDER_COLORS[providerId] ?? DEFAULT_COLOR
24-
}
25-
268
function formatShortDate(date: string): string {
279
try {
2810
return new Intl.DateTimeFormat('en-US', {
2911
month: 'short',
3012
day: 'numeric',
3113
year: 'numeric',
14+
timeZone: 'UTC',
3215
}).format(new Date(date))
3316
} catch {
3417
return date
@@ -56,7 +39,7 @@ export function ModelTimelineChart({ models, providerId }: ModelTimelineChartPro
5639

5740
if (entries.length === 0) return null
5841

59-
const color = getColor(providerId)
42+
const color = getProviderColor(providerId)
6043

6144
return (
6245
<section aria-labelledby='timeline-heading'>

0 commit comments

Comments
 (0)