Skip to content

Commit 8c28b02

Browse files
authored
Polish UI: lucide icons, sticky footer, hamburger nav, clickable logo (#162)
- Move third-party JS into static/vendor/ and add lucide for icons; refine .gitignore so embedded vendor dirs aren't caught by the Go vendor rule. - Replace folder/file emojis in the source browser with lucide icons. - Wrap the header logo and title in a single anchor so the icon is clickable. - Drop the redundant "Powered by git-pkgs" footer block; add a GitHub repo link to the About column and bump the ecosystem count from 16+ to 17+. - Sticky footer pattern: body is min-h-full flex column with main growing to fill, so the footer sits at the bottom of short pages. - Hamburger menu under md: search and nav links collapse into a drawer toggled by a menu button; theme toggle stays visible at both sizes.
1 parent da4fa2f commit 8c28b02

9 files changed

Lines changed: 94 additions & 41 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ proxy
1414
coverage.html
1515
coverage.txt
1616

17-
# Dependency directories
18-
vendor/
17+
# Go vendor directory (repo root only; embedded UI vendor dirs are tracked)
18+
/vendor/
1919

2020
# Go workspace file
2121
go.work

‎internal/server/server_test.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ func TestStaticFiles(t *testing.T) {
450450
path string
451451
contentTypes []string
452452
}{
453-
{"/ui/static/tailwind.js", []string{"text/javascript", "application/javascript"}},
453+
{"/ui/static/vendor/tailwind.js", []string{"text/javascript", "application/javascript"}},
454+
{"/ui/static/vendor/lucide.min.js", []string{"text/javascript", "application/javascript"}},
454455
{"/ui/static/style.css", []string{"text/css"}},
455456
}
456457

@@ -533,7 +534,7 @@ func TestDashboardWithEnrichmentStats(t *testing.T) {
533534
body := w.Body.String()
534535

535536
// Dashboard should link to Tailwind JS
536-
if !strings.Contains(body, "/ui/static/tailwind.js") {
537+
if !strings.Contains(body, "/ui/static/vendor/tailwind.js") {
537538
t.Error("dashboard should link to Tailwind JS")
538539
}
539540

‎internal/server/static/vendor/lucide.min.js‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎internal/server/templates/layout/base.html‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@
1111
<meta property="og:title" content="{{template "title" .}}">
1212
<meta property="og:site_name" content="git-pkgs proxy">
1313
{{end}}
14-
<script src="/ui/static/tailwind.js"></script>
14+
<script src="/ui/static/vendor/tailwind.js"></script>
15+
<script src="/ui/static/vendor/lucide.min.js" defer></script>
1516
<script>
1617
tailwind.config = { darkMode: 'class' }
1718
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
1819
document.documentElement.classList.add('dark')
1920
}
21+
document.addEventListener('DOMContentLoaded', () => {
22+
if (window.lucide) lucide.createIcons({ attrs: { 'aria-hidden': 'true', focusable: 'false' } })
23+
})
2024
</script>
2125
{{block "head" .}}{{end}}
2226
</head>
23-
<body class="h-full bg-gray-50 dark:bg-gray-950 text-gray-900 dark:text-gray-100">
27+
<body class="min-h-full flex flex-col bg-gray-50 dark:bg-gray-950 text-gray-900 dark:text-gray-100">
2428
{{template "header" .}}
2529

26-
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
30+
<main class="flex-1 w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
2731
{{block "content" .}}{{end}}
2832
</main>
2933

‎internal/server/templates/layout/footer.html‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
<div>
66
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100 mb-3">About</h3>
77
<p class="text-sm text-gray-600 dark:text-gray-400">
8-
git-pkgs proxy is a caching proxy for package registries supporting 16+ ecosystems.
8+
git-pkgs proxy is a caching proxy for package registries supporting 17+ ecosystems.
9+
</p>
10+
<p class="text-sm text-gray-600 dark:text-gray-400 mt-2">
11+
<a href="https://github.com/git-pkgs/proxy" target="_blank" rel="noopener" class="inline-flex items-center gap-1 hover:text-gray-900 dark:hover:text-gray-100">
12+
<i data-lucide="github" class="w-4 h-4"></i><span>github.com/git-pkgs/proxy</span>
13+
</a>
914
</p>
1015
</div>
1116
<div>
@@ -26,11 +31,6 @@ <h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100 mb-3">Supporte
2631
</div>
2732
</div>
2833
</div>
29-
<div class="mt-8 pt-8 border-t border-gray-200 dark:border-gray-800">
30-
<p class="text-xs text-center text-gray-500 dark:text-gray-400">
31-
Powered by <a href="https://github.com/git-pkgs" class="hover:text-gray-900 dark:hover:text-gray-100" target="_blank">git-pkgs</a>
32-
</p>
33-
</div>
3434
</div>
3535
</footer>
3636
{{end}}
Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
11
{{define "header"}}
22
<header class="sticky top-0 z-50 border-b border-gray-200 dark:border-gray-800 bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm">
33
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
4-
<div class="flex justify-between items-center h-16">
5-
<div class="flex items-center gap-2">
4+
<div class="flex justify-between items-center h-16 gap-4">
5+
<a href="/ui/" class="flex items-center gap-2 text-xl font-semibold hover:text-gray-700 dark:hover:text-gray-300 shrink-0">
66
<svg class="w-8 h-8 text-primary-600 dark:text-primary-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
77
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"/>
88
</svg>
9-
<a href="/ui/" class="text-xl font-semibold hover:text-gray-700 dark:hover:text-gray-300">git-pkgs proxy</a>
10-
</div>
11-
<div class="flex-1 max-w-md mx-8">
12-
<form action="/ui/search" method="get" class="relative">
13-
<input
14-
type="text"
15-
name="q"
16-
placeholder="Search packages..."
17-
class="w-full px-4 py-2 pl-10 text-sm bg-gray-100 dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400"
18-
/>
19-
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
20-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
21-
</svg>
22-
</form>
9+
<span>git-pkgs proxy</span>
10+
</a>
11+
<div class="hidden md:block flex-1 max-w-md mx-4">
12+
{{template "search_form" .}}
2313
</div>
24-
<nav class="flex items-center gap-6">
25-
<a href="/ui/install" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100">Install</a>
26-
<a href="/health" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100">Health</a>
27-
<a href="/stats" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100">API</a>
28-
<button id="theme-toggle" class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors">
14+
<nav class="hidden md:flex items-center gap-6">
15+
{{template "nav_links" .}}
16+
</nav>
17+
<div class="flex items-center gap-2">
18+
<button id="theme-toggle" class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" aria-label="Toggle theme">
2919
<svg class="w-5 h-5 hidden dark:block" fill="currentColor" viewBox="0 0 20 20">
3020
<path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/>
3121
</svg>
3222
<svg class="w-5 h-5 block dark:hidden" fill="currentColor" viewBox="0 0 20 20">
3323
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
3424
</svg>
3525
</button>
26+
<button id="nav-toggle" type="button" class="md:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" aria-label="Toggle menu" aria-expanded="false" aria-controls="mobile-nav">
27+
<span class="nav-icon-open"><i data-lucide="menu" class="w-5 h-5"></i></span>
28+
<span class="nav-icon-close hidden"><i data-lucide="x" class="w-5 h-5"></i></span>
29+
</button>
30+
</div>
31+
</div>
32+
<div id="mobile-nav" class="hidden md:hidden pb-4 space-y-3">
33+
{{template "search_form" .}}
34+
<nav class="flex flex-col">
35+
{{template "nav_links" .}}
3636
</nav>
3737
</div>
3838
</div>
3939
</header>
4040
{{end}}
41+
42+
{{define "search_form"}}
43+
<form action="/ui/search" method="get" class="relative">
44+
<input
45+
type="text"
46+
name="q"
47+
placeholder="Search packages..."
48+
class="w-full px-4 py-2 pl-10 text-sm bg-gray-100 dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400"
49+
/>
50+
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
51+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
52+
</svg>
53+
</form>
54+
{{end}}
55+
56+
{{define "nav_links"}}
57+
<a href="/ui/install" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 py-2 md:py-0">Install</a>
58+
<a href="/health" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 py-2 md:py-0">Health</a>
59+
<a href="/stats" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 py-2 md:py-0">API</a>
60+
{{end}}

‎internal/server/templates/layout/styles.html‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,18 @@
99
localStorage.theme = 'dark';
1010
}
1111
});
12+
13+
(function() {
14+
const toggle = document.getElementById('nav-toggle');
15+
const menu = document.getElementById('mobile-nav');
16+
if (!toggle || !menu) return;
17+
toggle.addEventListener('click', function() {
18+
const open = toggle.getAttribute('aria-expanded') === 'true';
19+
toggle.setAttribute('aria-expanded', String(!open));
20+
menu.classList.toggle('hidden');
21+
toggle.querySelector('.nav-icon-open').classList.toggle('hidden');
22+
toggle.querySelector('.nav-icon-close').classList.toggle('hidden');
23+
});
24+
})();
1225
</script>
1326
{{end}}

