50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
func HomePage(w http.ResponseWriter, r *http.Request) {
|
|
cfg := LoadConfig()
|
|
var items strings.Builder
|
|
for _, n := range visibleNavItems(cfg.BetaToolsEnabled) {
|
|
if n.Path == "/" {
|
|
continue
|
|
}
|
|
badge := ""
|
|
if n.Beta {
|
|
badge = ` <span class="beta-pill">Beta</span>`
|
|
}
|
|
items.WriteString(`<a class="home-tool" href="` + n.Path + `"><span class="home-tool-title">` + n.Label + badge + `</span><span class="home-tool-desc">` + n.Description + `</span></a>`)
|
|
}
|
|
|
|
body := `
|
|
<header class="tool-header">
|
|
<h2 class="tool-title">HPL Toolbox</h2>
|
|
<p class="tool-description">Standalone build. Pick a tool to open.</p>
|
|
</header>
|
|
<div class="home-tools">
|
|
` + items.String() + `
|
|
</div>
|
|
<style>
|
|
.home-tools { display:flex; flex-direction:column; gap:8px; max-width:620px; }
|
|
.home-tool {
|
|
display:block;
|
|
min-height:52px;
|
|
padding:9px 11px;
|
|
color:#ddd;
|
|
text-decoration:none;
|
|
background:#2a2d2e;
|
|
border:1px solid #333;
|
|
border-radius:5px;
|
|
}
|
|
.home-tool:hover { background:#33373a; border-color:#007fd4; }
|
|
.home-tool-title { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; font-weight:600; }
|
|
.home-tool-desc { display:block; margin-top:4px; color:#a7a7a7; font-size:11px; line-height:1.35; }
|
|
</style>
|
|
`
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
_, _ = w.Write([]byte(Page("/", "Home", body)))
|
|
}
|