refactor(frontend): port search-zen-50 style to Go templates
Replace React SPA with simple Go templates using search-zen-50 visual style. No JavaScript required - pure HTML/CSS with clean teal accent color scheme, monospace logo, and minimal design. - Simplified base.html without HTMX or autocomplete JS - Clean homepage with centered search box - Results page with sticky header and category tabs - Simplified CSS matching search-zen-50 aesthetics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
168cb78fab
commit
37420ae5a8
5 changed files with 291 additions and 1411 deletions
|
|
@ -19,6 +19,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
|
@ -30,7 +31,7 @@ import (
|
|||
"github.com/metamorphosis-dev/kafka/internal/httpapi"
|
||||
"github.com/metamorphosis-dev/kafka/internal/middleware"
|
||||
"github.com/metamorphosis-dev/kafka/internal/search"
|
||||
"github.com/metamorphosis-dev/kafka/internal/spa"
|
||||
"github.com/metamorphosis-dev/kafka/internal/views"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -80,15 +81,23 @@ func main() {
|
|||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// API routes - handled by Go
|
||||
mux.HandleFunc("/healthz", h.Healthz)
|
||||
// HTML template routes
|
||||
mux.HandleFunc("/", h.Index)
|
||||
mux.HandleFunc("/search", h.Search)
|
||||
mux.HandleFunc("/preferences", h.Preferences)
|
||||
|
||||
// API routes
|
||||
mux.HandleFunc("/healthz", h.Healthz)
|
||||
mux.HandleFunc("/autocompleter", h.Autocompleter)
|
||||
mux.HandleFunc("/opensearch.xml", h.OpenSearch(cfg.Server.BaseURL))
|
||||
|
||||
// SPA handler - serves React app for all other routes
|
||||
spaHandler := spa.NewHandler()
|
||||
mux.Handle("/", spaHandler)
|
||||
// Serve embedded static files (CSS, JS, images).
|
||||
staticFS, err := views.StaticFS()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to load static files: %v", err)
|
||||
}
|
||||
var subFS fs.FS = staticFS
|
||||
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(subFS))))
|
||||
|
||||
// Apply middleware: global rate limit → burst rate limit → per-IP rate limit → CORS → security headers → handler.
|
||||
var handler http.Handler = mux
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue