@@ -35,6 +35,7 @@ pub fn rustmail_navbar(props: &RustmailNavbarProps) -> Html {
3535 let home_active = current_path == "/panel" ;
3636 let config_active = current_path == "/panel/configuration" ;
3737 let apikeys_active = current_path == "/panel/apikeys" ;
38+ let categories_active = current_path == "/panel/categories" ;
3839 let tickets_active = current_path. starts_with ( "/panel/tickets" ) ;
3940 let admin_active = current_path == "/admin" ;
4041
@@ -45,6 +46,9 @@ pub fn rustmail_navbar(props: &RustmailNavbarProps) -> Html {
4546 let has_manage_permissions = props
4647 . permissions
4748 . contains ( & PanelPermission :: ManagePermissions ) ;
49+ let has_manage_categories = props
50+ . permissions
51+ . contains ( & PanelPermission :: ManageCategories ) ;
4852
4953 html ! {
5054 <nav class="fixed top-0 left-0 w-full z-50 bg-gradient-to-r from-slate-900 to-black border-b border-slate-800" >
@@ -162,6 +166,31 @@ pub fn rustmail_navbar(props: &RustmailNavbarProps) -> Html {
162166 html! { }
163167 } }
164168
169+ { if has_manage_categories {
170+ html! {
171+ <button
172+ onclick={ {
173+ let navigator = navigator. clone( ) ;
174+ move |_| if let Some ( nav) = & navigator {
175+ nav. push( & PanelRoute :: Categories ) ;
176+ }
177+ } }
178+ class={ classes!(
179+ "rounded-md" , "px-3" , "py-2" , "text-sm" , "transition" ,
180+ if categories_active {
181+ "bg-white/10 text-white"
182+ } else {
183+ "text-gray-300 hover:bg-white/10 hover:text-white"
184+ }
185+ ) }
186+ >
187+ { i18n. t( "navbar.categories" ) }
188+ </button>
189+ }
190+ } else {
191+ html! { }
192+ } }
193+
165194 { if has_manage_permissions {
166195 html! {
167196 <a
@@ -339,6 +368,35 @@ pub fn rustmail_navbar(props: &RustmailNavbarProps) -> Html {
339368 html! { }
340369 } }
341370
371+ { if has_manage_categories {
372+ html! {
373+ <button
374+ onclick={ {
375+ let navigator = navigator. clone( ) ;
376+ let mobile_menu_open = mobile_menu_open. clone( ) ;
377+ move |_| {
378+ if let Some ( nav) = & navigator {
379+ nav. push( & PanelRoute :: Categories ) ;
380+ }
381+ mobile_menu_open. set( false ) ;
382+ }
383+ } }
384+ class={ classes!(
385+ "block" , "w-full" , "text-left" , "rounded-md" , "px-3" , "py-2" , "text-sm" , "transition" ,
386+ if categories_active {
387+ "bg-white/10 text-white"
388+ } else {
389+ "text-gray-300 hover:bg-white/10 hover:text-white"
390+ }
391+ ) }
392+ >
393+ { i18n. t( "navbar.categories" ) }
394+ </button>
395+ }
396+ } else {
397+ html! { }
398+ } }
399+
342400 { if has_manage_permissions {
343401 html! {
344402 <a
0 commit comments