feat: redesign website templates with full pages
- Redesigned base.html: dark Minecraft theme, sticky header, responsive grid, cards, server cards with status indicators, profile styles - index.html: hero section, server list grid, how-to-start steps, features section - login.html: centered card layout, client-side validation, fetch API - registration.html: password confirmation, pattern validation, error alerts - profile.html: new page — skin/cape upload & delete, launcher download links, auth-gated via localStorage token - templates.go: added /profile route, extended pageData with Username/UUID
This commit is contained in:
@@ -14,7 +14,9 @@ import (
|
||||
|
||||
// pageData is passed to all templates.
|
||||
type pageData struct {
|
||||
Title string
|
||||
Title string
|
||||
Username string
|
||||
UUID string
|
||||
}
|
||||
|
||||
// Handler serves template-rendered pages.
|
||||
@@ -37,6 +39,7 @@ func (h *Handler) RegisterRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("GET /", h.index)
|
||||
mux.HandleFunc("GET /login", h.loginPage)
|
||||
mux.HandleFunc("GET /register", h.registerPage)
|
||||
mux.HandleFunc("GET /profile", h.profilePage)
|
||||
}
|
||||
|
||||
// ── Page handlers ──────────────────────────────────────────────
|
||||
@@ -69,6 +72,14 @@ func (h *Handler) registerPage(w http.ResponseWriter, r *http.Request) {
|
||||
h.render(w, "register.html", pageData{Title: "Регистрация"})
|
||||
}
|
||||
|
||||
func (h *Handler) profilePage(w http.ResponseWriter, r *http.Request) {
|
||||
if !h.loaded {
|
||||
fallback(w, "Profile")
|
||||
return
|
||||
}
|
||||
h.render(w, "profile.html", pageData{Title: "Профиль"})
|
||||
}
|
||||
|
||||
// render executes the named template with data, writing to w.
|
||||
func (h *Handler) render(w http.ResponseWriter, name string, data pageData) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
|
||||
Reference in New Issue
Block a user