From 8b290ac7a100f4143fbaf5e77dff7dccc039858b Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 23 Jun 2025 16:45:48 +0800 Subject: [PATCH] feat: only choose 15 time --- .../base/date-and-time-picker/time-picker/index.tsx | 2 ++ .../base/date-and-time-picker/time-picker/options.tsx | 3 ++- web/app/components/base/date-and-time-picker/types.ts | 3 +++ .../reference-setting-modal/auto-update-setting/index.tsx | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/web/app/components/base/date-and-time-picker/time-picker/index.tsx b/web/app/components/base/date-and-time-picker/time-picker/index.tsx index b21c9f9795..7a6f9f94fd 100644 --- a/web/app/components/base/date-and-time-picker/time-picker/index.tsx +++ b/web/app/components/base/date-and-time-picker/time-picker/index.tsx @@ -21,6 +21,7 @@ const TimePicker = ({ onClear, renderTrigger, title, + minuteFilter, popupClassName, }: TimePickerProps) => { const { t } = useTranslation() @@ -152,6 +153,7 @@ const TimePicker = ({ {/* Time Options */} = ({ selectedTime, + minuteFilter, handleSelectHour, handleSelectMinute, handleSelectPeriod, @@ -33,7 +34,7 @@ const Options: FC = ({ {/* Minute */}
    { - minuteOptions.map((minute) => { + (minuteFilter ? minuteFilter(minuteOptions) : minuteOptions).map((minute) => { const isSelected = selectedTime?.format('mm') === minute return ( void triggerWrapClassName?: string renderTrigger?: (props: TriggerProps) => React.ReactNode + minuteFilter?: (minutes: string[]) => string[] popupZIndexClassname?: string } @@ -55,6 +56,7 @@ export type TimePickerProps = { onClear: () => void renderTrigger?: () => React.ReactNode title?: string + minuteFilter?: (minutes: string[]) => string[] popupClassName?: string } @@ -83,6 +85,7 @@ export type CalendarItemProps = { export type TimeOptionsProps = { selectedTime: Dayjs | undefined + minuteFilter?: (minutes: string[]) => string[] handleSelectHour: (hour: string) => void handleSelectMinute: (minute: string) => void handleSelectPeriod: (period: Period) => void diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx index 48c8a6c8a6..67f4f5e034 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx @@ -42,6 +42,13 @@ const AutoUpdateSetting: FC = ({ exclude_plugins, include_plugins, } = payload + + const minuteFilter = useCallback((minutes: string[]) => { + return minutes.filter((m) => { + const time = Number.parseInt(m, 10) + return time % 15 === 0 + }) + }, []) const strategyDescription = useMemo(() => { switch (strategy_setting) { case AUTO_UPDATE_STRATEGY.fixOnly: @@ -108,6 +115,7 @@ const AutoUpdateSetting: FC = ({ onClear={() => handleChange('upgrade_time_of_day')(0)} popupClassName='z-[99]' title={t(`${i18nPrefix}.updateTime`)} + minuteFilter={minuteFilter} />