diff --git a/nora-registry/src/ui/components.rs b/nora-registry/src/ui/components.rs
index 75f98f9..244083b 100644
--- a/nora-registry/src/ui/components.rs
+++ b/nora-registry/src/ui/components.rs
@@ -42,21 +42,29 @@ pub fn layout(title: &str, content: &str, active_page: Option<&str>) -> String {
fn sidebar(active_page: Option<&str>) -> String {
let active = active_page.unwrap_or("");
+ // SVG icon paths for registries (Simple Icons style)
+ let docker_icon = r#""#;
+ let maven_icon = r#""#;
+ let npm_icon = r#""#;
+ let cargo_icon = r#""#;
+ let pypi_icon = r#""#;
+
let nav_items = [
(
"dashboard",
"/ui/",
"Dashboard",
r#""#,
+ true, // stroke icon
),
- ("docker", "/ui/docker", "🐳 Docker", ""),
- ("maven", "/ui/maven", "☕ Maven", ""),
- ("npm", "/ui/npm", "📦 npm", ""),
- ("cargo", "/ui/cargo", "🦀 Cargo", ""),
- ("pypi", "/ui/pypi", "🐍 PyPI", ""),
+ ("docker", "/ui/docker", "Docker", docker_icon, false),
+ ("maven", "/ui/maven", "Maven", maven_icon, false),
+ ("npm", "/ui/npm", "npm", npm_icon, false),
+ ("cargo", "/ui/cargo", "Cargo", cargo_icon, false),
+ ("pypi", "/ui/pypi", "PyPI", pypi_icon, false),
];
- let nav_html: String = nav_items.iter().map(|(id, href, label, icon_path)| {
+ let nav_html: String = nav_items.iter().map(|(id, href, label, icon_path, is_stroke)| {
let is_active = active == *id;
let active_class = if is_active {
"bg-slate-700 text-white"
@@ -64,24 +72,21 @@ fn sidebar(active_page: Option<&str>) -> String {
"text-slate-300 hover:bg-slate-700 hover:text-white"
};
- if icon_path.is_empty() {
- // Emoji-based item
- format!(r#"
-
- {}
-
- "#, href, active_class, label)
+ // SVG attributes differ for stroke vs fill icons
+ let (fill_attr, stroke_attr) = if *is_stroke {
+ ("none", r#" stroke="currentColor""#)
} else {
- // SVG icon item
- format!(r##"
-
-
+ ("currentColor", "")
+ };
+
+ format!(r##"
+
+
- "##, href, active_class, icon_path, label)
- }
+
+ {}
+
+ "##, href, active_class, fill_attr, stroke_attr, icon_path, label)
}).collect();
format!(
@@ -108,7 +113,7 @@ fn sidebar(active_page: Option<&str>) -> String {
- Nora v0.1.0
+ Nora v0.2.0
@@ -140,13 +145,24 @@ fn header() -> String {
"##.to_string()
}
-/// Stat card for dashboard
-pub fn stat_card(name: &str, icon: &str, count: usize, href: &str, unit: &str) -> String {
+/// SVG icon definitions for registries (exported for use in templates)
+pub mod icons {
+ pub const DOCKER: &str = r#""#;
+ pub const MAVEN: &str = r#""#;
+ pub const NPM: &str = r#""#;
+ pub const CARGO: &str = r#""#;
+ pub const PYPI: &str = r#""#;
+}
+
+/// Stat card for dashboard with SVG icon
+pub fn stat_card(name: &str, icon_path: &str, count: usize, href: &str, unit: &str) -> String {
format!(
r##"
- {}
+
ACTIVE
{}
@@ -154,7 +170,7 @@ pub fn stat_card(name: &str, icon: &str, count: usize, href: &str, unit: &str) -
{}
"##,
- href, icon, name, count, unit
+ href, icon_path, name, count, unit
)
}
diff --git a/nora-registry/src/ui/templates.rs b/nora-registry/src/ui/templates.rs
index e744c26..4960809 100644
--- a/nora-registry/src/ui/templates.rs
+++ b/nora-registry/src/ui/templates.rs
@@ -22,35 +22,35 @@ pub fn render_dashboard(stats: &RegistryStats) -> String {
Quick Links
"##,
- stat_card("Docker", "🐳", stats.docker, "/ui/docker", "images"),
- stat_card("Maven", "☕", stats.maven, "/ui/maven", "artifacts"),
- stat_card("npm", "📦", stats.npm, "/ui/npm", "packages"),
- stat_card("Cargo", "🦀", stats.cargo, "/ui/cargo", "crates"),
- stat_card("PyPI", "🐍", stats.pypi, "/ui/pypi", "packages"),
+ stat_card("Docker", icons::DOCKER, stats.docker, "/ui/docker", "images"),
+ stat_card("Maven", icons::MAVEN, stats.maven, "/ui/maven", "artifacts"),
+ stat_card("npm", icons::NPM, stats.npm, "/ui/npm", "packages"),
+ stat_card("Cargo", icons::CARGO, stats.cargo, "/ui/cargo", "crates"),
+ stat_card("PyPI", icons::PYPI, stats.pypi, "/ui/pypi", "packages"),
+ // Quick Links icons
+ icons::DOCKER,
+ icons::MAVEN,
+ icons::NPM,
+ icons::CARGO,
+ icons::PYPI,
);
layout("Dashboard", &content, Some("dashboard"))
@@ -119,7 +125,7 @@ pub fn render_registry_list(registry_type: &str, title: &str, repos: &[RepoInfo]
r##"
-
{}
+
{}
{} repositories
@@ -207,7 +213,7 @@ pub fn render_docker_detail(name: &str, detail: &DockerDetail) -> String {
{}
- 🐳
+
{}
@@ -243,6 +249,7 @@ pub fn render_docker_detail(name: &str, detail: &DockerDetail) -> String {
"##,
html_escape(name),
+ icons::DOCKER,
html_escape(name),
pull_cmd,
pull_cmd,
@@ -303,7 +310,7 @@ pub fn render_package_detail(registry_type: &str, name: &str, detail: &PackageDe
{}
- {}
+
{}
@@ -402,7 +409,7 @@ pub fn render_maven_detail(path: &str, detail: &MavenDetail) -> String {
{}
- ☕
+
{}
@@ -430,6 +437,7 @@ pub fn render_maven_detail(path: &str, detail: &MavenDetail) -> String {
"##,
html_escape(path),
+ icons::MAVEN,
html_escape(path),
html_escape(&dep_cmd),
detail.artifacts.len(),
@@ -439,14 +447,15 @@ pub fn render_maven_detail(path: &str, detail: &MavenDetail) -> String {
layout(&format!("{} - Maven", path), &content, Some("maven"))
}
+/// Returns SVG icon path for the registry type
fn get_registry_icon(registry_type: &str) -> &'static str {
match registry_type {
- "docker" => "🐳",
- "maven" => "☕",
- "npm" => "📦",
- "cargo" => "🦀",
- "pypi" => "🐍",
- _ => "📁",
+ "docker" => icons::DOCKER,
+ "maven" => icons::MAVEN,
+ "npm" => icons::NPM,
+ "cargo" => icons::CARGO,
+ "pypi" => icons::PYPI,
+ _ => r#""#,
}
}