package components import ( "fmt" "gitlab.unjx.de/flohoss/godash/services" "html/template" ) var BarTemplate = template.Must(template.New("bar").Parse("
")) type Bar struct { Id string Percentage float64 } templ System(icon string, infoPre string, infoPost string, extraInfo string, percentageId string, valueId string, percentage float64) {
{ extraInfo }
{ infoPre }{ infoPost }
@templ.FromGoHTML(BarTemplate, Bar{Id: percentageId, Percentage: percentage})
} var countDownTemplate = template.Must(template.New("countdown").Parse("")) type Countdown struct { Id string Value uint16 } templ Uptime(extraInfo string, id string, uptime services.Uptime) {
{ extraInfo }
{ fmt.Sprintf("%d",uptime.Days) } days @templ.FromGoHTML(countDownTemplate, Countdown{Id: "uptimeHours", Value: uptime.Hours}) hours @templ.FromGoHTML(countDownTemplate, Countdown{Id: "uptimeMinutes", Value: uptime.Minutes}) min @templ.FromGoHTML(countDownTemplate, Countdown{Id: "uptimeSeconds", Value: uptime.Seconds}) sec
@templ.FromGoHTML(BarTemplate, Bar{Id: id, Percentage: float64(uptime.Percentage)})
}