package home import "gitlab.unjx.de/flohoss/godash/services" import "gitlab.unjx.de/flohoss/godash/views/layout" import "gitlab.unjx.de/flohoss/godash/components/system" import "gitlab.unjx.de/flohoss/godash/components/uptime" import "gitlab.unjx.de/flohoss/godash/components/application" import "gitlab.unjx.de/flohoss/godash/components/link" import "fmt" func getIcon(icon string) string { switch icon { case "01d": return "icon-[bi--sun-fill]" case "01n": return "icon-[bi--moon-fill]" case "02d": return "icon-[bi--cloud-sun-fill]" case "02n": return "icon-[bi--cloud-moon-fill]" case "03d", "03n": return "icon-[bi--cloud-fill]" case "04d", "04n": return "icon-[bi--clouds-fill]" case "09d", "09n": return "icon-[bi--cloud-rain-heavy-fill]" case "10d", "10n": return "icon-[bi--cloud-drizzle-fill]" case "11d", "11n": return "icon-[bi--cloud-lightning-rain-fill]" case "13d", "13n": return "icon-[bi--cloud-snow-fill]" case "50d", "50n": return "icon-[bi--cloud-fog2-fill]" default: return "" } } templ Home(title string, bookmarks *services.Bookmarks, static *services.StaticInformation, live *services.LiveInformation, weather *services.OpenWeather) {
{ fmt.Sprintf("%0.2f",weather.Temp) } { weather.Units }
{ weather.Description }
{ fmt.Sprintf("%d %%",weather.Humidity) }
@system.System("icon-[bi--cpu]",static.CPU.Name,"",static.CPU.Threads,"systemCpuPercentage","",live.CPU) @system.System("icon-[bi--nvme]",live.Disk.Value,fmt.Sprintf(" | %s", static.Disk.Total),static.Disk.Partitions,"systemDiskPercentage","systemDiskValue",live.Disk.Percentage) @system.System("icon-[bi--memory]",live.Ram.Value,fmt.Sprintf(" | %s", static.Ram.Total),static.Ram.Swap,"systemRamPercentage","systemRamValue",live.Ram.Percentage) @uptime.Uptime(static.Host.Architecture,"systemUptimePercentage",live.Uptime)
for _, a := range bookmarks.Applications {
if a.Category != "" {
{ a.Category }
}
for _, entry := range a.Entries { @application.Application(entry) }
}
for _, l := range bookmarks.Links {
if l.Category != "" {
{ l.Category }
} for _, entry := range l.Entries { @link.Link(entry) }
}
} templ HomeIndex( title, version string, bookmarks *services.Bookmarks, static *services.StaticInformation, live *services.LiveInformation, weather *services.OpenWeather, cmp templ.Component, ) { @layout.Base(title, version) { @cmp } }