/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. */ import React from 'react'; import { Input, Typography, Button, Switch } from '@douyinfe/semi-ui'; import { IconFile } from '@douyinfe/semi-icons'; import { Plus, X, Film } from 'lucide-react'; import { useTranslation } from 'react-i18next'; const VideoUrlInput = ({ videoUrls, videoEnabled, onVideoUrlsChange, onVideoEnabledChange, allowToggle = true, disabled = false, }) => { const { t } = useTranslation(); const handleAdd = () => { onVideoUrlsChange([...(videoUrls || []), '']); }; const handleUpdate = (index, value) => { const next = [...(videoUrls || [])]; next[index] = value; onVideoUrlsChange(next); }; const handleRemove = (index) => { onVideoUrlsChange((videoUrls || []).filter((_, i) => i !== index)); }; const enabled = videoEnabled !== false; const list = videoUrls || []; return (
{t('视频地址')} {disabled && ( ({t('已在自定义模式中忽略')}) )}
{allowToggle && ( )}
{!enabled ? ( {t('体验视频地址停用提示', '启用后可添加视频 URL(视频生视频、视频编辑等)')} ) : list.length === 0 ? ( {t('体验视频地址空列表提示', '点击 + 添加 .mp4 / .mov 等可访问的视频链接')} ) : ( {t('已添加')} {list.length} {t('个视频')} )}
{list.map((url, index) => (
handleUpdate(index, value)} className='!rounded-lg' size='small' prefix={} disabled={!enabled || disabled} />
))}
); }; export default VideoUrlInput;