diff --git a/conductor/tracks.md b/conductor/tracks.md index 1967a8d6..b050c993 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -313,5 +313,5 @@ This file tracks all major tracks for the project. Each track has its own detail --- -- [ ] **Track: Fix Approve Modal sizing and inline full preview** +- [~] **Track: Fix Approve Modal sizing and inline full preview** *Link: [./tracks/approve_modal_ux_20260601/](./tracks/approve_modal_ux_20260601/)* diff --git a/src/gui_2.py b/src/gui_2.py index 386b0075..1c8ef2b0 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -4419,20 +4419,24 @@ def render_approve_script_modal(app: App) -> None: else: app._pending_dialog_open = False - if imgui.begin_popup_modal("Approve PowerShell Command", None, imgui.WindowFlags_.always_auto_resize)[0]: + imgui.set_next_window_size(imgui.ImVec2(800, 600), imgui.Cond_.first_use_ever) + if imgui.begin_popup_modal("Approve PowerShell Command", None, 0)[0]: if not dlg: imgui.close_current_popup() else: imgui.text("The AI wants to run the following PowerShell script:") imgui.text_colored(vec4(200, 200, 100), f"base_dir: {dlg._base_dir}") imgui.separator() # Checkbox to toggle full preview inside modal - _, app.show_windows["Text Viewer"] = imgui.checkbox("Show Full Preview", app.show_windows.get("Text Viewer", False)) - if app.show_windows.get("Text Viewer", False): - imgui.begin_child("preview_child", imgui.ImVec2(600, 300), True) - imgui.text_unformatted(dlg._script) + if not hasattr(app, 'ui_approve_modal_preview'): app.ui_approve_modal_preview = False + _, app.ui_approve_modal_preview = imgui.checkbox("Read-only Full Preview", app.ui_approve_modal_preview) + + avail_y = imgui.get_content_region_avail().y - 40 # reserve space for buttons + if app.ui_approve_modal_preview: + imgui.begin_child("preview_child", imgui.ImVec2(-1, avail_y), True) + markdown_helper.render(f"```powershell\n{dlg._script}\n```", context_id="approve_script_preview") imgui.end_child() else: - ch, dlg._script = imgui.input_text_multiline("##confirm_script", dlg._script, imgui.ImVec2(-1, 200)) + ch, dlg._script = imgui.input_text_multiline("##confirm_script", dlg._script, imgui.ImVec2(-1, avail_y)) imgui.separator() if imgui.button("Approve & Run", imgui.ImVec2(120, 0)): with dlg._condition: