From 5ae9fdcf9aadf57101ecfd4b7635f4325f53d392 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Jun 2023 10:46:54 -0700 Subject: ui details --- extension/react-app/src/tabs/gui.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'extension/react-app/src/tabs') diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 63da595f..6aa20e0e 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -54,6 +54,7 @@ function GUI(props: GUIProps) { const [availableSlashCommands, setAvailableSlashCommands] = useState< { name: string; description: string }[] >([]); + const [stepsOpen, setStepsOpen] = useState([]); const [history, setHistory] = useState(); // { // timeline: [ @@ -212,6 +213,15 @@ function GUI(props: GUIProps) { setWaitingForSteps(state.active); setHistory(state.history); setUserInputQueue(state.user_input_queue); + const nextStepsOpen = [...stepsOpen]; + for ( + let i = nextStepsOpen.length; + i < state.history.timeline.length; + i++ + ) { + nextStepsOpen.push(true); + } + setStepsOpen(nextStepsOpen); if (shouldScrollToBottom) { scrollToBottom(); @@ -321,6 +331,15 @@ function GUI(props: GUIProps) { {history?.timeline.map((node: HistoryNode, index: number) => { return ( { + const nextStepsOpen = [...stepsOpen]; + nextStepsOpen[index] = !nextStepsOpen[index]; + setStepsOpen(nextStepsOpen); + }} + onToggleAll={() => { + setStepsOpen((prev) => prev.map(() => !prev[index])); + }} key={index} onUserInput={(input: string) => { onStepUserInput(input, index); -- cgit v1.2.3-70-g09d2