MCPcopy Create free account
hub / github.com/Noumena-Network/code / WorkflowDetailDialog

Function WorkflowDetailDialog

src/components/tasks/WorkflowDetailDialog.tsx:37–164  ·  view source on GitHub ↗
({
  workflow,
  onDone,
  onKill,
  onBack,
}: Props)

Source from the content-addressed store, hash-verified

35}
36
37export function WorkflowDetailDialog({
38 workflow,
39 onDone,
40 onKill,
41 onBack,
42}: Props): React.ReactNode {
43 const elapsedTime = useElapsedTime(
44 workflow.startTime,
45 workflow.status === 'running',
46 1000,
47 0,
48 )
49
50 useKeybindings({ 'confirm:yes': onDone }, { context: 'Confirmation' })
51
52 const handleKeyDown = (e: KeyboardEvent) => {
53 if (e.key === ' ') {
54 e.preventDefault()
55 onDone('Workflow details dismissed', { display: 'system' })
56 return
57 }
58
59 if (e.key === 'left') {
60 e.preventDefault()
61 onBack()
62 return
63 }
64
65 if (e.key === 'x' && workflow.status === 'running' && onKill) {
66 e.preventDefault()
67 onKill()
68 }
69 }
70
71 const title = <Text>{workflow.workflowName}</Text>
72 const subtitle = (
73 <Text dimColor>
74 {elapsedTime} · {buildSubtitle(workflow)}
75 </Text>
76 )
77
78 const inputGuide = (exitState: { pending: boolean; keyName: string }) =>
79 exitState.pending ? (
80 <Text>Press {exitState.keyName} again to exit</Text>
81 ) : (
82 <Byline>
83 <KeyboardShortcutHint shortcut="←" action="go back" />
84 <KeyboardShortcutHint shortcut="Esc/Enter/Space" action="close" />
85 {workflow.status === 'running' && onKill && (
86 <KeyboardShortcutHint shortcut="x" action="stop" />
87 )}
88 </Byline>
89 )
90
91 return (
92 <Box flexDirection="column" tabIndex={0} autoFocus onKeyDown={handleKeyDown}>
93 <Dialog
94 title={title}

Callers

nothing calls this directly

Calls 7

useElapsedTimeFunction · 0.85
useKeybindingsFunction · 0.85
buildSubtitleFunction · 0.85
getTaskStatusColorFunction · 0.85
getTaskStatusIconFunction · 0.85
pluralFunction · 0.85
onDoneFunction · 0.50

Tested by

no test coverage detected