‎internal/server/templates/pages/browse_source.html‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,35 +100,38 @@ <h2 class="font-semibold font-mono text-sm" id="file-path">Select a file</h2>
100100
if (basePath) {
101101
const parentPath = basePath.split('/').slice(0, -2).join('/');
102102
html += `
103-
<div class="px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded cursor-pointer text-sm"
103+
<div class="px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded cursor-pointer text-sm flex items-center gap-2 text-gray-500 dark:text-gray-400"
104104
onclick="loadFileTree('${escapeHTML(parentPath)}'); currentPath='${escapeHTML(parentPath)}';">
105-
<span class="text-gray-500 dark:text-gray-400">📁 ..</span>
105+
<i data-lucide="corner-left-up" class="w-4 h-4 shrink-0"></i><span>..</span>
106106
</div>
107107
`;
108108
}
109109

110110
// Render files and directories
111111
for (const file of files) {
112-
const icon = file.is_dir ? '📁' : '📄';
113-
const classes = 'px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded cursor-pointer text-sm truncate';
112+
const iconName = file.is_dir ? 'folder' : 'file';
113+
const iconClass = file.is_dir ? 'text-amber-500 dark:text-amber-400' : 'text-gray-500 dark:text-gray-400';
114+
const classes = 'px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded cursor-pointer text-sm flex items-center gap-2';
115+
const iconHTML = `<i data-lucide="${iconName}" class="w-4 h-4 shrink-0 ${iconClass}"></i>`;
114116

115117
if (file.is_dir) {
116118
html += `
117119
<div class="${classes}" onclick="loadFileTree('${escapeHTML(file.path)}'); currentPath='${escapeHTML(file.path)}';">
118-
<span>${icon} ${escapeHTML(file.name)}</span>
120+
${iconHTML}<span class="truncate">${escapeHTML(file.name)}</span>
119121
</div>
120122
`;
121123
} else {
122124
html += `
123125
<div class="${classes}" onclick="loadFile('${escapeHTML(file.path)}')">
124-
<span>${icon} ${escapeHTML(file.name)}</span>
125-
<span class="text-xs text-gray-500 dark:text-gray-400 ml-2">${formatSize(file.size)}</span>
126+
${iconHTML}<span class="truncate">${escapeHTML(file.name)}</span>
127+
<span class="text-xs text-gray-500 dark:text-gray-400 ml-auto shrink-0">${formatSize(file.size)}</span>
126128
</div>
127129
`;
128130
}
129131
}
130132

131133
container.innerHTML = html;
134+
if (window.lucide) lucide.createIcons({ attrs: { 'aria-hidden': 'true', focusable: 'false' } });
132135
}
133136

134137
// Load and display file content

0 commit comments

Comments
 (0)