File tree Expand file tree Collapse file tree 10 files changed +43
-38
lines changed
static/css/scss/components Expand file tree Collapse file tree 10 files changed +43
-38
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ impl IndexLink {
7373 self
7474 }
7575
76- // Adds a suffix to this and all children ids.
76+ // Adds a suffix to this and all children ids.
7777 // this prevents id collision with multiple naves on one screen
7878 // like d-none for mobile nav
7979 pub fn id_suffix ( mut self , id_suffix : & str ) -> IndexLink {
Original file line number Diff line number Diff line change 2929 .dropdown-item {
3030 overflow : hidden ;
3131 text-overflow : ellipsis ;
32+ --bs-dropdown-link-hover-bg : #{$gray-700 } ;
33+ --bs-dropdown-link-active-bg : #{$neon-tint-100 } ;
3234 }
3335}
3436
6769 }
6870 }
6971
70- .collapase {
71- width : 100% ;
72- }
73-
7472 .btn-dropdown-text {
7573 overflow : hidden ;
7674 text-overflow : ellipsis ;
Original file line number Diff line number Diff line change 11import { Controller } from "@hotwired/stimulus" ;
22
33export default class extends Controller {
4- static targets = [
5- "link" ,
6- ] ;
7-
8- // When page reloads we need to set the left nav to the current window
9- // location since left nave is turbo permanent. Trigger this on event
10- // rather than on connect since on connect() will fire prior to backend
11- // redirects.
4+ static targets = [ "link" ] ;
5+
6+ // When page reloads we need to set the left nav to the current window
7+ // location since left nave is turbo permanent. Trigger this on event
8+ // rather than on connect since on connect() will fire prior to backend
9+ // redirects.
1210 connect ( ) {
1311 this . callback = ( ) => {
1412 this . setLeftNavToLocation ( ) ;
15- }
13+ } ;
1614
1715 document . addEventListener ( "turbo:load" , this . callback ) ;
1816 }
1917
20- // Find link element in the left nav that matches the current window
18+ // Find link element in the left nav that matches the current window
2119 // location and set to active
2220 setLeftNavToLocation ( ) {
2321 this . removeAllActive ( ) ;
2422
25- let tag = "a[href='" + window . location . pathname + window . location . search + "']" ;
23+ let tag =
24+ "a[href='" + window . location . pathname + window . location . search + "']" ;
2625 let element = this . element . querySelector ( tag ) ;
27-
26+
2827 if ( element ) {
2928 element . classList . add ( "active" ) ;
3029 }
Original file line number Diff line number Diff line change @@ -7,17 +7,15 @@ use sailfish::TemplateOnce;
77pub struct WebApp {
88 pub upper_nav : StaticNav ,
99 pub lower_nav : StaticNav ,
10- pub dropdown_nav : StaticNav ,
1110 pub id : Option < String > ,
1211}
1312
1413impl WebApp {
15- pub fn new ( upper_nav : StaticNav , lower_nav : StaticNav , dropdown_nav : StaticNav ) -> WebApp {
14+ pub fn new ( upper_nav : StaticNav , lower_nav : StaticNav ) -> WebApp {
1615 WebApp {
1716 upper_nav,
1817 lower_nav,
19- dropdown_nav,
20- id : None
18+ id : None ,
2119 }
2220 }
2321
Original file line number Diff line number Diff line change 11import { Controller } from "@hotwired/stimulus" ;
22
33export default class extends Controller {
4- static targets = [ ' stateReference' ]
4+ static targets = [ " stateReference" ] ;
55 expand ( ) {
6- if ( ! this . stateReferenceTarget . classList . contains ( "show" ) ) {
7- const elements = this . element . getElementsByClassName ( ' leftnav-collapse' )
8- for ( const element of elements ) {
9- bootstrap . Collapse . getOrCreateInstance ( element ) . show ( )
6+ if ( ! this . stateReferenceTarget . classList . contains ( "show" ) ) {
7+ const elements = this . element . getElementsByClassName ( " leftnav-collapse" ) ;
8+ for ( const element of elements ) {
9+ bootstrap . Collapse . getOrCreateInstance ( element ) . show ( ) ;
1010 }
1111 }
1212 }
1313
1414 collapse ( ) {
15- if ( this . stateReferenceTarget . classList . contains ( "show" ) ) {
16- const elements = this . element . getElementsByClassName ( 'leftnav-collapse' )
17- for ( const element of elements ) {
18- bootstrap . Collapse . getOrCreateInstance ( element , { toggle : false } ) . hide ( )
15+ if ( this . stateReferenceTarget . classList . contains ( "show" ) ) {
16+ const elements = this . element . getElementsByClassName ( "leftnav-collapse" ) ;
17+ for ( const element of elements ) {
18+ bootstrap . Collapse . getOrCreateInstance ( element , {
19+ toggle : false ,
20+ } ) . hide ( ) ;
1921 }
2022 }
2123 }
2224
2325 checkIfHover ( ) {
24- this . element . matches ( ' :hover' ) ? this . expand ( ) : this . collapse ( )
26+ this . element . matches ( " :hover" ) ? this . expand ( ) : this . collapse ( ) ;
2527 }
2628}
Original file line number Diff line number Diff line change 11use crate :: components:: { StaticNav , StaticNavLink } ;
2- use crate :: utils:: config;
32use pgml_components:: component;
43use sailfish:: TemplateOnce ;
54
65#[ derive( TemplateOnce , Default ) ]
76#[ template( path = "navigation/navbar/web_app/template.html" ) ]
87pub struct WebApp {
9- pub standalone_dashboard : bool ,
108 pub links : Vec < StaticNavLink > ,
119 pub account_management_nav : StaticNav ,
1210 pub deployment_controls : StaticNav ,
@@ -15,7 +13,6 @@ pub struct WebApp {
1513impl WebApp {
1614 pub fn new ( links : Vec < StaticNavLink > , deployment_controls : StaticNav ) -> WebApp {
1715 WebApp {
18- standalone_dashboard : config:: standalone_dashboard ( ) ,
1916 links,
2017 account_management_nav : StaticNav :: default ( ) ,
2118 deployment_controls,
Original file line number Diff line number Diff line change 11< %
2+ use crate::utils::config;
23 use crate::templates::components::GithubIcon;
34 use crate::templates::components::PostgresLogo;
4- use crate::components::{Dropdown, ProfileIcon};
5+ use crate::components::{Dropdown, ProfileIcon};
6+
7+ let standalone_dashboard = config::standalone_dashboard();
58%>
69
710 < div class ="fixed-top-nav font-family-primary " data-controller ="navigation-navbar-web-app ">
136139 < div class ="collapse navbar-collapse " id ="leftNavItems ">
137140 < div class ="nav-item w-100 d-flex flex-column flex-lg-row collapse show drawer-submenu ">
138141 < ul class ="sub-menu-dropdown mb-2 d-lg-none ">
142+ < li class ="mobile-dashboard-button mx-2 rounded-1 d-flex menu-item ">
143+ < a href ="/deployments " class ="py-2 text-white w-100 text-center ">
144+ Dashboard
145+ </ a >
146+ </ li >
139147 < % for link in links { %>
140148 < li class ="menu-item rounded-0 d-flex align-items-center ">
141149 < a
Original file line number Diff line number Diff line change 6666 background-color : #{$gray-700 } ;
6767 }
6868 }
69+
70+ .mobile-dashboard-button :not (:active ) {
71+ background-color : #{$gray-700 } ;
72+ }
6973}
Original file line number Diff line number Diff line change 142142
143143.drawer-submenu {
144144 white-space : nowrap ;
145- background-color : #{gray- 800} ;
146145 @include media-breakpoint-down (lg) {
147146 background-color : #{$gray-900 } ;
148147 }
Original file line number Diff line number Diff line change 2424 < main >
2525 < div class ="container-fluid p-0 min-vh-lg-100 ">
2626 < div class ="row gx-0 min-vh-lg-100 gy-0 ">
27- < %+ WebAppNavbar::new(left_nav_links, dropdown_nav.clone() ) %>
27+ < %+ WebAppNavbar::new(left_nav_links, dropdown_nav) %>
2828
2929 < div class ="d-flex ">
30- < %+ WebAppLeftNav::new( upper_left_nav.clone(), lower_left_nav, dropdown_nav ).id(&upper_left_nav.unique_id()) %>
30+ < %+ WebAppLeftNav::new( upper_left_nav.clone(), lower_left_nav).id(&upper_left_nav.unique_id()) %>
3131
3232 < div class ="clear-from-under-navbar flex-grow-1 min-vw-0 web-app-content-area ">
3333 < div class ="px-4 px-sm-5 py-3 " style ="position: absolute ">
You can’t perform that action at this time.
0 commit comments