mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 12:40:31 +00:00
feat: replace emoji icons with SVG brand icons
- Add icons module with Docker, Maven, npm, Cargo, PyPI SVGs - Update sidebar navigation with proper fill/stroke rendering - Update stat cards, quick links, and detail pages - Consistent icon styling across all UI components
This commit is contained in:
@@ -22,35 +22,35 @@ pub fn render_dashboard(stats: &RegistryStats) -> String {
|
||||
<h2 class="text-lg font-semibold text-slate-800 mb-4">Quick Links</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<a href="/ui/docker" class="flex items-center p-3 rounded-lg border border-slate-200 hover:border-blue-300 hover:bg-blue-50 transition-colors">
|
||||
<span class="text-2xl mr-3">🐳</span>
|
||||
<svg class="w-8 h-8 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<div class="font-medium text-slate-700">Docker Registry</div>
|
||||
<div class="text-sm text-slate-500">API: /v2/</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="/ui/maven" class="flex items-center p-3 rounded-lg border border-slate-200 hover:border-blue-300 hover:bg-blue-50 transition-colors">
|
||||
<span class="text-2xl mr-3">☕</span>
|
||||
<svg class="w-8 h-8 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<div class="font-medium text-slate-700">Maven Repository</div>
|
||||
<div class="text-sm text-slate-500">API: /maven2/</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="/ui/npm" class="flex items-center p-3 rounded-lg border border-slate-200 hover:border-blue-300 hover:bg-blue-50 transition-colors">
|
||||
<span class="text-2xl mr-3">📦</span>
|
||||
<svg class="w-8 h-8 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<div class="font-medium text-slate-700">npm Registry</div>
|
||||
<div class="text-sm text-slate-500">API: /npm/</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="/ui/cargo" class="flex items-center p-3 rounded-lg border border-slate-200 hover:border-blue-300 hover:bg-blue-50 transition-colors">
|
||||
<span class="text-2xl mr-3">🦀</span>
|
||||
<svg class="w-8 h-8 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<div class="font-medium text-slate-700">Cargo Registry</div>
|
||||
<div class="text-sm text-slate-500">API: /cargo/</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="/ui/pypi" class="flex items-center p-3 rounded-lg border border-slate-200 hover:border-blue-300 hover:bg-blue-50 transition-colors">
|
||||
<span class="text-2xl mr-3">🐍</span>
|
||||
<svg class="w-8 h-8 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<div class="font-medium text-slate-700">PyPI Repository</div>
|
||||
<div class="text-sm text-slate-500">API: /simple/</div>
|
||||
@@ -59,11 +59,17 @@ pub fn render_dashboard(stats: &RegistryStats) -> String {
|
||||
</div>
|
||||
</div>
|
||||
"##,
|
||||
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##"
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<span class="text-3xl mr-3">{}</span>
|
||||
<svg class="w-10 h-10 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-slate-800">{}</h1>
|
||||
<p class="text-slate-500">{} repositories</p>
|
||||
@@ -207,7 +213,7 @@ pub fn render_docker_detail(name: &str, detail: &DockerDetail) -> String {
|
||||
<span class="text-slate-800 font-medium">{}</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="text-3xl mr-3">🐳</span>
|
||||
<svg class="w-10 h-10 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<h1 class="text-2xl font-bold text-slate-800">{}</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -243,6 +249,7 @@ pub fn render_docker_detail(name: &str, detail: &DockerDetail) -> String {
|
||||
</div>
|
||||
"##,
|
||||
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
|
||||
<span class="text-slate-800 font-medium">{}</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="text-3xl mr-3">{}</span>
|
||||
<svg class="w-10 h-10 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<h1 class="text-2xl font-bold text-slate-800">{}</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -402,7 +409,7 @@ pub fn render_maven_detail(path: &str, detail: &MavenDetail) -> String {
|
||||
<span class="text-slate-800 font-medium">{}</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="text-3xl mr-3">☕</span>
|
||||
<svg class="w-10 h-10 mr-3 text-slate-600" fill="currentColor" viewBox="0 0 24 24">{}</svg>
|
||||
<h1 class="text-2xl font-bold text-slate-800">{}</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -430,6 +437,7 @@ pub fn render_maven_detail(path: &str, detail: &MavenDetail) -> String {
|
||||
</div>
|
||||
"##,
|
||||
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#"<path fill="currentColor" d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>"#,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user