mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
feat(time-picker): add showTimezone prop with comprehensive tests
- Add showTimezone prop to TimePickerProps for optional inline timezone display - Integrate TimezoneLabel component into TimePicker when showTimezone=true - Add 6 comprehensive test cases covering all showTimezone scenarios: * Default behavior (no timezone label) * Explicit disable with showTimezone=false * Enable with showTimezone=true * Inline prop correctly passed * No display when timezone is missing * Correct styling classes applied - Update trigger-schedule panel to use showTimezone prop - All 15 tests passing with good coverage
This commit is contained in:
@ -12,7 +12,6 @@ import NextExecutionTimes from './components/next-execution-times'
|
||||
import MonthlyDaysSelector from './components/monthly-days-selector'
|
||||
import OnMinuteSelector from './components/on-minute-selector'
|
||||
import Input from '@/app/components/base/input'
|
||||
import TimezoneLabel from '@/app/components/base/timezone-label'
|
||||
import useConfig from './use-config'
|
||||
|
||||
const i18nPrefix = 'workflow.nodes.triggerSchedule'
|
||||
@ -70,24 +69,22 @@ const Panel: FC<NodePanelProps<ScheduleTriggerNodeType>> = ({
|
||||
<label className="mb-2 block text-xs font-medium text-gray-500">
|
||||
{t('workflow.nodes.triggerSchedule.time')}
|
||||
</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<TimePicker
|
||||
notClearable={true}
|
||||
timezone={inputs.timezone}
|
||||
value={inputs.visual_config?.time || '12:00 AM'}
|
||||
onChange={(time) => {
|
||||
if (time) {
|
||||
const timeString = time.format('h:mm A')
|
||||
handleTimeChange(timeString)
|
||||
}
|
||||
}}
|
||||
onClear={() => {
|
||||
handleTimeChange('12:00 AM')
|
||||
}}
|
||||
placeholder={t('workflow.nodes.triggerSchedule.selectTime')}
|
||||
/>
|
||||
<TimezoneLabel timezone={inputs.timezone} />
|
||||
</div>
|
||||
<TimePicker
|
||||
notClearable={true}
|
||||
timezone={inputs.timezone}
|
||||
value={inputs.visual_config?.time || '12:00 AM'}
|
||||
onChange={(time) => {
|
||||
if (time) {
|
||||
const timeString = time.format('h:mm A')
|
||||
handleTimeChange(timeString)
|
||||
}
|
||||
}}
|
||||
onClear={() => {
|
||||
handleTimeChange('12:00 AM')
|
||||
}}
|
||||
placeholder={t('workflow.nodes.triggerSchedule.selectTime')}
|
||||
showTimezone={true}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user