From bed56e55fd56c44cd46fd0ce9da9f74b7af867c0 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Mon, 12 Feb 2024 15:49:25 +0530 Subject: [PATCH] refactor: reusable menutab display labels --- daras_ai_v2/base.py | 7 +++- daras_ai_v2/breadcrumbs.py | 65 +++++++++++++------------------------ daras_ai_v2/meta_content.py | 35 ++++++++------------ daras_ai_v2/tabs_widget.py | 8 +++++ 4 files changed, 51 insertions(+), 64 deletions(-) diff --git a/daras_ai_v2/base.py b/daras_ai_v2/base.py index 906b73a08..d6243aeb7 100644 --- a/daras_ai_v2/base.py +++ b/daras_ai_v2/base.py @@ -243,7 +243,12 @@ def _render_header(self): if tbreadcrumbs: with st.tag("div", className="me-3 mb-1 mb-lg-0 py-2 py-lg-0"): - render_breadcrumbs(tbreadcrumbs, current_run.is_api_call) + render_breadcrumbs( + tbreadcrumbs, + is_api_call=( + current_run.is_api_call and self.tab == MenuTabs.run + ), + ) author = self.run_user or current_run.get_creator() if not is_root_example: diff --git a/daras_ai_v2/breadcrumbs.py b/daras_ai_v2/breadcrumbs.py index 84deb5c4d..94e63cb80 100644 --- a/daras_ai_v2/breadcrumbs.py +++ b/daras_ai_v2/breadcrumbs.py @@ -31,7 +31,7 @@ def has_breadcrumbs(self): return bool(self.root_title or self.published_title) -def render_breadcrumbs(breadcrumbs: TitleBreadCrumbs, is_api_call: bool = False): +def render_breadcrumbs(breadcrumbs: TitleBreadCrumbs, *, is_api_call: bool = False): st.html( """