Add data models

This commit is contained in:
2025-10-15 11:14:56 +02:00
parent 2433b865da
commit 8f034d6309
11 changed files with 393 additions and 116 deletions

View File

@@ -111,6 +111,30 @@ func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) {
data := AdminMenuBar()
data.Title = "Admin Panel"
s.renderTemplate(w, http.StatusOK, "admin.html", data)
case "/players":
data := DefaultMenuBar()
data.Title = "Players"
s.renderTemplate(w, http.StatusOK, "players.html", data)
case "/games":
data := DefaultMenuBar()
data.Title = "Games"
s.renderTemplate(w, http.StatusOK, "games.html", data)
case "/bosses":
data := DefaultMenuBar()
data.Title = "Bosses"
s.renderTemplate(w, http.StatusOK, "bosses.html", data)
case "/sessions":
data := DefaultMenuBar()
data.Title = "Sessions"
s.renderTemplate(w, http.StatusOK, "sessions.html", data)
case "/statistics":
data := DefaultMenuBar()
data.Title = "Statistics"
s.renderTemplate(w, http.StatusOK, "statistics.html", data)
case "/drinks":
data := DefaultMenuBar()
data.Title = "Drinks"
s.renderTemplate(w, http.StatusOK, "drinks.html", data)
case "/counter":
s.handleCounter(w, r)
case "/time":

View File

@@ -40,22 +40,22 @@ func DefaultMenuBar() PageData {
ShowClock: true,
MenuGroups: []MenuGroup{
{
Label: "File",
Label: "Game",
Items: []MenuItem{
{Label: "New", URL: "#!"},
{Label: "Open", URL: "#!"},
{Label: "Save", URL: "#!"},
{Label: "Save As", URL: "#!"},
{Label: "Home", URL: "/"},
{Label: "Sessions", URL: "/sessions"},
{Label: "Statistics", URL: "/statistics"},
{IsDivider: true},
{Label: "Exit", URL: "#!"},
},
},
{
Label: "Edit",
Label: "Manage",
Items: []MenuItem{
{Label: "Cut", URL: "#!"},
{Label: "Copy", URL: "#!"},
{Label: "Paste", URL: "#!"},
{Label: "Players", URL: "/players"},
{Label: "Games", URL: "/games"},
{Label: "Bosses", URL: "/bosses"},
{Label: "Drinks", URL: "/drinks"},
},
},
{