From 2e3a4a6a9b2205ad2683f07bfaf128721e9916aa Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 1 Nov 2023 12:48:36 -0700 Subject: [PATCH] Use Jinja macro to deduplicate navigation header HTML --- src/khoj/interface/web/base_config.html | 23 +++++--------------- src/khoj/interface/web/chat.html | 28 +++--------------------- src/khoj/interface/web/index.html | 29 +++---------------------- src/khoj/interface/web/utils.html | 20 +++++++++++++++++ 4 files changed, 31 insertions(+), 69 deletions(-) create mode 100644 src/khoj/interface/web/utils.html diff --git a/src/khoj/interface/web/base_config.html b/src/khoj/interface/web/base_config.html index 41347141..92e0ec27 100644 --- a/src/khoj/interface/web/base_config.html +++ b/src/khoj/interface/web/base_config.html @@ -12,24 +12,11 @@
-
- - -
+ + + {% import 'utils.html' as utils %} + {{ utils.heading_pane(user_photo, username) }} +
diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index a222569c..e4739cd2 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -270,32 +270,10 @@ {% endif %}
+ -
- {% if demo %} - - {% else %} - - {% endif %} - -
+ {% import 'utils.html' as utils %} + {{ utils.heading_pane(user_photo, username) }}
diff --git a/src/khoj/interface/web/index.html b/src/khoj/interface/web/index.html index a3ed548f..8ea846e7 100644 --- a/src/khoj/interface/web/index.html +++ b/src/khoj/interface/web/index.html @@ -282,33 +282,10 @@ {% endif %} + -
- {% if demo %} - - {% else %} - - {% endif %} - -
+ {% import 'utils.html' as utils %} + {{ utils.heading_pane(user_photo, username) }} diff --git a/src/khoj/interface/web/utils.html b/src/khoj/interface/web/utils.html new file mode 100644 index 00000000..31c07a54 --- /dev/null +++ b/src/khoj/interface/web/utils.html @@ -0,0 +1,20 @@ +{% macro heading_pane(user_photo="/static/assets/icons/anon.png", username="Anon") -%} +
+ + +
+{%- endmacro %}