mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 18:58:35 +08:00
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { memo } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useStore } from '@/app/components/workflow/store'
|
|
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
|
|
import useTimestamp from '@/hooks/use-timestamp'
|
|
|
|
const EditingTitle = () => {
|
|
const { t } = useTranslation()
|
|
const { formatTime } = useTimestamp()
|
|
const { formatTimeFromNow } = useFormatTimeFromNow()
|
|
const draftUpdatedAt = useStore((state) => state.draftUpdatedAt)
|
|
const publishedAt = useStore((state) => state.publishedAt)
|
|
const isSyncingWorkflowDraft = useStore((s) => s.isSyncingWorkflowDraft)
|
|
|
|
return (
|
|
<div className="flex h-[18px] min-w-[300px] items-center system-xs-regular whitespace-nowrap text-text-tertiary">
|
|
{!!draftUpdatedAt && (
|
|
<>
|
|
{t(($) => $['common.autoSaved'], { ns: 'workflow' })}{' '}
|
|
{formatTime(draftUpdatedAt / 1000, 'HH:mm:ss')}
|
|
</>
|
|
)}
|
|
<span className="mx-1 flex items-center">·</span>
|
|
{publishedAt
|
|
? `${t(($) => $['common.published'], { ns: 'workflow' })} ${formatTimeFromNow(publishedAt)}`
|
|
: t(($) => $['common.unpublished'], { ns: 'workflow' })}
|
|
{isSyncingWorkflowDraft && (
|
|
<>
|
|
<span className="mx-1 flex items-center">·</span>
|
|
{t(($) => $['common.syncingData'], { ns: 'workflow' })}
|
|
</>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default memo(EditingTitle)
|