import type { ReactNode } from 'react' import { Loader2 } from 'lucide-react' import type { PlayProfileInput } from '../api/play_profiles' import type { Library, PlayProfile } from '../types' type ProfileFormUpdate = (patch: Partial) => void export function ProfileIdentityFields({ form, editing, update, }: { form: PlayProfileInput editing: PlayProfile | null update: ProfileFormUpdate }) { return ( <> update({ name: event.target.value })} /> update({ is_default: value })} /> update({ allow_adult: value })} /> update({ require_pin: value })} /> {form.require_pin && ( update({ pin: event.target.value })} /> )} ) } export function ProfilePreferenceFields({ form, update, }: { form: PlayProfileInput update: ProfileFormUpdate }) { return ( <>
update({ autoplay_next: value })} /> update({ skip_intro: value })} /> ) } export function ProfileLibraryAccessField({ form, libraries, onToggleLibrary, }: { form: PlayProfileInput libraries: Library[] onToggleLibrary: (id: string) => void }) { return (
{libraries.map((library) => ( ))} {libraries.length === 0 && ( 暂无媒体库 )}
) } export function ProfileFormActions({ saving, onClose, }: { saving: boolean onClose: () => void }) { return (
) } function Field({ label, children }: { label: string; children: ReactNode }) { return ( ) } function Toggle({ label, hint, checked, onChange, }: { label: string hint?: string checked: boolean onChange: (value: boolean) => void }) { return ( ) }