From 8695ca2abf70baef165bd3a5f21efa67d1ef063a Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Fri, 9 Jan 2026 19:07:09 +0000 Subject: [PATCH] Modularize dashboard UI using Jinja2 macros: Extract bot control, status, and logs sections into separate macros for improved code reusability and maintainability. --- .../organisms/dashboard_bot_control.html | 54 +++++++++++ .../components/organisms/dashboard_logs.html | 14 +++ .../organisms/dashboard_status.html | 32 ++++++ .../sections/dashboard_section.html | 97 ++----------------- 4 files changed, 106 insertions(+), 91 deletions(-) create mode 100644 src/autometabuilder/web/templates/components/organisms/dashboard_bot_control.html create mode 100644 src/autometabuilder/web/templates/components/organisms/dashboard_logs.html create mode 100644 src/autometabuilder/web/templates/components/organisms/dashboard_status.html diff --git a/src/autometabuilder/web/templates/components/organisms/dashboard_bot_control.html b/src/autometabuilder/web/templates/components/organisms/dashboard_bot_control.html new file mode 100644 index 0000000..fd989b0 --- /dev/null +++ b/src/autometabuilder/web/templates/components/organisms/dashboard_bot_control.html @@ -0,0 +1,54 @@ +{# Dashboard bot control card macro. #} +{% from "components/sections/choice_card.html" import choice_card %} + +{% macro dashboard_bot_control() -%} +
+
+
{{ t('ui.dashboard.bot_control', 'Bot Control') }}
+
+
+
+
+ +
+ {% set iterations_extra %} + + {% endset %} + + {{ choice_card('mode-once', 'once', '1-circle', t('ui.dashboard.run.single.title', 'Single Iteration'), t('ui.dashboard.run.single.desc', 'One full pass through the workflow.'), True) }} + {{ choice_card('mode-iterations', 'iterations', 'arrow-repeat', t('ui.dashboard.run.repeat.title', 'Repeat'), t('ui.dashboard.run.repeat.desc', 'Run a fixed number of cycles.'), False, iterations_extra) }} + {{ choice_card('mode-yolo', 'yolo', 'infinity', t('ui.dashboard.run.yolo.title', 'YOLO'), t('ui.dashboard.run.yolo.desc', 'Keep iterating until you stop it.')) }} +
+
+ +
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+{%- endmacro %} diff --git a/src/autometabuilder/web/templates/components/organisms/dashboard_logs.html b/src/autometabuilder/web/templates/components/organisms/dashboard_logs.html new file mode 100644 index 0000000..cee70d4 --- /dev/null +++ b/src/autometabuilder/web/templates/components/organisms/dashboard_logs.html @@ -0,0 +1,14 @@ +{# Dashboard logs card macro. #} +{% macro dashboard_logs() -%} +
+
+
{{ t('ui.dashboard.logs.title', 'Recent Logs') }}
+ +
+
+
{{ logs }}
+
+
+{%- endmacro %} diff --git a/src/autometabuilder/web/templates/components/organisms/dashboard_status.html b/src/autometabuilder/web/templates/components/organisms/dashboard_status.html new file mode 100644 index 0000000..a8eafc0 --- /dev/null +++ b/src/autometabuilder/web/templates/components/organisms/dashboard_status.html @@ -0,0 +1,32 @@ +{# Dashboard status card macro. #} +{% macro dashboard_status() -%} +
+
+
{{ t('ui.dashboard.status.title', 'Status') }}
+
+
+
+
+ {{ t('ui.dashboard.status.bot_label', 'Bot Status') }} +
+ + {% if is_running %}{{ t('ui.dashboard.status.running', 'Running') }}{% else %}{{ t('ui.dashboard.status.idle', 'Idle') }}{% endif %} +
+
+
+ {{ t('ui.dashboard.status.mvp_label', 'MVP Milestone') }} + + {% if mvp_reached %} + {{ t('ui.dashboard.status.mvp_reached', 'Reached') }} + {% else %} + {{ t('ui.dashboard.status.mvp_progress', 'In Progress') }} + {% endif %} + +
+
+
+
+
+
+
+{%- endmacro %} diff --git a/src/autometabuilder/web/templates/components/sections/dashboard_section.html b/src/autometabuilder/web/templates/components/sections/dashboard_section.html index a282c5a..4158a52 100644 --- a/src/autometabuilder/web/templates/components/sections/dashboard_section.html +++ b/src/autometabuilder/web/templates/components/sections/dashboard_section.html @@ -1,6 +1,8 @@ {# Dashboard section macro. #} {% from "components/atoms/section_header.html" import section_header %} -{% from "components/sections/choice_card.html" import choice_card %} +{% from "components/organisms/dashboard_bot_control.html" import dashboard_bot_control with context %} +{% from "components/organisms/dashboard_status.html" import dashboard_status with context %} +{% from "components/organisms/dashboard_logs.html" import dashboard_logs with context %} {% macro dashboard_section() -%}
@@ -8,99 +10,12 @@
-
-
-
{{ t('ui.dashboard.bot_control', 'Bot Control') }}
-
-
-
-
- -
- {% set iterations_extra %} - - {% endset %} - - {{ choice_card('mode-once', 'once', '1-circle', t('ui.dashboard.run.single.title', 'Single Iteration'), t('ui.dashboard.run.single.desc', 'One full pass through the workflow.'), True) }} - {{ choice_card('mode-iterations', 'iterations', 'arrow-repeat', t('ui.dashboard.run.repeat.title', 'Repeat'), t('ui.dashboard.run.repeat.desc', 'Run a fixed number of cycles.'), False, iterations_extra) }} - {{ choice_card('mode-yolo', 'yolo', 'infinity', t('ui.dashboard.run.yolo.title', 'YOLO'), t('ui.dashboard.run.yolo.desc', 'Keep iterating until you stop it.')) }} -
-
- -
- -
-
- - -
-
- - -
-
-
- - -
-
-
- -
-
-
{{ t('ui.dashboard.status.title', 'Status') }}
-
-
-
-
- {{ t('ui.dashboard.status.bot_label', 'Bot Status') }} -
- - {% if is_running %}{{ t('ui.dashboard.status.running', 'Running') }}{% else %}{{ t('ui.dashboard.status.idle', 'Idle') }}{% endif %} -
-
-
- {{ t('ui.dashboard.status.mvp_label', 'MVP Milestone') }} - - {% if mvp_reached %} - {{ t('ui.dashboard.status.mvp_reached', 'Reached') }} - {% else %} - {{ t('ui.dashboard.status.mvp_progress', 'In Progress') }} - {% endif %} - -
-
-
-
-
-
-
+ {{ dashboard_bot_control() }} + {{ dashboard_status() }}
-
-
-
{{ t('ui.dashboard.logs.title', 'Recent Logs') }}
- -
-
-
{{ logs }}
-
-
+ {{ dashboard_logs() }}