forked from 77media/video-flow
模版禁用时长选择
This commit is contained in:
parent
93269b2bde
commit
dcb07e6c6c
@ -20,6 +20,8 @@ interface ConfigPanelProps {
|
|||||||
isMobile?: boolean;
|
isMobile?: boolean;
|
||||||
/** Whether it's desktop device */
|
/** Whether it's desktop device */
|
||||||
isDesktop?: boolean;
|
isDesktop?: boolean;
|
||||||
|
/** Whether to disable duration selection */
|
||||||
|
disableDuration?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +38,7 @@ export const ConfigPanel = ({
|
|||||||
onConfigChange,
|
onConfigChange,
|
||||||
isMobile = false,
|
isMobile = false,
|
||||||
isDesktop = true,
|
isDesktop = true,
|
||||||
|
disableDuration = false,
|
||||||
}: ConfigPanelProps) => {
|
}: ConfigPanelProps) => {
|
||||||
/** Language dropdown menu items */
|
/** Language dropdown menu items */
|
||||||
const languageMenuItems = LanguageOptions.map((option) => ({
|
const languageMenuItems = LanguageOptions.map((option) => ({
|
||||||
@ -104,10 +107,16 @@ export const ConfigPanel = ({
|
|||||||
className: 'bg-[#1a1a1a] border border-white/10'
|
className: 'bg-[#1a1a1a] border border-white/10'
|
||||||
}}
|
}}
|
||||||
trigger={['click']}
|
trigger={['click']}
|
||||||
|
disabled={disableDuration}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
data-alt="config-video-duration"
|
data-alt="config-video-duration"
|
||||||
className="h-8 px-2 rounded-full border border-white/20 bg-transparent hover:bg-white/5 hover:border-cyan-400/60 transition-all duration-200 flex items-center gap-2 text-gray-300 hover:text-cyan-400"
|
className={`h-8 px-2 rounded-full border transition-all duration-200 flex items-center gap-2 ${
|
||||||
|
disableDuration
|
||||||
|
? 'opacity-40 cursor-not-allowed border-white/20 bg-transparent text-gray-400'
|
||||||
|
: 'border-white/20 bg-transparent hover:bg-white/5 hover:border-cyan-400/60 text-gray-300 hover:text-cyan-400'
|
||||||
|
}`}
|
||||||
|
disabled={disableDuration}
|
||||||
>
|
>
|
||||||
<ClockCircleOutlined className="text-base" />
|
<ClockCircleOutlined className="text-base" />
|
||||||
<span className="text-sm capitalize">{currentDuration}</span>
|
<span className="text-sm capitalize">{currentDuration}</span>
|
||||||
|
|||||||
@ -22,6 +22,8 @@ interface MobileConfigModalProps {
|
|||||||
configOptions: ConfigOptions;
|
configOptions: ConfigOptions;
|
||||||
/** Handler for configuration changes */
|
/** Handler for configuration changes */
|
||||||
onConfigChange: <K extends keyof ConfigOptions>(key: K, value: ConfigOptions[K], exclude?: boolean) => void;
|
onConfigChange: <K extends keyof ConfigOptions>(key: K, value: ConfigOptions[K], exclude?: boolean) => void;
|
||||||
|
/** Whether to disable duration selection */
|
||||||
|
disableDuration?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +40,7 @@ export function MobileConfigModal({
|
|||||||
onClose,
|
onClose,
|
||||||
configOptions,
|
configOptions,
|
||||||
onConfigChange,
|
onConfigChange,
|
||||||
|
disableDuration = false,
|
||||||
}: MobileConfigModalProps) {
|
}: MobileConfigModalProps) {
|
||||||
const [animeOptions, setAnimeOptions] = useState<Array<{ name: string; pcode: string }>>([]);
|
const [animeOptions, setAnimeOptions] = useState<Array<{ name: string; pcode: string }>>([]);
|
||||||
|
|
||||||
@ -170,14 +173,17 @@ export function MobileConfigModal({
|
|||||||
<ClockCircleOutlined className="text-base text-cyan-400" />
|
<ClockCircleOutlined className="text-base text-cyan-400" />
|
||||||
<span className="text-sm text-gray-300">Duration</span>
|
<span className="text-sm text-gray-300">Duration</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center p-0.5 rounded-lg border border-white/20 bg-black/20">
|
<div className={`flex items-center p-0.5 rounded-lg border border-white/20 bg-black/20 ${disableDuration ? 'opacity-40' : ''}`}>
|
||||||
{VideoDurationOptions.map((option) => (
|
{VideoDurationOptions.map((option) => (
|
||||||
<button
|
<button
|
||||||
key={option.value}
|
key={option.value}
|
||||||
data-alt={`duration-${option.value}`}
|
data-alt={`duration-${option.value}`}
|
||||||
onClick={() => onConfigChange('videoDuration', option.value as VideoDurationValue)}
|
onClick={() => !disableDuration && onConfigChange('videoDuration', option.value as VideoDurationValue)}
|
||||||
|
disabled={disableDuration}
|
||||||
className={`h-7 px-3 rounded-md transition-all duration-200 text-xs font-medium ${
|
className={`h-7 px-3 rounded-md transition-all duration-200 text-xs font-medium ${
|
||||||
configOptions.videoDuration === option.value
|
disableDuration
|
||||||
|
? 'cursor-not-allowed'
|
||||||
|
: configOptions.videoDuration === option.value
|
||||||
? 'bg-cyan-400/20 text-cyan-400'
|
? 'bg-cyan-400/20 text-cyan-400'
|
||||||
: 'bg-transparent text-gray-400 hover:text-gray-300'
|
: 'bg-transparent text-gray-400 hover:text-gray-300'
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
@ -301,7 +301,7 @@ export default function VideoCreationForm() {
|
|||||||
language: configOptions.language,
|
language: configOptions.language,
|
||||||
aspect_ratio: configOptions.aspect_ratio,
|
aspect_ratio: configOptions.aspect_ratio,
|
||||||
expansion_mode: configOptions.expansion_mode,
|
expansion_mode: configOptions.expansion_mode,
|
||||||
video_duration: configOptions.videoDuration,
|
video_duration: isTemplateSelected ? 'unlimited' : configOptions.videoDuration,
|
||||||
use_img2video: photos.length > 0,
|
use_img2video: photos.length > 0,
|
||||||
pcode: configOptions.pcode === 'portrait' ? '' : configOptions.pcode,
|
pcode: configOptions.pcode === 'portrait' ? '' : configOptions.pcode,
|
||||||
};
|
};
|
||||||
@ -556,6 +556,7 @@ export default function VideoCreationForm() {
|
|||||||
onConfigChange={handleConfigChange}
|
onConfigChange={handleConfigChange}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
isDesktop={isDesktop}
|
isDesktop={isDesktop}
|
||||||
|
disableDuration={isTemplateSelected ? true : false}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
@ -590,6 +591,7 @@ export default function VideoCreationForm() {
|
|||||||
onClose={() => setConfigModalVisible(false)}
|
onClose={() => setConfigModalVisible(false)}
|
||||||
configOptions={configOptions}
|
configOptions={configOptions}
|
||||||
onConfigChange={handleConfigChange}
|
onConfigChange={handleConfigChange}
|
||||||
|
disableDuration={isTemplateSelected ? true : false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Add Item Modal */}
|
{/* Add Item Modal */}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user