mirror of
https://github.com/langgenius/dify.git
synced 2026-02-18 17:04:41 +08:00
- Fixed convertTimezoneToOffsetStr() that only extracted first digit * UTC-11 was incorrectly displayed as UTC-1, UTC+10 as UTC+0 * Now correctly extracts full offset using regex and removes leading zeros - Created reusable TimezoneLabel component with inline mode support - Added comprehensive unit tests with 100% coverage - Integrated timezone labels into 3 locations: * Panel time picker (next to time input) * Node next execution display * Panel next 5 executions list
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import type { FC } from 'react'
|
|
import React from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import type { ScheduleTriggerNodeType } from './types'
|
|
import type { NodeProps } from '@/app/components/workflow/types'
|
|
import { getNextExecutionTime } from './utils/execution-time-calculator'
|
|
import TimezoneLabel from '@/app/components/base/timezone-label'
|
|
|
|
const i18nPrefix = 'workflow.nodes.triggerSchedule'
|
|
|
|
const Node: FC<NodeProps<ScheduleTriggerNodeType>> = ({
|
|
data,
|
|
}) => {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<div className="mb-1 px-3 py-1">
|
|
<div className="mb-1 text-[10px] font-medium uppercase tracking-wide text-text-tertiary">
|
|
{t(`${i18nPrefix}.nextExecutionTime`)}
|
|
</div>
|
|
<div className="flex h-[26px] items-center rounded-md bg-workflow-block-parma-bg px-2 text-xs text-text-secondary">
|
|
<div className="w-0 grow">
|
|
<div className="truncate" title={`${getNextExecutionTime(data)} ${data.timezone}`}>
|
|
{getNextExecutionTime(data)}
|
|
{' '}
|
|
<TimezoneLabel timezone={data.timezone} inline className="text-xs" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default React.memo(Node)
|