feat(sidebar): add compliance scanner link from env config (#19)
This commit was merged in pull request #19.
This commit is contained in:
@@ -76,6 +76,7 @@ pub fn AppShell() -> Element {
|
||||
name: info.name,
|
||||
avatar_url: info.avatar_url,
|
||||
librechat_url: info.librechat_url,
|
||||
compliance_scanner_url: info.compliance_scanner_url,
|
||||
class: sidebar_cls,
|
||||
on_nav: move |_| mobile_menu_open.set(false),
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_free_icons::icons::bs_icons::{
|
||||
BsBoxArrowRight, BsBuilding, BsChatDots, BsCloudArrowUp, BsCodeSlash, BsGithub, BsGlobe2,
|
||||
BsGrid, BsHouseDoor, BsMoonFill, BsSunFill,
|
||||
BsGrid, BsHouseDoor, BsMoonFill, BsShieldCheck, BsSunFill,
|
||||
};
|
||||
use dioxus_free_icons::Icon;
|
||||
|
||||
@@ -44,13 +44,14 @@ pub fn Sidebar(
|
||||
email: String,
|
||||
avatar_url: String,
|
||||
#[props(default = "http://localhost:3080".to_string())] librechat_url: String,
|
||||
#[props(default)] compliance_scanner_url: String,
|
||||
#[props(default = "sidebar".to_string())] class: String,
|
||||
#[props(default)] on_nav: EventHandler<()>,
|
||||
) -> Element {
|
||||
let locale = use_context::<Signal<Locale>>();
|
||||
let locale_val = *locale.read();
|
||||
|
||||
let nav_items: Vec<NavItem> = vec![
|
||||
let mut nav_items: Vec<NavItem> = vec![
|
||||
NavItem {
|
||||
key: "dashboard",
|
||||
label: t(locale_val, "nav.dashboard"),
|
||||
@@ -84,6 +85,16 @@ pub fn Sidebar(
|
||||
},
|
||||
];
|
||||
|
||||
// Only show the compliance scanner link when a URL is configured.
|
||||
if !compliance_scanner_url.is_empty() {
|
||||
nav_items.push(NavItem {
|
||||
key: "compliance",
|
||||
label: t(locale_val, "nav.compliance"),
|
||||
target: NavTarget::External(compliance_scanner_url.clone()),
|
||||
icon: rsx! { Icon { icon: BsShieldCheck, width: 18, height: 18 } },
|
||||
});
|
||||
}
|
||||
|
||||
// Determine current path to highlight the active nav link.
|
||||
let current_route = use_route::<Route>();
|
||||
let logout_label = t(locale_val, "common.logout");
|
||||
|
||||
Reference in New Issue
Block a user