package components
import (
"time"
"strconv"
"math/rand/v2"
)
func getCurrentTime() string {
loc, err := time.LoadLocation("Europe/Berlin")
if err != nil {
}
t := time.Now().In(loc)
layout := "02.01.2006 15:04"
return t.Format(layout)
}
func genRandomData(count int) []float64 {
data := make([]float64, count)
for i := 0; i < count; i++ {
data[i] = rand.NormFloat64() * 30 + 50
}
return data
}
templ base(title string) {
Learnlytics - { title }
@navbar()
{ children... }
}
templ footer() {
}
templ navbar() {
}
templ selectList(labels []string) {
}
templ usercard(username string) {
{ username }
}
templ NotFound() {
@base("Error") {
404 - Not Found
This Page Didn't Pass the Exam
It tried, but it didn’t make the cut.
Better check the Dashboard instead!
}
}
templ Test() {
@base("Test") {
Test
@polarChart(
"1",
genRandomData(6),
[]string{"Klasse 8a", "Klasse 5b", "Klasse 6c", "Klasse 10d", "Englisch LK 12", "Geschickte GK 11"},
"Points scored",
"Classes",
"Classes",
"",
)
Test
@doughnutChart(
"1",
genRandomData(6),
[]string{"Klasse 8a", "Klasse 5b", "Klasse 6c", "Klasse 10d", "Englisch LK 12", "Geschickte GK 11"},
"Points scored",
"Classes",
"Classes",
"",
)
}
}
templ Dashboard(username string) {
@base("Dashboard") {
@usercard(username)
@barChart(
"2",
genRandomData(6),
[]string{"Klasse 8a", "Klasse 5b", "Klasse 6c", "Klasse 10d", "Englisch LK 12", "Geschickte GK 11"},
"Points scored",
"Classes",
"Classes",
"",
)
@selectList([]string{"Phil Keier", "Calvin Brandt", "Nova Eib"})
@barLineChart(
"1",
[]float64{31, 15, 18, 35, 20, 20, 22, 27, 24, 30},
[]string{"Tutorial 1", "Tutorial 2", "Extended Applications", "Numpy & MatPlotLib", "SciPy", "MonteCarlo", "Pandas & Seaborn", "Folium", "Statistical Test Methods", "Data Analysis"},
"Points scored",
"Lectures",
"Lectures",
"Points",
)
}
}
templ Login() {
@base("Login") {
Learnlytics
}
}