|
70 | 70 | from routers.root import RecipeTabs
|
71 | 71 | from workspaces.models import Workspace, WorkspaceMembership
|
72 | 72 | from workspaces.widgets import get_current_workspace, set_current_workspace
|
| 73 | +from daras_ai_v2.utils import get_relative_time |
73 | 74 |
|
74 | 75 | DEFAULT_META_IMG = (
|
75 | 76 | # Small
|
@@ -350,12 +351,28 @@ def render(self):
|
350 | 351 |
|
351 | 352 | header_placeholder = gui.div()
|
352 | 353 | gui.newline()
|
| 354 | + with gui.div(className="position-relative"): |
| 355 | + with gui.nav_tabs(): |
| 356 | + for tab in self.get_tabs(): |
| 357 | + url = self.current_app_url(tab) |
| 358 | + with gui.nav_item(url, active=tab == self.tab): |
| 359 | + gui.html(tab.title) |
353 | 360 |
|
354 |
| - with gui.nav_tabs(): |
355 |
| - for tab in self.get_tabs(): |
356 |
| - url = self.current_app_url(tab) |
357 |
| - with gui.nav_item(url, active=tab == self.tab): |
358 |
| - gui.html(tab.title) |
| 361 | + if ( |
| 362 | + self.current_pr |
| 363 | + and not self.current_pr.is_root() |
| 364 | + and self.tab == RecipeTabs.run |
| 365 | + ): |
| 366 | + with gui.div( |
| 367 | + className="container-margin-reset d-none d-md-block", |
| 368 | + style=dict( |
| 369 | + position="absolute", |
| 370 | + top="50%", |
| 371 | + right="0", |
| 372 | + transform="translateY(-50%)", |
| 373 | + ), |
| 374 | + ): |
| 375 | + self._render_saved_timestamp(self.current_pr) |
359 | 376 | with gui.nav_tab_content():
|
360 | 377 | self.render_selected_tab()
|
361 | 378 |
|
@@ -472,6 +489,10 @@ def _render_unpublished_changes_indicator(self):
|
472 | 489 | ):
|
473 | 490 | gui.html("Unpublished changes")
|
474 | 491 |
|
| 492 | + def _render_saved_timestamp(self, pr: PublishedRun): |
| 493 | + with gui.tag("span", className="text-muted"): |
| 494 | + gui.write(f"{get_relative_time(pr.updated_at)}") |
| 495 | + |
475 | 496 | def _render_options_button_with_dialog(self):
|
476 | 497 | ref = gui.use_alert_dialog(key="options-modal")
|
477 | 498 | if gui.button(label=icons.more_options, className="mb-0", type="tertiary"):
|
|
0 commit comments