import { Input } from '@/ui/components/ui/input'
import { Label } from '@/ui/components/ui/label'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/ui/components/ui/select'
import { Switch as ShadcnSwitch } from '@/ui/components/ui/switch'
import { Textarea } from '@/ui/components/ui/textarea'
import React from 'react'
import { PROVIDERS } from './constants'
import { ThinkingLevel } from './types'
import { m } from '@/ui/paraglide/messages.js'
// --- Section Header ---
export const SectionLabel: React.FC<{
label: string
subLabel?: string
htmlFor?: string
}> = ({ label, subLabel, htmlFor }) => (
{subLabel &&
{subLabel}
}
)
// --- Text Input ---
interface TextInputProps extends React.ComponentProps {
label: string
}
export const TextInput: React.FC = ({ label, className = '', id, ...props }) => (
)
// --- Agent Type Selector ---
export const AgentTypeSelector: React.FC<{
value: 'chat' | 'autofill'
onChange: (val: 'chat' | 'autofill') => void
}> = ({ value, onChange }) => {
return (
)
}
// --- Text Area ---
interface TextAreaProps extends React.ComponentProps {
label: string
subLabel?: string
}
export const TextArea: React.FC = ({
label,
subLabel,
className = '',
id,
...props
}) => (
)
// --- Provider & Model Selector ---
interface ModelSelectorProps {
provider: string | undefined
model: string | undefined
models: string[]
onProviderChange: (p: string) => void
onModelChange: (m: string) => void
label?: string // Optional custom label
subLabel?: string
}
export const ModelSelector: React.FC = ({
provider,
model,
models,
onProviderChange,
onModelChange,
label = m.ai_provider(),
subLabel,
}) => {
return (
)
}
// --- Thinking Level Selector ---
interface ThinkingLevelSelectorProps {
value: ThinkingLevel | string | undefined
onChange: (val: ThinkingLevel) => void
disabled?: boolean
label?: string
}
export const ThinkingLevelSelector: React.FC = ({
value,
onChange,
disabled,
label = m.thinking_strength(),
}) => {
const levels = [
{
id: ThinkingLevel.DISABLED,
label: m.thinking_disable(),
desc: m.standard_generation(),
},
{ id: ThinkingLevel.LOW, label: m.thinking_low(), desc: m.quick_reasoning() },
{ id: ThinkingLevel.MEDIUM, label: m.thinking_medium(), desc: m.balanced_thought() },
{ id: ThinkingLevel.HIGH, label: m.thinking_high(), desc: m.deep_reasoning() },
]
return (
{levels.map((level) => {
const isSelected = value === level.id
return (
)
})}
)
}
// --- Toggle Switch ---
interface SwitchProps {
label: string
description?: string
checked: boolean | undefined // Handle optional/undefined from API
onChange: (checked: boolean) => void
}
export const Switch: React.FC = ({ label, description, checked, onChange }) => {
const isChecked = !!checked
return (
{description &&
{description}
}
)
}