8357d9d76e
- All 7 pages rewritten: Dashboard, Terminal, Snippets, Keychain, SFTP, Settings, Brief - Apply consistent Lumina glassmorphic theme (rounded-2xl, shadows, borders, tracking) - Fix SVG icons not rendering — return template.HTML instead of string - Fix Alpine x-data scoping: terminal tabs, SFTP modals, snippet tag buttons - Fix dashboard search sending literal ?q=... - Rebuild CSS with all new Tailwind classes (62KB) - Add .air.toml with hot-reload config, docs/PERBAIKANUI.md checklist - Remove unused backup partials
185 lines
12 KiB
HTML
185 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Snippets · Hostkeeper V2</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="/static/css/output.css">
|
|
<link rel="stylesheet" href="/static/css/custom.css">
|
|
<script src="/static/js/htmx.min.js"></script>
|
|
<script src="/static/js/alpine.min.js" defer></script>
|
|
<script src="/static/js/clipboard.js"></script>
|
|
<script src="/static/js/utils.js"></script>
|
|
</head>
|
|
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
|
<div class="flex min-h-screen">
|
|
{{template "nav" .}}
|
|
<div class="flex-1 flex flex-col overflow-hidden">
|
|
<header class="h-14 border-b border-outline-variant/30 flex items-center px-6 bg-white/70 backdrop-blur-md">
|
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
|
</header>
|
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
|
<div class="max-w-7xl mx-auto space-y-8">
|
|
<!-- Search Header Panel -->
|
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
|
<div>
|
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">Snippets & Scripts Library</h2>
|
|
<p class="text-xs text-on-surface-variant mt-0.5">Quickly reuse and catalog command line shortcuts across remote clusters</p>
|
|
</div>
|
|
<div class="flex items-center gap-3">
|
|
<div class="relative">
|
|
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><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"/></svg>
|
|
<input type="search" name="q" placeholder="Search code snippets..."
|
|
hx-get="/snippets/grid" hx-trigger="keyup delay:200ms" hx-target="#snippet-grid"
|
|
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all">
|
|
</div>
|
|
<button @click="$dispatch('open-snippet-modal')"
|
|
class="flex items-center gap-1.5 bg-primary text-white hover:bg-primary/90 font-bold text-xs py-2 px-4 rounded-xl shadow-md transition-all">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
|
New Snippet
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Grid: Sidebar + Cards -->
|
|
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
|
<!-- Sidebar -->
|
|
<div class="lg:col-span-3 space-y-5" x-data="sidebarManager()" x-init="init()">
|
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-4 space-y-4">
|
|
<h4 class="text-xs font-bold text-outline-variant uppercase tracking-wider px-2">Collections</h4>
|
|
<div class="space-y-1 text-sm font-semibold">
|
|
<button hx-get="/snippets/grid" hx-target="#snippet-grid"
|
|
:class="activeColl === 'all' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
|
@click="activeColl = 'all'">
|
|
<span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg> All Code Blocks</span>
|
|
<span class="text-xs text-outline" x-text="total"></span>
|
|
</button>
|
|
<button hx-get="/snippets/grid?collection=favorites" hx-target="#snippet-grid"
|
|
:class="activeColl === 'favorites' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
|
@click="activeColl = 'favorites'">
|
|
<span class="flex items-center gap-2"><svg class="w-4 h-4 text-amber-500" fill="currentColor" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg> Starred Favorites</span>
|
|
<span class="text-xs text-outline" x-text="favCount"></span>
|
|
</button>
|
|
<button hx-get="/snippets/grid?collection=recent" hx-target="#snippet-grid"
|
|
:class="activeColl === 'recent' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
|
@click="activeColl = 'recent'">
|
|
<span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Recent</span>
|
|
<span class="text-xs text-outline" x-text="recentCount"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-4 space-y-3">
|
|
<h4 class="text-xs font-bold text-outline-variant uppercase tracking-wider px-2">Tag Categories</h4>
|
|
<div class="flex flex-wrap gap-1.5 p-1">
|
|
<button hx-get="/snippets/grid" hx-target="#snippet-grid"
|
|
:class="activeTag === 'all' ? 'bg-primary text-white' : 'bg-surface-container-low text-on-surface-variant hover:bg-surface-container'"
|
|
class="px-3 py-1 rounded-full text-xs font-bold transition-all"
|
|
@click="activeTag = 'all'">All Tags</button>
|
|
{{range .AllTags}}
|
|
<button hx-get="/snippets/grid?tag={{.}}" hx-target="#snippet-grid"
|
|
:class="activeTag === '{{.}}' ? 'bg-primary text-white' : 'bg-surface-container-low text-on-surface-variant hover:bg-surface-container'"
|
|
class="px-3 py-1 rounded-full text-xs font-bold transition-all"
|
|
@click="activeTag = '{{.}}'">
|
|
{{.}}
|
|
</button>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Snippet Cards -->
|
|
<div class="lg:col-span-9 space-y-6" id="snippet-grid">
|
|
{{template "snippet_grid" .}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Snippet Modal -->
|
|
<div id="snippet-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
|
@open-snippet-modal.window="open = true" @keydown.escape.window="open = false">
|
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
|
<div class="bg-white rounded-2xl max-w-lg w-full border border-outline-variant/30 shadow-2xl p-6 space-y-4">
|
|
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
|
<h3 class="font-bold text-lg text-on-surface">Store Custom Snippet</h3>
|
|
<button @click="open = false" class="text-outline hover:text-primary p-1 rounded">Cancel</button>
|
|
</div>
|
|
<form hx-post="/snippets" hx-target="#snippet-grid" hx-swap="outerHTML"
|
|
@submit="open = false" class="space-y-4 text-sm">
|
|
<div class="flex flex-col gap-1">
|
|
<label class="text-xs font-bold text-on-surface-variant">SNIPPET TITLE</label>
|
|
<input type="text" name="name" required placeholder="e.g. Purge Docker Cache"
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-medium">
|
|
</div>
|
|
<div class="flex flex-col gap-1">
|
|
<label class="text-xs font-bold text-on-surface-variant">SHORT DESCRIPTION / USAGE</label>
|
|
<input type="text" name="description" placeholder="e.g. Safe cleanup to recover workspace disk capacity."
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-medium">
|
|
</div>
|
|
<div class="flex flex-col gap-1">
|
|
<label class="text-xs font-bold text-on-surface-variant">CODE SYNTAX BLOCK</label>
|
|
<textarea name="content" required rows="4" placeholder="e.g. systemctl restart nginx"
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-mono text-xs"></textarea>
|
|
</div>
|
|
<div class="flex flex-col gap-1">
|
|
<label class="text-xs font-bold text-on-surface-variant">PRIMARY TAG CATEGORY</label>
|
|
<select name="tags"
|
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2 px-3 focus:outline-none focus:border-primary">
|
|
<option value="DevOps">DevOps</option>
|
|
<option value="Docker">Docker</option>
|
|
<option value="Nginx">Nginx</option>
|
|
<option value="Git">Git</option>
|
|
<option value="SSL">SSL</option>
|
|
<option value="Security">Security</option>
|
|
<option value="Database">Database</option>
|
|
</select>
|
|
</div>
|
|
<input type="hidden" name="collection" value="recent">
|
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
|
<button type="button" @click="open = false"
|
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface">Cancel</button>
|
|
<button type="submit"
|
|
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary/90 transition-all">Save Code Snippet</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function sidebarManager() {
|
|
return {
|
|
activeColl: 'all',
|
|
activeTag: 'all',
|
|
total: 0,
|
|
favCount: 0,
|
|
recentCount: 0,
|
|
init() {
|
|
this.updateCounts();
|
|
document.body.addEventListener('htmx:afterSwap', () => this.updateCounts());
|
|
},
|
|
updateCounts() {
|
|
const el = document.getElementById('snippet-data');
|
|
if (!el) return;
|
|
try {
|
|
const snippets = JSON.parse(el.textContent) || [];
|
|
this.total = snippets.length;
|
|
this.favCount = snippets.filter(s => s.Collection === 'favorites').length;
|
|
this.recentCount = snippets.filter(s => s.Collection === 'recent').length;
|
|
} catch(e) {}
|
|
}
|
|
};
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|