wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {
  useCallback,
} from 'react'
import { useTranslation } from 'react-i18next'
import {
  useWorkflowStore,
} from '../store'
import {
  useWorkflowRun,
} from '../hooks'
import Divider from '../../base/divider'
import RunningTitle from './running-title'
import ViewHistory from './view-history'
import Button from '@/app/components/base/button'
import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
 
const HeaderInHistory = () => {
  const { t } = useTranslation()
  const workflowStore = useWorkflowStore()
 
  const {
    handleLoadBackupDraft,
  } = useWorkflowRun()
 
  const handleGoBackToEdit = useCallback(() => {
    handleLoadBackupDraft()
    workflowStore.setState({ historyWorkflowData: undefined })
  }, [workflowStore, handleLoadBackupDraft])
 
  return (
    <>
      <div>
        <RunningTitle />
      </div>
      <div className='flex items-center space-x-2'>
        <ViewHistory withText />
        <Divider type='vertical' className='mx-auto h-3.5' />
        <Button
          variant='primary'
          onClick={handleGoBackToEdit}
        >
          <ArrowNarrowLeft className='mr-1 h-4 w-4' />
          {t('workflow.common.goBackToEdit')}
        </Button>
      </div>
    </>
  )
}
 
export default HeaderInHistory