Skip to content

Commit 82f52ff

Browse files
authored
feat(desktop): show the Modelflare logo on its provider preset (#1584)
1 parent 0a16710 commit 82f52ff

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎desktop/src/pages/settings/ProviderSettings.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ describe('active sponsor providers', () => {
195195
expect(sponsor.nextElementSibling).toBe(dialog.getByRole('button', { name: 'Atlas Cloud' }))
196196
expect(within(sponsor).getByText('New')).toBeInTheDocument()
197197
expect(within(sponsor).getByLabelText('Sponsor')).toBeInTheDocument()
198+
expect(sponsor.querySelector('img')?.getAttribute('src')).toContain('modelflare-logo')
199+
expect(dialog.getByRole('button', { name: 'AruHub' }).querySelector('img')?.getAttribute('src')).toContain('aruhub-logo')
200+
expect(dialog.getByRole('button', { name: 'Atlas Cloud' }).querySelector('img')).toBeNull()
198201
expect(dialog.queryByRole('button', { name: 'ApiSmart' })).not.toBeInTheDocument()
199202

200203
fireEvent.click(sponsor)

‎desktop/src/pages/settings/ProviderSettings.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
Wrench,
3131
} from 'lucide-react'
3232
import aruhubLogo from '../../../../docs/images/sponsors/aruhub-logo.png'
33+
import modelflareLogo from '../../../../docs/images/sponsors/modelflare-logo.png'
3334
import { useSettingsStore } from '../../stores/settingsStore'
3435
import { useProviderStore } from '../../stores/providerStore'
3536
import { useUIStore } from '../../stores/uiStore'
@@ -69,6 +70,11 @@ import { getDesktopHost } from '../../lib/desktopHost'
6970
import { API_KEY_JSON_PLACEHOLDER, maskSettingsJsonSecrets, restoreSettingsJsonSecrets, stripProviderSettingsJsonEnv } from '../../lib/providerSettingsJson'
7071
import { cx } from '@/lib/cx'
7172

73+
const SPONSOR_LOGOS: Record<string, string> = {
74+
aruhub: aruhubLogo,
75+
modelflare: modelflareLogo,
76+
}
77+
7278
/** Section label inside the provider dialog — the same 13px label as a settings section. */
7379
const FORM_SECTION_LABEL = 'block text-[13px] font-semibold text-[var(--color-text-secondary)]'
7480
/** Field label matching `Input`'s own, for the fields that cannot use `Input` directly. */
@@ -1730,9 +1736,9 @@ function ProviderFormModal({ open, onClose, mode, provider, presets, browserMode
17301736
selected={selectedPreset.id === preset.id}
17311737
onClick={() => handlePresetChange(preset)}
17321738
>
1733-
{preset.id === 'aruhub' && <img src={aruhubLogo} alt="" className="size-4 rounded-[var(--radius-sm)] object-contain" />}
1739+
{SPONSOR_LOGOS[preset.id] && <img src={SPONSOR_LOGOS[preset.id]} alt="" className="size-4 rounded-[var(--radius-sm)] object-contain" />}
17341740
{presetLabel(preset)}
1735-
{(preset.id === 'aruhub' || preset.id === 'modelflare') && <Star size={12} className="fill-[var(--color-warning)] text-[var(--color-warning)]" aria-label={t('settings.providers.sponsor')} />}
1741+
{SPONSOR_LOGOS[preset.id] && <Star size={12} className="fill-[var(--color-warning)] text-[var(--color-warning)]" aria-label={t('settings.providers.sponsor')} />}
17361742
{preset.isNew && (
17371743
<Badge tone="warning" size="xs" className="absolute -right-1 -top-2">
17381744
{t('settings.providers.new')}
22.3 KB
Loading

0 commit comments

Comments
 (0)