7171 should_attempt_auto_recharge ,
7272)
7373from routers .root import RecipeTabs
74- from widgets .author import render_author_from_user
74+ from widgets .author import render_author_from_user , render_author_from_workspace
7575from widgets .base_header import render_help_button
7676from widgets .publish_form import clear_publish_form
7777from widgets .saved_workflow import render_saved_workflow_preview
@@ -360,7 +360,7 @@ def render(self):
360360 self .render_report_form ()
361361 return
362362
363- header_placeholder = gui .div (className = "mb-2 " )
363+ header_placeholder = gui .div (className = "my-3 w-100 " )
364364 with (
365365 gui .styled (
366366 """
@@ -404,14 +404,92 @@ def _render_header(self):
404404 can_save = self .can_user_save_run (sr , pr )
405405 request_changed = self ._has_request_changed ()
406406
407- if not tbreadcrumbs .has_breadcrumbs ():
407+ if tbreadcrumbs .has_breadcrumbs ():
408+ if self .tab != RecipeTabs .run :
409+ # Examples, API, Saved, etc
410+ if self .tab == RecipeTabs .saved or self .tab == RecipeTabs .history :
411+ with gui .div (className = "mb-2" ):
412+ render_author_from_workspace (
413+ self .current_workspace ,
414+ show_as_link = True ,
415+ )
416+ linked_title = (
417+ TitleUrl (
418+ tbreadcrumbs .h1_title ,
419+ sr .get_app_url (),
420+ )
421+ if self .tab == RecipeTabs .run_as_api
422+ or self .tab == RecipeTabs .integrations
423+ else tbreadcrumbs .root_title
424+ )
425+ with gui .div (className = "mb-2" ):
426+ self ._render_title (
427+ tbreadcrumbs .h1_title ,
428+ title_prefix = tbreadcrumbs .title_prefix ,
429+ linked_title = linked_title ,
430+ )
431+ else :
432+ # Run tab
433+ img_style = dict (objectFit = "cover" , marginBottom = 0 )
434+ if self .workflow in CIRCLE_IMAGE_WORKFLOWS :
435+ img_style ["borderRadius" ] = "50%"
436+ else :
437+ img_style ["borderRadius" ] = "12px"
438+ with gui .div (className = "d-flex gap-4 w-100 mb-2" ):
439+ # mobile image - smaller in size in parent div
440+ if pr .photo_url :
441+ with gui .div (className = "d-none d-md-inline" ):
442+ gui .image (
443+ src = pr .photo_url ,
444+ style = img_style | dict (width = "96px" , height = "96px" ),
445+ )
446+
447+ # desktop image and title, social buttons, extra and breadcrumbs
448+ with gui .div (
449+ className = "d-flex align-items-md-center gap-2 gap-md-4 container-margin-reset w-100"
450+ ):
451+ if pr .photo_url :
452+ with gui .div (className = "d-inline d-md-none" ):
453+ gui .image (
454+ src = pr .photo_url ,
455+ style = img_style | dict (width = "56px" , height = "56px" ),
456+ )
457+ with gui .div (
458+ className = "w-100 mb-md-2 d-flex flex-column gap-2"
459+ ):
460+ with gui .div (
461+ className = "d-flex justify-content-between align-items-start w-100"
462+ ):
463+ self ._render_title (
464+ tbreadcrumbs .h1_title ,
465+ title_prefix = tbreadcrumbs .title_prefix ,
466+ linked_title = tbreadcrumbs .published_title ,
467+ )
468+ with gui .div (
469+ className = "d-flex align-items-xl-center flex-sm-column-reverse flex-xl-row gap-sm-2 gap-xl-0" ,
470+ style = {"whiteSpace" : "nowrap" },
471+ ):
472+ if request_changed or (can_save and not is_example ):
473+ self ._render_unpublished_changes_indicator ()
474+ self .render_social_buttons ()
475+ with gui .div (
476+ className = "d-none d-md-flex flex-column gap-2"
477+ ):
478+ self .render_extra_and_breadcrumbs (
479+ tbreadcrumbs , is_root_example
480+ )
481+
482+ # mobile extra and breadcrumbs - in parent div
483+ with gui .div (className = "d-flex flex-column gap-2 mb-2 d-md-none" ):
484+ self .render_extra_and_breadcrumbs (tbreadcrumbs , is_root_example )
485+ else :
408486 with gui .div (
409- className = "d-flex justify-content-between align-items-start mt-2 mt-md-3 mb-2 w-100"
487+ className = "d-flex justify-content-between align-items-start mb-2 w-100"
410488 ):
411489 with gui .div (className = "my-auto" ):
412490 self ._render_title (
413491 tbreadcrumbs .h1_title ,
414- published_title = tbreadcrumbs .published_title ,
492+ linked_title = tbreadcrumbs .published_title ,
415493 )
416494 with gui .div (
417495 className = "d-flex align-items-center" ,
@@ -420,74 +498,10 @@ def _render_header(self):
420498 if request_changed or (can_save and not is_example ):
421499 self ._render_unpublished_changes_indicator ()
422500 self .render_social_buttons ()
423- self .render_notes (is_example )
424- else :
425- with gui .div (className = "w-100" ):
426- if self .tab != RecipeTabs .run :
427- # Examples, API, Saved, etc.
428- with gui .div (className = "my-3" ):
429- self ._render_title (
430- tbreadcrumbs .h1_title ,
431- published_title = tbreadcrumbs .published_title ,
432- title_prefix = tbreadcrumbs .title_prefix ,
433- )
434- else :
435- img_style = dict (objectFit = "cover" , marginBottom = 0 )
436- if self .workflow in CIRCLE_IMAGE_WORKFLOWS :
437- img_style ["borderRadius" ] = "50%"
438- else :
439- img_style ["borderRadius" ] = "12px"
440- with gui .div (className = "d-flex gap-4 align-items-md-center w-100" ):
441- # mobile image - smaller in size in parent div
442- if pr .photo_url :
443- with gui .div (className = "d-none d-md-inline" ):
444- gui .image (
445- src = pr .photo_url ,
446- style = img_style
447- | dict (width = "120px" , height = "120px" ),
448- )
449501
450- # desktop image and title, social buttons, extra and breadcrumbs
451- with gui .div (
452- className = "d-flex mt-3 mt-md-2 align-items-md-center gap-2 gap-md-4 container-margin-reset mb-2 mb-md-0 w-100"
453- ):
454- if pr .photo_url :
455- with gui .div (className = "d-inline d-md-none" ):
456- gui .image (
457- src = pr .photo_url ,
458- style = img_style
459- | dict (width = "40px" , height = "40px" ),
460- )
461- with gui .div (className = "w-100 mb-md-2" ):
462- with gui .div (
463- className = "d-flex justify-content-between align-items-start w-100 mb-md-2"
464- ):
465- self ._render_title (
466- tbreadcrumbs .h1_title ,
467- published_title = tbreadcrumbs .published_title ,
468- title_prefix = tbreadcrumbs .title_prefix ,
469- )
470- with gui .div (
471- className = "d-flex align-items-xl-center flex-sm-column-reverse flex-xl-row gap-sm-2 gap-xl-0" ,
472- style = {"whiteSpace" : "nowrap" },
473- ):
474- if request_changed or (
475- can_save and not is_example
476- ):
477- self ._render_unpublished_changes_indicator ()
478- self .render_social_buttons ()
479- with gui .div (
480- className = "d-none d-md-flex flex-column gap-2"
481- ):
482- self .render_extra_and_breadcrumbs (
483- tbreadcrumbs , is_root_example
484- )
485- self .render_notes (is_example )
486-
487- # mobile extra and breadcrumbs - in parent div
488- with gui .div (className = "d-flex flex-column gap-2 mb-2 d-md-none" ):
489- self .render_extra_and_breadcrumbs (tbreadcrumbs , is_root_example )
490- self .render_notes (is_example )
502+ if self .tab == RecipeTabs .run :
503+ with gui .div (className = "container-margin-reset" ):
504+ self .render_notes ()
491505
492506 def render_extra_and_breadcrumbs (
493507 self ,
@@ -507,8 +521,8 @@ def render_extra_and_breadcrumbs(
507521 ),
508522 )
509523
510- def render_notes (self , is_example : bool ):
511- if is_example and ( self .current_pr and self .current_pr .notes ) :
524+ def render_notes (self ):
525+ if self .current_pr and self .current_pr .notes :
512526 gui .write (self .current_pr .notes , line_clamp = 3 )
513527
514528 def render_header_extra (self ):
@@ -541,8 +555,8 @@ def can_user_save_run(
541555 def _render_title (
542556 self ,
543557 title : str ,
544- published_title : TitleUrl | None = None ,
545558 title_prefix : str | None = None ,
559+ linked_title : TitleUrl | None = None ,
546560 ):
547561 with (
548562 gui .styled ("""
@@ -552,9 +566,9 @@ def _render_title(
552566 gui .div (className = "container-margin-reset" ),
553567 ):
554568 prefix = f"{ title_prefix } : " if title_prefix else ""
555- if published_title :
569+ if linked_title :
556570 gui .write (
557- f"# { prefix } <a href='{ published_title .url } '>{ title } </a>" ,
571+ f"# { prefix } <a href='{ linked_title .url } '>{ title } </a>" ,
558572 unsafe_allow_html = True ,
559573 )
560574 else :
0 commit comments