'use client' import produce from 'immer' import React, { useCallback } from 'react' import { useTranslation } from 'react-i18next' import type { OnFeaturesChange } from '../../types' import { useFeatures, useFeaturesStore, } from '../../hooks' import ParamConfig from './param-config' import Switch from '@/app/components/base/switch' import { File05 } from '@/app/components/base/icons/src/vender/solid/files' type FileUploadProps = { onChange?: OnFeaturesChange disabled?: boolean } const FileUpload = ({ onChange, disabled, }: FileUploadProps) => { const { t } = useTranslation() const featuresStore = useFeaturesStore() const file = useFeatures(s => s.features.file) const handleSwitch = useCallback((value: boolean) => { const { features, setFeatures, } = featuresStore!.getState() const newFeatures = produce(features, (draft) => { if (draft.file?.image) draft.file.image.enabled = value }) setFeatures(newFeatures) if (onChange) onChange(newFeatures) }, [featuresStore, onChange]) return (