dify/web/app/components/workflow/nodes/trigger-schedule/components/mode-switcher.tsx
Stephen Zhou 6d0e36479b
refactor(i18n): use JSON with flattened key and namespace (#30114)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-29 14:52:32 +08:00

38 lines
902 B
TypeScript

import type { ScheduleMode } from '../types'
import { RiCalendarLine, RiCodeLine } from '@remixicon/react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { SegmentedControl } from '@/app/components/base/segmented-control'
type ModeSwitcherProps = {
mode: ScheduleMode
onChange: (mode: ScheduleMode) => void
}
const ModeSwitcher = ({ mode, onChange }: ModeSwitcherProps) => {
const { t } = useTranslation()
const options = [
{
Icon: RiCalendarLine,
text: t('nodes.triggerSchedule.modeVisual', { ns: 'workflow' }),
value: 'visual' as const,
},
{
Icon: RiCodeLine,
text: t('nodes.triggerSchedule.modeCron', { ns: 'workflow' }),
value: 'cron' as const,
},
]
return (
<SegmentedControl
options={options}
value={mode}
onChange={onChange}
/>
)
}
export default ModeSwitcher