'use client'; import React from 'react'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'; import { Button } from '@/components/ui/button'; import { Check, ChevronDown, Crown, LockIcon } from 'lucide-react'; import { ModelOption, SubscriptionTier } from './_use-model-selection'; interface ModelSelectorProps { selectedModel: string; onModelChange: (modelId: string) => void; modelOptions: ModelOption[]; currentTier: SubscriptionTier; canAccessModel: (modelId: string) => boolean; } export const ModelSelector: React.FC = ({ selectedModel, onModelChange, modelOptions, currentTier, canAccessModel, }) => { const selectedModelLabel = modelOptions.find((option) => option.id === selectedModel)?.label || ''; const handleModelSelection = (modelId: string) => { if (canAccessModel(modelId)) { onModelChange(modelId); } }; const getModelTierInfo = (modelTier: string) => { switch (modelTier) { case 'base-only': return { icon: , tooltip: 'Requires Pro plan or higher', }; case 'extra-only': return { icon: , tooltip: 'Requires Pro plan', }; default: return { icon: null, tooltip: null }; } }; return (
{modelOptions.map((option) => { const { icon, tooltip } = getModelTierInfo(option.tier); const isAccessible = canAccessModel(option.id); return ( handleModelSelection(option.id)} >
{option.label} {icon} {!isAccessible && }
{selectedModel === option.id && ( )}
{tooltip && (

{tooltip}

)}
); })}
); };