import type { FC } from 'react' import { memo } from 'react' import { useTranslation } from 'react-i18next' import { RiLoader2Line, RiPlayLargeLine, } from '@remixicon/react' import { useStore } from '../store' import { useIsChatMode, useNodesReadOnly, useWorkflowRun, useWorkflowStartRun, } from '../hooks' import { WorkflowRunningStatus } from '../types' import ViewHistory from './view-history' import Checklist from './checklist' import cn from '@/utils/classnames' import { StopCircle, } from '@/app/components/base/icons/src/vender/line/mediaAndDevices' const RunMode = memo(() => { const { t } = useTranslation() const { handleWorkflowStartRunInWorkflow } = useWorkflowStartRun() const { handleStopRun } = useWorkflowRun() const workflowRunningData = useStore(s => s.workflowRunningData) const isRunning = workflowRunningData?.result.status === WorkflowRunningStatus.Running return ( <>
{ handleWorkflowStartRunInWorkflow() }} > { isRunning ? ( <> {t('workflow.common.running')} ) : ( <> {t('workflow.common.run')} ) }
{ isRunning && (
handleStopRun(workflowRunningData?.task_id || '')} >
) } ) }) RunMode.displayName = 'RunMode' const PreviewMode = memo(() => { const { t } = useTranslation() const { handleWorkflowStartRunInChatflow } = useWorkflowStartRun() return (
handleWorkflowStartRunInChatflow()} > {t('workflow.common.debugAndPreview')}
) }) PreviewMode.displayName = 'PreviewMode' const RunAndHistory: FC = () => { const isChatMode = useIsChatMode() const { nodesReadOnly } = useNodesReadOnly() return (
{ !isChatMode && } { isChatMode && }
) } export default memo(RunAndHistory)