You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

header-in-view-history.tsx 1.3KB

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