68 lines
2 KiB
Text
68 lines
2 KiB
Text
package home
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/logto-io/go/core"
|
|
|
|
"gitlab.unjx.de/flohoss/godash/services"
|
|
"gitlab.unjx.de/flohoss/godash/views/layout"
|
|
"gitlab.unjx.de/flohoss/godash/components"
|
|
)
|
|
|
|
templ Home(title string, claims *core.IdTokenClaims, bookmarks *services.Bookmarks, static *services.StaticInformation, live *services.LiveInformation, weather *services.OpenWeather) {
|
|
<section class="grid gap-10">
|
|
<div class="flex w-full justify-between items-center">
|
|
@components.Weather(weather)
|
|
if claims != nil {
|
|
@components.User(claims)
|
|
}
|
|
</div>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 select-none">
|
|
@components.System("icon-[bi--cpu]",static.CPU.Name,"",static.CPU.Threads,"systemCpuPercentage","",live.CPU)
|
|
@components.System("icon-[bi--nvme]",live.Disk.Value,fmt.Sprintf(" | %s", static.Disk.Total),static.Disk.Partitions,"systemDiskPercentage","systemDiskValue",live.Disk.Percentage)
|
|
@components.System("icon-[bi--memory]",live.Ram.Value,fmt.Sprintf(" | %s", static.Ram.Total),static.Ram.Swap,"systemRamPercentage","systemRamValue",live.Ram.Percentage)
|
|
@components.Uptime(static.Host.Architecture,"systemUptimePercentage",live.Uptime)
|
|
</div>
|
|
<div class="grid gap-4">
|
|
for _, a := range bookmarks.Applications {
|
|
<div class="grid gap-2">
|
|
if a.Category != "" {
|
|
<div class="heading">{ a.Category }</div>
|
|
}
|
|
<div class="grid-apps">
|
|
for _, entry := range a.Entries {
|
|
@components.Application(entry)
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
<div class="grid-apps">
|
|
for _, l := range bookmarks.Links {
|
|
<div class="flex flex-col gap-2">
|
|
if l.Category != "" {
|
|
<div class="heading">{ l.Category }</div>
|
|
} else {
|
|
<div class="my-[0.9rem]"></div>
|
|
}
|
|
for _, entry := range l.Entries {
|
|
@components.Link(entry)
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
@components.WeatherScript()
|
|
@components.SystemScript()
|
|
</section>
|
|
}
|
|
|
|
templ HomeIndex(
|
|
title,
|
|
version string,
|
|
cmp templ.Component,
|
|
) {
|
|
@layout.Base(title, version) {
|
|
@cmp
|
|
}
|
|
}
|