Update all the shit
This commit is contained in:
parent
ddbfc32fb1
commit
18265f59df
2
main.go
2
main.go
|
@ -72,6 +72,8 @@ func main() {
|
|||
r.Get("/captures/{captureID}/stop", routes.Make(server.HandleCaptureStop))
|
||||
r.Post("/new/capture", routes.Make(server.HandleCaptureCreate))
|
||||
r.Get("/new/capture", routes.Make(server.HandleCaptureForm))
|
||||
|
||||
r.Post("/captures/{captureID}/mapscore/{mapscoreID}/counted/{counted}", routes.Make(server.HandleUpdateMapScoreCounted))
|
||||
})
|
||||
router.Post("/signin", routes.Make(server.HandleSignin))
|
||||
router.Get("/", routes.Make(server.HandleHome))
|
||||
|
|
|
@ -25,6 +25,7 @@ type MapScore struct {
|
|||
CaptureID int64 `bun:"capture_id"`
|
||||
StartTime time.Time `bun:",notnull"`
|
||||
Map string `bun:",notnull"`
|
||||
Counted bool `bun:",notnull"`
|
||||
ScoreList []Score `bun:"rel:has-many,join:id=mapscore_id"`
|
||||
}
|
||||
|
||||
|
@ -60,8 +61,15 @@ func (msl MapScoreList) BuildTable() *ResultTable {
|
|||
|
||||
rt.Header = append(rt.Header, make([]ResultTableHeader, len(msl))...)
|
||||
|
||||
for mapIndex, mapScore := range msl {
|
||||
reversedIndex := len(msl) - 1 - mapIndex
|
||||
filteredMapScores := []MapScore{}
|
||||
for _, ms := range msl {
|
||||
if ms.Counted {
|
||||
filteredMapScores = append(filteredMapScores, ms)
|
||||
}
|
||||
}
|
||||
|
||||
for mapIndex, mapScore := range filteredMapScores {
|
||||
reversedIndex := len(filteredMapScores) - 1 - mapIndex
|
||||
|
||||
rt.Header[reversedIndex+2] = ResultTableHeader{
|
||||
Title: mapScore.Map,
|
||||
|
@ -73,7 +81,7 @@ func (msl MapScoreList) BuildTable() *ResultTable {
|
|||
rt.Rows = append(rt.Rows, ResultTableRow{
|
||||
Name: score.Name,
|
||||
Total: 0,
|
||||
Individual: make([]int, len(msl)),
|
||||
Individual: make([]int, len(filteredMapScores)),
|
||||
})
|
||||
|
||||
userMapRows[score.Name] = len(rt.Rows) - 1
|
||||
|
|
|
@ -18,6 +18,7 @@ type Persistence interface {
|
|||
DeleteCapture(context.Context, int64) error
|
||||
|
||||
GetRecentMapScore(context.Context, int64) (*MapScore, error)
|
||||
SetMapScoreConted(context.Context, int64, bool) error
|
||||
CreateMapScore(context.Context, *MapScore) error
|
||||
|
||||
CreateOrUpdateScores(context.Context, []Score) error
|
||||
|
@ -105,6 +106,14 @@ func (s *SQLitePersistence) GetRecentMapScore(ctx context.Context, captureid int
|
|||
return &scores[0], nil
|
||||
}
|
||||
|
||||
func (s *SQLitePersistence) SetMapScoreConted(ctx context.Context, mapscoreid int64, counted bool) error {
|
||||
mapscore := MapScore{
|
||||
ID: mapscoreid,
|
||||
}
|
||||
_, err := s.db.NewUpdate().Model(&mapscore).WherePK().Set("counted = ?", counted).Exec(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SQLitePersistence) CreateMapScore(ctx context.Context, mapscore *MapScore) error {
|
||||
_, err := s.db.NewInsert().Model(mapscore).Exec(ctx)
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
"gitea.henriburau.de/haw-lan/cod4watcher/views/capture"
|
||||
"gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
"github.com/go-chi/chi"
|
||||
)
|
||||
|
||||
|
@ -38,7 +37,7 @@ func (s *Server) HandleCaptureTable(w http.ResponseWriter, r *http.Request) erro
|
|||
return err
|
||||
}
|
||||
|
||||
return Render(w, r, components.CaptureTable(*foundCapture.MapScores.BuildTable()))
|
||||
return Render(w, r, capture.TableWithLeaderboard(*foundCapture.MapScores.BuildTable()))
|
||||
}
|
||||
|
||||
func (s *Server) HandleCaptureStart(w http.ResponseWriter, r *http.Request) error {
|
||||
|
@ -87,7 +86,7 @@ func (s *Server) HandleCaptureDelete(w http.ResponseWriter, r *http.Request) err
|
|||
}
|
||||
|
||||
func (s *Server) HandleCaptureForm(w http.ResponseWriter, r *http.Request) error {
|
||||
return Render(w, r, capture.CaptureForm(capture.CaptureFormValues{}, map[string]string{}))
|
||||
return Render(w, r, capture.CaptureForm(capture.CaptureFormValues{Port: "28960"}, map[string]string{}))
|
||||
}
|
||||
|
||||
func (s *Server) HandleCaptureCreate(w http.ResponseWriter, r *http.Request) error {
|
||||
|
@ -145,3 +144,35 @@ func parseCaptureFormAndValidate(r *http.Request) (capture.CaptureFormValues, ma
|
|||
|
||||
return formValues, errors
|
||||
}
|
||||
|
||||
func (s *Server) HandleUpdateMapScoreCounted(w http.ResponseWriter, r *http.Request) error {
|
||||
captureString := chi.URLParam(r, "captureID")
|
||||
captureID, err := strconv.ParseInt(captureString, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mapscoreIDString := chi.URLParam(r, "mapscoreID")
|
||||
mapscoreID, err := strconv.ParseInt(mapscoreIDString, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
countedString := chi.URLParam(r, "counted")
|
||||
counted, err := strconv.ParseBool(countedString)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = s.cs.SetMapScoreConted(r.Context(), mapscoreID, counted)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
updatedCapture, err := s.cs.GetCaptureById(r.Context(), captureID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return Render(w, r, capture.MapSelectTable(updatedCapture))
|
||||
}
|
||||
|
|
|
@ -9,9 +9,8 @@ import (
|
|||
func (s *Server) HandleServerStatus(w http.ResponseWriter, r *http.Request) error {
|
||||
status, err := s.c4s.GetServerStatus(r.URL.Query().Get("host"), r.URL.Query().Get("port"))
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return err
|
||||
return Render(w, r, cod4server.ServerStatusError(err))
|
||||
} else {
|
||||
return Render(w, r, cod4server.ServerStatus(status))
|
||||
}
|
||||
|
||||
return Render(w, r, cod4server.ServerStatus(status))
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ func (cs *CaptureService) DeleteCapture(ctx context.Context, id int64) error {
|
|||
return cs.p.DeleteCapture(ctx, id)
|
||||
}
|
||||
|
||||
func (cs *CaptureService) SetMapScoreConted(ctx context.Context, id int64, counted bool) error {
|
||||
return cs.p.SetMapScoreConted(ctx, id, counted)
|
||||
}
|
||||
|
||||
func (cs *CaptureService) GetActiveCapures(ctx context.Context) ([]models.Capture, error) {
|
||||
captures, err := cs.p.GetCaptures(ctx)
|
||||
if err != nil {
|
||||
|
|
|
@ -70,6 +70,7 @@ func (s *Scanner) fetchInformation(ctx context.Context, capture models.Capture)
|
|||
CaptureID: capture.ID,
|
||||
StartTime: status.MapStartTime,
|
||||
Map: status.MapName,
|
||||
Counted: true,
|
||||
}
|
||||
|
||||
err := s.p.CreateMapScore(ctx, &newMap)
|
||||
|
@ -89,5 +90,9 @@ func (s *Scanner) fetchInformation(ctx context.Context, capture models.Capture)
|
|||
scores = append(scores, score)
|
||||
}
|
||||
|
||||
if len(scores) <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return s.p.CreateOrUpdateScores(ctx, scores)
|
||||
}
|
||||
|
|
|
@ -6,22 +6,23 @@ import (
|
|||
)
|
||||
|
||||
type LoginFormValues struct {
|
||||
Username string
|
||||
Password string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
templ LoginForm(formValues LoginFormValues, errors map[string]string) {
|
||||
@layouts.Base() {
|
||||
@components.Form(components.FormProps{
|
||||
Title: "Log into your account",
|
||||
Action: "/signin",
|
||||
Method: "post",
|
||||
Title: "Log into your account",
|
||||
Action: "/signin",
|
||||
Method: "post",
|
||||
SubmitText: "Login",
|
||||
}) {
|
||||
<div>
|
||||
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Username</label>
|
||||
@components.Input(components.InputProps{
|
||||
Name: "username",
|
||||
Type: "text",
|
||||
Value: formValues.Username,
|
||||
Error: errors["username"],
|
||||
Placeholder: "Your username",
|
||||
|
@ -31,6 +32,7 @@ templ LoginForm(formValues LoginFormValues, errors map[string]string) {
|
|||
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password</label>
|
||||
@components.Input(components.InputProps{
|
||||
Name: "password",
|
||||
Type: "password",
|
||||
Value: formValues.Password,
|
||||
Error: errors["password"],
|
||||
Placeholder: "Your password",
|
||||
|
|
|
@ -45,12 +45,13 @@ func LoginForm(formValues LoginFormValues, errors map[string]string) templ.Compo
|
|||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><label for=\"username\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Username</label>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.Input(components.InputProps{
|
||||
Name: "username",
|
||||
Type: "text",
|
||||
Value: formValues.Username,
|
||||
Error: errors["username"],
|
||||
Placeholder: "Your username",
|
||||
|
@ -58,12 +59,13 @@ func LoginForm(formValues LoginFormValues, errors map[string]string) templ.Compo
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div><label for=\"password\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Password</label>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.Input(components.InputProps{
|
||||
Name: "password",
|
||||
Type: "password",
|
||||
Value: formValues.Password,
|
||||
Error: errors["password"],
|
||||
Placeholder: "Your password",
|
||||
|
@ -71,7 +73,7 @@ func LoginForm(formValues LoginFormValues, errors map[string]string) templ.Compo
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div><label for=\"username\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Username</label>
|
||||
</div><div><label for=\"password\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Password</label>
|
||||
</div>
|
|
@ -2,6 +2,7 @@ package capture
|
|||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/layouts"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "fmt"
|
||||
import "net/url"
|
||||
|
@ -23,21 +24,14 @@ templ Capture(capture *models.Capture, table models.ResultTable) {
|
|||
Loading Server status...
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex w-full justify-around items-center gap-5">
|
||||
if len(table.Rows) >= 1 {
|
||||
@Medal("1. Platz", table.Rows[0].Name, "text-yellow-400")
|
||||
}
|
||||
if len(table.Rows) >= 2 {
|
||||
@Medal("2. Platz", table.Rows[1].Name, "text-gray-500")
|
||||
}
|
||||
if len(table.Rows) >= 3 {
|
||||
@Medal("3. Platz", table.Rows[2].Name, "text-amber-700")
|
||||
}
|
||||
</div>
|
||||
@Pedestal(table)
|
||||
</div>
|
||||
<div hx-get={ fmt.Sprintf("/captures/%d/table", capture.ID) } hx-trigger="every 10s">
|
||||
@components.CaptureTable(table)
|
||||
@CaptureTable(table)
|
||||
</div>
|
||||
if views.Username(ctx) != "" {
|
||||
@MapSelectTable(capture)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -50,3 +44,46 @@ templ Medal(placement, name, color string) {
|
|||
</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ Pedestal(table models.ResultTable) {
|
||||
<div id="pedestal" hx-swap-oob="true" class="flex w-full justify-around items-center gap-5">
|
||||
if len(table.Rows) >= 1 {
|
||||
@Medal("1. Platz", table.Rows[0].Name, "text-yellow-400")
|
||||
}
|
||||
if len(table.Rows) >= 2 {
|
||||
@Medal("2. Platz", table.Rows[1].Name, "text-gray-500")
|
||||
}
|
||||
if len(table.Rows) >= 3 {
|
||||
@Medal("3. Platz", table.Rows[2].Name, "text-amber-700")
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
templ MapSelectTable(capture *models.Capture) {
|
||||
<div id="select-table" class="relative overflow-x-auto">
|
||||
<table class="w-full overflow-scroll text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Map
|
||||
</th>
|
||||
for _, maps := range capture.MapScores {
|
||||
<th scope="col" class="px-6 py-3">
|
||||
{ maps.Map }
|
||||
</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="overflow-y-scroll">
|
||||
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">Enabled</th>
|
||||
for _, maps := range capture.MapScores {
|
||||
<td class="px-6 py-4">
|
||||
<input type="checkbox" hx-target="#select-table" hx-swap="outerHTML" hx-post={ fmt.Sprintf("/captures/%d/mapscore/%d/counted/%t", capture.ID, maps.ID, !maps.Counted) } checked?={ maps.Counted }/>
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package components
|
||||
package capture
|
||||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "fmt"
|
||||
import "net/url"
|
||||
|
||||
|
@ -19,11 +20,11 @@ templ CaptureCard(capture models.Capture) {
|
|||
</div>
|
||||
if views.Username(ctx) != "" {
|
||||
<div class="mt-4">
|
||||
@IconButtonRed("fa-solid fa-trash", fmt.Sprintf("/captures/%d", capture.ID))
|
||||
@components.IconButtonRed("fa-solid fa-trash", fmt.Sprintf("/captures/%d", capture.ID))
|
||||
if capture.Active {
|
||||
@IconButton("fa-solid fa-stop", fmt.Sprintf("/captures/%d/stop", capture.ID))
|
||||
@components.IconButton("fa-solid fa-stop", fmt.Sprintf("/captures/%d/stop", capture.ID))
|
||||
} else {
|
||||
@IconButton("fa-solid fa-play", fmt.Sprintf("/captures/%d/start", capture.ID))
|
||||
@components.IconButton("fa-solid fa-play", fmt.Sprintf("/captures/%d/start", capture.ID))
|
||||
}
|
||||
</div>
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.707
|
||||
package components
|
||||
package capture
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
|
@ -12,6 +12,7 @@ import "bytes"
|
|||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "fmt"
|
||||
import "net/url"
|
||||
|
||||
|
@ -28,7 +29,7 @@ func CaptureCard(capture models.Capture) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700\"><a href=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -37,88 +38,88 @@ func CaptureCard(capture models.Capture) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><h5 class=\"mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(capture.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_card.templ`, Line: 11, Col: 98}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_card.templ`, Line: 12, Col: 98}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h5></a><p class=\"font-normal text-gray-700 dark:text-gray-400\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(capture.Host)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_card.templ`, Line: 13, Col: 72}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_card.templ`, Line: 14, Col: 72}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(":")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(capture.Port)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_card.templ`, Line: 13, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_card.templ`, Line: 14, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div hx-get=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("/server/status?host=%s&port=%s", url.QueryEscape(capture.Host), url.QueryEscape(capture.Port)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_card.templ`, Line: 15, Col: 119}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_card.templ`, Line: 16, Col: 119}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"load, every 20s\">Loading Server status...</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if views.Username(ctx) != "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mt-4\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = IconButtonRed("fa-solid fa-trash", fmt.Sprintf("/captures/%d", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = components.IconButtonRed("fa-solid fa-trash", fmt.Sprintf("/captures/%d", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if capture.Active {
|
||||
templ_7745c5c3_Err = IconButton("fa-solid fa-stop", fmt.Sprintf("/captures/%d/stop", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = components.IconButton("fa-solid fa-stop", fmt.Sprintf("/captures/%d/stop", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = IconButton("fa-solid fa-play", fmt.Sprintf("/captures/%d/start", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = components.IconButton("fa-solid fa-play", fmt.Sprintf("/captures/%d/start", capture.ID)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<div class=\"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700\"><a href=\"
|
||||
\"><h5 class=\"mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white\">
|
||||
</h5></a><p class=\"font-normal text-gray-700 dark:text-gray-400\">
|
||||
:
|
||||
</p><div hx-get=\"
|
||||
\" hx-trigger=\"load, every 20s\">Loading Server status...</div>
|
||||
<div class=\"mt-4\">
|
||||
</div>
|
||||
</div>
|
|
@ -6,25 +6,26 @@ import (
|
|||
)
|
||||
|
||||
type CaptureFormValues struct {
|
||||
Host string
|
||||
Port string
|
||||
Name string
|
||||
Active bool
|
||||
Host string
|
||||
Port string
|
||||
Name string
|
||||
Active bool
|
||||
ValidateServer bool
|
||||
}
|
||||
|
||||
templ CaptureForm(formValues CaptureFormValues, errors map[string]string) {
|
||||
@layouts.Base() {
|
||||
@components.Form(components.FormProps{
|
||||
Title: "Create new capture",
|
||||
Action: "/new/capture",
|
||||
Method: "post",
|
||||
Title: "Create new capture",
|
||||
Action: "/new/capture",
|
||||
Method: "post",
|
||||
SubmitText: "Create capture",
|
||||
}) {
|
||||
<div>
|
||||
<label for="name" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Name</label>
|
||||
@components.Input(components.InputProps{
|
||||
Name: "name",
|
||||
Type: "text",
|
||||
Value: formValues.Name,
|
||||
Error: errors["name"],
|
||||
Placeholder: "Name for the capture",
|
||||
|
@ -34,6 +35,7 @@ templ CaptureForm(formValues CaptureFormValues, errors map[string]string) {
|
|||
<label for="host" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Host</label>
|
||||
@components.Input(components.InputProps{
|
||||
Name: "host",
|
||||
Type: "text",
|
||||
Value: formValues.Host,
|
||||
Error: errors["host"],
|
||||
Placeholder: "Host-Address of the capture",
|
||||
|
@ -43,6 +45,7 @@ templ CaptureForm(formValues CaptureFormValues, errors map[string]string) {
|
|||
<label for="port" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Port</label>
|
||||
@components.Input(components.InputProps{
|
||||
Name: "port",
|
||||
Type: "text",
|
||||
Value: formValues.Port,
|
||||
Error: errors["port"],
|
||||
Placeholder: "Port for the capture",
|
||||
|
|
|
@ -48,12 +48,13 @@ func CaptureForm(formValues CaptureFormValues, errors map[string]string) templ.C
|
|||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><label for=\"name\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Name</label>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.Input(components.InputProps{
|
||||
Name: "name",
|
||||
Type: "text",
|
||||
Value: formValues.Name,
|
||||
Error: errors["name"],
|
||||
Placeholder: "Name for the capture",
|
||||
|
@ -61,12 +62,13 @@ func CaptureForm(formValues CaptureFormValues, errors map[string]string) templ.C
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div><label for=\"host\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Host</label>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.Input(components.InputProps{
|
||||
Name: "host",
|
||||
Type: "text",
|
||||
Value: formValues.Host,
|
||||
Error: errors["host"],
|
||||
Placeholder: "Host-Address of the capture",
|
||||
|
@ -74,12 +76,13 @@ func CaptureForm(formValues CaptureFormValues, errors map[string]string) templ.C
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div><label for=\"port\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Port</label>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.Input(components.InputProps{
|
||||
Name: "port",
|
||||
Type: "text",
|
||||
Value: formValues.Port,
|
||||
Error: errors["port"],
|
||||
Placeholder: "Port for the capture",
|
||||
|
@ -87,7 +90,7 @@ func CaptureForm(formValues CaptureFormValues, errors map[string]string) templ.C
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<div><label for=\"name\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Name</label>
|
||||
</div><div><label for=\"host\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Host</label>
|
||||
</div><div><label for=\"port\" class=\"block mb-2 text-sm font-medium text-gray-900 dark:text-white\">Port</label>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
package components
|
||||
package capture
|
||||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "strconv"
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.707
|
||||
package components
|
||||
package capture
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
|
@ -26,102 +26,102 @@ func CaptureTable(table models.ResultTable) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"relative overflow-x-auto\" style=\"height: 50vh;\"><table class=\"w-full overflow-scroll text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400\"><thead class=\"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400\"><tr>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, header := range table.Header {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" class=\"px-6 py-3\"><div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(header.Title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_table.templ`, Line: 14, Col: 22}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_table.templ`, Line: 14, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"lowercase font-light\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(header.Subtitle)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_table.templ`, Line: 17, Col: 25}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_table.templ`, Line: 17, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></th>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tr></thead> <tbody class=\"overflow-y-scroll\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, row := range table.Rows {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr class=\"bg-white border-b dark:bg-gray-800 dark:border-gray-700\"><th scope=\"row\" class=\"px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(row.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_table.templ`, Line: 27, Col: 17}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_table.templ`, Line: 27, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</th><td class=\"px-6 py-4\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(row.Total))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_table.templ`, Line: 30, Col: 32}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_table.templ`, Line: 30, Col: 32}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, score := range row.Individual {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<td class=\"px-6 py-4\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(score))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/capture_table.templ`, Line: 34, Col: 29}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture_table.templ`, Line: 34, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tr>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tbody></table></div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<div class=\"relative overflow-x-auto\" style=\"height: 50vh;\"><table class=\"w-full overflow-scroll text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400\"><thead class=\"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400\"><tr>
|
||||
<th scope=\"col\" class=\"px-6 py-3\"><div>
|
||||
</div><div class=\"lowercase font-light\">
|
||||
</div></th>
|
||||
</tr></thead> <tbody class=\"overflow-y-scroll\">
|
||||
<tr class=\"bg-white border-b dark:bg-gray-800 dark:border-gray-700\"><th scope=\"row\" class=\"px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white\">
|
||||
</th><td class=\"px-6 py-4\">
|
||||
</td>
|
||||
<td class=\"px-6 py-4\">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table></div>
|
|
@ -0,0 +1,8 @@
|
|||
package capture
|
||||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
|
||||
templ TableWithLeaderboard(table models.ResultTable) {
|
||||
@Pedestal(table)
|
||||
@CaptureTable(table)
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.707
|
||||
package capture
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
|
||||
func TableWithLeaderboard(table models.ResultTable) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = Pedestal(table).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = CaptureTable(table).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
|
@ -12,6 +12,7 @@ import "bytes"
|
|||
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/layouts"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "fmt"
|
||||
import "net/url"
|
||||
|
@ -35,20 +36,20 @@ func Capture(capture *models.Capture, table models.ResultTable) templ.Component
|
|||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col\"><div class=\"flex\"><div><div class=\"block font-bold text-lg\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(capture.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 15, Col: 20}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 16, Col: 20}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -56,63 +57,59 @@ func Capture(capture *models.Capture, table models.ResultTable) templ.Component
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"my-3 w-60\" hx-get=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("/server/status?host=%s&port=%s", url.QueryEscape(capture.Host), url.QueryEscape(capture.Port)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 20, Col: 122}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 21, Col: 122}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"load, every 20s\">Loading Server status...</div></div><div class=\"flex w-full justify-around items-center gap-5\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if len(table.Rows) >= 1 {
|
||||
templ_7745c5c3_Err = Medal("1. Platz", table.Rows[0].Name, "text-yellow-400").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = Pedestal(table).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if len(table.Rows) >= 2 {
|
||||
templ_7745c5c3_Err = Medal("2. Platz", table.Rows[1].Name, "text-gray-500").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if len(table.Rows) >= 3 {
|
||||
templ_7745c5c3_Err = Medal("3. Platz", table.Rows[2].Name, "text-amber-700").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div hx-get=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("/captures/%d/table", capture.ID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 38, Col: 62}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 29, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"every 10s\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = components.CaptureTable(table).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = CaptureTable(table).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if views.Username(ctx) != "" {
|
||||
templ_7745c5c3_Err = MapSelectTable(capture).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -145,7 +142,7 @@ func Medal(placement, name, color string) templ.Component {
|
|||
templ_7745c5c3_Var6 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col gap-2\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -154,7 +151,7 @@ func Medal(placement, name, color string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<i class=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -167,33 +164,159 @@ func Medal(placement, name, color string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></i> <span>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(placement)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 49, Col: 14}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 43, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 49, Col: 23}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 43, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Pedestal(table models.ResultTable) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var11 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var11 == nil {
|
||||
templ_7745c5c3_Var11 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if len(table.Rows) >= 1 {
|
||||
templ_7745c5c3_Err = Medal("1. Platz", table.Rows[0].Name, "text-yellow-400").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if len(table.Rows) >= 2 {
|
||||
templ_7745c5c3_Err = Medal("2. Platz", table.Rows[1].Name, "text-gray-500").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if len(table.Rows) >= 3 {
|
||||
templ_7745c5c3_Err = Medal("3. Platz", table.Rows[2].Name, "text-amber-700").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 15)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func MapSelectTable(capture *models.Capture) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var12 == nil {
|
||||
templ_7745c5c3_Var12 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 16)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, maps := range capture.MapScores {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(maps.Map)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 72, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, maps := range capture.MapScores {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("/captures/%d/mapscore/%d/counted/%t", capture.ID, maps.ID, !maps.Counted))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/capture/capture.templ`, Line: 82, Col: 172}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if maps.Counted {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 22)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<div class=\"flex flex-col\"><div class=\"flex\"><div><div class=\"block font-bold text-lg\">
|
||||
</div>
|
||||
<div class=\"my-3 w-60\" hx-get=\"
|
||||
\" hx-trigger=\"load, every 20s\">Loading Server status...</div></div>
|
||||
</div><div hx-get=\"
|
||||
\" hx-trigger=\"every 10s\">
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"flex flex-col gap-2\">
|
||||
<i class=\"
|
||||
\"></i> <span>
|
||||
|
||||
</span></div>
|
||||
<div id=\"pedestal\" hx-swap-oob=\"true\" class=\"flex w-full justify-around items-center gap-5\">
|
||||
</div>
|
||||
<div id=\"select-table\" class=\"relative overflow-x-auto\"><table class=\"w-full overflow-scroll text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400\"><thead class=\"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400\"><tr><th scope=\"col\" class=\"px-6 py-3\">Map</th>
|
||||
<th scope=\"col\" class=\"px-6 py-3\">
|
||||
</th>
|
||||
</tr></thead> <tbody class=\"overflow-y-scroll\"><tr class=\"bg-white border-b dark:bg-gray-800 dark:border-gray-700\"><th scope=\"row\" class=\"px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white\">Enabled</th>
|
||||
<td class=\"px-6 py-4\"><input type=\"checkbox\" hx-target=\"#select-table\" hx-swap=\"outerHTML\" hx-post=\"
|
||||
\"
|
||||
checked
|
||||
></td>
|
||||
</tr></tbody></table></div>
|
|
@ -10,7 +10,13 @@ templ ServerStatus(status *models.CoD4ServerStatus) {
|
|||
<i class="fa-solid fa-user"></i>
|
||||
<span>{ fmt.Sprintf("%d/%d",len(status.Score), status.MaxPlayers) }</span>
|
||||
</div>
|
||||
<div class="p-1 rounded-md bg-slate-800">
|
||||
<div class="py-1 px-3 rounded-md bg-slate-800 text-white">
|
||||
@templ.Raw(status.Name)
|
||||
</div>
|
||||
}
|
||||
|
||||
templ ServerStatusError(err error) {
|
||||
<div>
|
||||
<span class="text-red-600">Failed to reach server</span>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ func ServerStatus(status *models.CoD4ServerStatus) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex items-center gap-1 font-normal text-gray-700 dark:text-gray-400\"><i class=\"fa-solid fa-map\"></i> <span>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func ServerStatus(status *models.CoD4ServerStatus) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span> <i class=\"fa-solid fa-user\"></i> <span>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func ServerStatus(status *models.CoD4ServerStatus) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div><div class=\"p-1 rounded-md bg-slate-800\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -60,7 +60,31 @@ func ServerStatus(status *models.CoD4ServerStatus) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ServerStatusError(err error) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div class=\"flex items-center gap-1 font-normal text-gray-700 dark:text-gray-400\"><i class=\"fa-solid fa-map\"></i> <span>
|
||||
</span> <i class=\"fa-solid fa-user\"></i> <span>
|
||||
</span></div><div class=\"py-1 px-3 rounded-md bg-slate-800 text-white\">
|
||||
</div>
|
||||
<div><span class=\"text-red-600\">Failed to reach server</span></div>
|
|
@ -23,7 +23,7 @@ func Button() templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func Button() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func SubmitButton() templ.Component {
|
|||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"submit\" class=\"w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ func SubmitButton() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func IconButton(icon, url string) templ.Component {
|
|||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ func IconButton(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ func IconButton(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<i class=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ func IconButton(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></i></a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ func IconButtonRed(icon, url string) templ.Component {
|
|||
templ_7745c5c3_Var7 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-delete=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ func IconButtonRed(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ func IconButtonRed(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<i class=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ func IconButtonRed(icon, url string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></i></a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<button class=\"w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">
|
||||
</button>
|
||||
<button type=\"submit\" class=\"w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">
|
||||
</button>
|
||||
<a href=\"
|
||||
\" class=\"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800\">
|
||||
<i class=\"
|
||||
\"></i></a>
|
||||
<a hx-delete=\"
|
||||
\" class=\"text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800\">
|
||||
<i class=\"
|
||||
\"></i></a>
|
|
@ -30,7 +30,7 @@ func Form(props FormProps) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"w-full mx-auto max-w-96 p-4 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700\"><form class=\"space-y-6\" action=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func Form(props FormProps) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" method=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func Form(props FormProps) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><h5 class=\"text-xl font-medium text-gray-900 dark:text-white\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ func Form(props FormProps) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h5>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ func Form(props FormProps) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form></div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div class=\"w-full mx-auto max-w-96 p-4 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700\"><form class=\"space-y-6\" action=\"
|
||||
\" method=\"
|
||||
\"><h5 class=\"text-xl font-medium text-gray-900 dark:text-white\">
|
||||
</h5>
|
||||
</form></div>
|
|
@ -2,13 +2,14 @@ package components
|
|||
|
||||
type InputProps struct {
|
||||
Name string
|
||||
Type string
|
||||
Value string
|
||||
Error string
|
||||
Placeholder string
|
||||
}
|
||||
|
||||
templ Input(props InputProps) {
|
||||
<input type="text" name={ props.Name } id={ props.Name } value={ props.Value } class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" placeholder={ props.Placeholder } required/>
|
||||
<input type={ props.Type } name={ props.Name } id={ props.Name } value={ props.Value } class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" placeholder={ props.Placeholder } required/>
|
||||
if props.Error != "" {
|
||||
<span class="text-red-500">{ props.Error }</span>
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import "bytes"
|
|||
|
||||
type InputProps struct {
|
||||
Name string
|
||||
Type string
|
||||
Value string
|
||||
Error string
|
||||
Placeholder string
|
||||
|
@ -30,77 +31,90 @@ func Input(props InputProps) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"text\" name=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Name)
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Type)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 11, Col: 37}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 12, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 11, Col: 55}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 12, Col: 45}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" value=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Value)
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 11, Col: 77}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 12, Col: 63}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white\" placeholder=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placeholder)
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.Value)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 11, Col: 327}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 12, Col: 85}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" required> ")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placeholder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 12, Col: 335}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if props.Error != "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span class=\"text-red-500\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(props.Error)
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(props.Error)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 13, Col: 42}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/components/input.templ`, Line: 14, Col: 42}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<input type=\"
|
||||
\" name=\"
|
||||
\" id=\"
|
||||
\" value=\"
|
||||
\" class=\"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white\" placeholder=\"
|
||||
\" required>
|
||||
<span class=\"text-red-500\">
|
||||
</span>
|
|
@ -27,27 +27,27 @@ func Nagivation() templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<nav class=\"bg-gray-800\"><div class=\"mx-auto max-w-7xl\"><div class=\"relative flex h-16 items-center justify-between\"><div class=\"flex flex-1 items-center justify-center sm:items-stretch sm:justify-start\"><div class=\"flex flex-shrink-0 items-center\"><span class=\"text-white pr-2 font-bold\">Turnier-Tracker</span> <img class=\"h-8 w-auto\" src=\"/assets/logo.svg\" alt=\"Your Company\"></div><div class=\"hidden sm:ml-6 sm:block\"><div class=\"flex space-x-4\"><!-- Current: \"bg-gray-900 text-white\", Default: \"text-gray-300 hover:bg-gray-700 hover:text-white\" -->")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if ctx.Value(views.PathContext) == "" || ctx.Value(views.PathContext) == "/" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"/\" class=\"bg-gray-900 text-white rounded-md px-3 py-2 text-sm font-medium\" aria-current=\"page\">Dashboard</a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"/\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Dashboard</a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- \n\t\t\t\t\t\t\t\t<a href=\"/about\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">About</a>\n\t\t\t\t\t\t\t--></div></div></div><div class=\"absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if views.Username(ctx) != "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"bg-gray-300 rounded-full mx-3 w-6 h-6 flex items-center justify-center\"><span class=\"block text-gray-800 font-bold\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -60,17 +60,17 @@ func Nagivation() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div><a href=\"/logout\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Logout</a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"/login\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Login</a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></nav>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<nav class=\"bg-gray-800\"><div class=\"mx-auto max-w-7xl\"><div class=\"relative flex h-16 items-center justify-between\"><div class=\"flex flex-1 items-center justify-center sm:items-stretch sm:justify-start\"><div class=\"flex flex-shrink-0 items-center\"><span class=\"text-white pr-2 font-bold\">Turnier-Tracker</span> <img class=\"h-8 w-auto\" src=\"/assets/logo.svg\" alt=\"Your Company\"></div><div class=\"hidden sm:ml-6 sm:block\"><div class=\"flex space-x-4\"><!-- Current: \"bg-gray-900 text-white\", Default: \"text-gray-300 hover:bg-gray-700 hover:text-white\" -->
|
||||
<a href=\"/\" class=\"bg-gray-900 text-white rounded-md px-3 py-2 text-sm font-medium\" aria-current=\"page\">Dashboard</a>
|
||||
<a href=\"/\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Dashboard</a>
|
||||
<!-- \n\t\t\t\t\t\t\t\t<a href=\"/about\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">About</a>\n\t\t\t\t\t\t\t--></div></div></div><div class=\"absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0\">
|
||||
<div class=\"bg-gray-300 rounded-full mx-3 w-6 h-6 flex items-center justify-center\"><span class=\"block text-gray-800 font-bold\">
|
||||
</span></div><a href=\"/logout\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Logout</a>
|
||||
<a href=\"/login\" class=\"text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium\">Login</a>
|
||||
</div></div></div></nav>
|
|
@ -25,7 +25,7 @@ func ServerAddress(host, port string) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"my-2 flex gap-4 items-center\"><span class=\"block\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func ServerAddress(host, port string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(":")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func ServerAddress(host, port string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span> <button><i class=\"fa-regular fa-clipboard\"></i></button> <a class=\"block\" href=\"")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ func ServerAddress(host, port string) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><i class=\"block fa-solid fa-play\"></i></a></div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<div class=\"my-2 flex gap-4 items-center\"><span class=\"block\">
|
||||
:
|
||||
</span> <button><i class=\"fa-regular fa-clipboard\"></i></button> <a class=\"block\" href=\"
|
||||
\"><i class=\"block fa-solid fa-play\"></i></a></div>
|
|
@ -3,6 +3,7 @@ package home
|
|||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/layouts"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/capture"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
|
||||
templ Index(captures []models.Capture) {
|
||||
|
@ -14,10 +15,9 @@ templ Index(captures []models.Capture) {
|
|||
}
|
||||
</a>
|
||||
}
|
||||
|
||||
<div class="flex gap-3 flex-wrap">
|
||||
for _, capture := range captures {
|
||||
@components.CaptureCard(capture)
|
||||
for _, currentCapture := range captures {
|
||||
@capture.CaptureCard(currentCapture)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import "bytes"
|
|||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/layouts"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/models"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/components"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views/capture"
|
||||
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
|
||||
func Index(captures []models.Capture) templ.Component {
|
||||
|
@ -35,7 +36,7 @@ func Index(captures []models.Capture) templ.Component {
|
|||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
if views.Username(ctx) != "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"/new/capture\" class=\"mb-8 block\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ func Index(captures []models.Capture) templ.Component {
|
|||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Create new Capture")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -58,22 +59,22 @@ func Index(captures []models.Capture) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"flex gap-3 flex-wrap\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, capture := range captures {
|
||||
templ_7745c5c3_Err = components.CaptureCard(capture).Render(ctx, templ_7745c5c3_Buffer)
|
||||
for _, currentCapture := range captures {
|
||||
templ_7745c5c3_Err = capture.CaptureCard(currentCapture).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<a href=\"/new/capture\" class=\"mb-8 block\">
|
||||
Create new Capture
|
||||
</a>
|
||||
<div class=\"flex gap-3 flex-wrap\">
|
||||
</div>
|
|
@ -25,7 +25,7 @@ func Base() templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><head><title>CoD 4 Turnier-Tracker</title><link rel=\"icon\" type=\"image/x-icon\" href=\"/assets/favicon.ico\"><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" href=\"/assets/styles.css\"><script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/js/all.min.js\"></script></head><body class=\"antialiased\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func Base() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mx-auto max-w-7xl mt-10\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func Base() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><script src=\"/assets/index.js\"></script></body></html>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html><html lang=\"en\"><head><title>CoD 4 Turnier-Tracker</title><link rel=\"icon\" type=\"image/x-icon\" href=\"/assets/favicon.ico\"><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" href=\"/assets/styles.css\"><script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/js/all.min.js\"></script></head><body class=\"antialiased\">
|
||||
<div class=\"mx-auto max-w-7xl mt-10\">
|
||||
</div><script src=\"/assets/index.js\"></script></body></html>
|
Loading…
Reference in New Issue