feat: add featured flag to control star badge on provider presets
Star badge is now driven by the `featured` field in provider-presets.json. Currently no preset has featured=true, so no stars are shown. Can be toggled on per-provider remotely without code changes. Made-with: Cursor
This commit is contained in:
1 parent
761cae5073
commit
4ad668c643
3 files changed
+9
-2
No files matched your search
@@ -32,7 +32,8 @@ type ProviderPreset struct {
|
||||
DescriptionZh string `json:"description_zh,omitempty"`
|
||||
Features []string `json:"features,omitempty"`
|
||||
Thinking string `json:"thinking,omitempty"`
|
||||
Tier int `json:"tier"` // sponsor ranking: lower = higher priority
|
||||
Tier int `json:"tier"` // sponsor ranking: lower = higher priority
|
||||
Featured bool `json:"featured,omitempty"` // show a star badge when true
|
||||
Website string `json:"website,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface ProviderPreset {
|
||||
features?: string[];
|
||||
thinking?: string;
|
||||
tier: number;
|
||||
featured?: boolean;
|
||||
website?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Plug, Plus, Trash2, Pencil, ExternalLink, Sparkles, X, Eye, EyeOff,
|
||||
Plug, Plus, Trash2, Pencil, ExternalLink, Star, Sparkles, X, Eye, EyeOff,
|
||||
} from 'lucide-react';
|
||||
import { Card, Button, Badge, Modal, Input } from '@/components/ui';
|
||||
import {
|
||||
@@ -268,6 +268,11 @@ function PresetGrid({
|
||||
const added = existingNames.has(p.name);
|
||||
return (
|
||||
<Card key={p.name} className="relative overflow-hidden">
|
||||
{p.featured && (
|
||||
<div className="absolute top-0 right-0 bg-amber-400/90 text-white text-[10px] font-bold px-2 py-0.5 rounded-bl-lg">
|
||||
<Star size={10} className="inline mr-0.5 -mt-0.5" />
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900 dark:text-white">{p.display_name || p.name}</h3>
|
||||
|
||||
Reference in new issue
Block a user