Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

header-in-view-history.tsx 1.4KB

pirms 6 mēnešiem
pirms 6 mēnešiem
pirms 6 mēnešiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 type { ViewHistoryProps } from './view-history'
  14. import ViewHistory from './view-history'
  15. import Button from '@/app/components/base/button'
  16. import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
  17. export type HeaderInHistoryProps = {
  18. viewHistoryProps?: ViewHistoryProps
  19. }
  20. const HeaderInHistory = ({
  21. viewHistoryProps,
  22. }: HeaderInHistoryProps) => {
  23. const { t } = useTranslation()
  24. const workflowStore = useWorkflowStore()
  25. const {
  26. handleLoadBackupDraft,
  27. } = useWorkflowRun()
  28. const handleGoBackToEdit = useCallback(() => {
  29. handleLoadBackupDraft()
  30. workflowStore.setState({ historyWorkflowData: undefined })
  31. }, [workflowStore, handleLoadBackupDraft])
  32. return (
  33. <>
  34. <div>
  35. <RunningTitle />
  36. </div>
  37. <div className='flex items-center space-x-2'>
  38. <ViewHistory {...viewHistoryProps} withText />
  39. <Divider type='vertical' className='mx-auto h-3.5' />
  40. <Button
  41. variant='primary'
  42. onClick={handleGoBackToEdit}
  43. >
  44. <ArrowNarrowLeft className='mr-1 h-4 w-4' />
  45. {t('workflow.common.goBackToEdit')}
  46. </Button>
  47. </div>
  48. </>
  49. )
  50. }
  51. export default HeaderInHistory