2024-03-12 15:49:08 +01:00
|
|
|
package home
|
|
|
|
|
2024-03-18 16:12:25 +01:00
|
|
|
import (
|
2024-04-04 09:25:59 +02:00
|
|
|
"fmt"
|
2024-09-16 11:45:24 +02:00
|
|
|
"gitlab.unjx.de/flohoss/godash/components"
|
2024-03-18 16:12:25 +01:00
|
|
|
"gitlab.unjx.de/flohoss/godash/services"
|
|
|
|
"gitlab.unjx.de/flohoss/godash/views/layout"
|
|
|
|
)
|
2024-03-15 18:56:32 +01:00
|
|
|
|
2024-09-25 15:33:28 +02:00
|
|
|
templ Home(title string, user *services.User, bookmarks *services.Bookmarks, static *services.StaticInformation, live *services.LiveInformation, weather *services.OpenWeather) {
|
2024-03-15 18:56:32 +01:00
|
|
|
<section class="grid gap-10">
|
2024-03-25 20:31:51 +01:00
|
|
|
<div class="flex w-full justify-between items-center">
|
|
|
|
@components.Weather(weather)
|
2024-09-16 11:45:24 +02:00
|
|
|
@components.User(user)
|
2024-03-25 20:31:51 +01:00
|
|
|
</div>
|
2024-03-12 15:49:08 +01:00
|
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 select-none">
|
2024-09-16 11:45:24 +02:00
|
|
|
@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)
|
2024-03-12 15:49:08 +01:00
|
|
|
</div>
|
|
|
|
<div class="grid gap-4">
|
2024-03-12 16:16:49 +01:00
|
|
|
for _, a := range bookmarks.Applications {
|
2024-03-12 15:49:08 +01:00
|
|
|
<div class="grid gap-2">
|
2024-03-12 16:16:49 +01:00
|
|
|
if a.Category != "" {
|
|
|
|
<div class="heading">{ a.Category }</div>
|
2024-03-12 15:49:08 +01:00
|
|
|
}
|
|
|
|
<div class="grid-apps">
|
2024-03-12 16:16:49 +01:00
|
|
|
for _, entry := range a.Entries {
|
2024-03-18 16:12:25 +01:00
|
|
|
@components.Application(entry)
|
2024-03-12 15:49:08 +01:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
2024-03-18 18:21:13 +01:00
|
|
|
<div class="grid-apps">
|
2024-03-12 16:16:49 +01:00
|
|
|
for _, l := range bookmarks.Links {
|
2024-03-12 15:49:08 +01:00
|
|
|
<div class="flex flex-col gap-2">
|
2024-03-12 16:16:49 +01:00
|
|
|
if l.Category != "" {
|
|
|
|
<div class="heading">{ l.Category }</div>
|
2024-03-18 16:12:25 +01:00
|
|
|
} else {
|
|
|
|
<div class="my-[0.9rem]"></div>
|
2024-03-12 15:49:08 +01:00
|
|
|
}
|
2024-03-12 16:16:49 +01:00
|
|
|
for _, entry := range l.Entries {
|
2024-03-18 16:12:25 +01:00
|
|
|
@components.Link(entry)
|
2024-03-12 15:49:08 +01:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ HomeIndex(
|
|
|
|
title,
|
|
|
|
version string,
|
|
|
|
cmp templ.Component,
|
|
|
|
) {
|
|
|
|
@layout.Base(title, version) {
|
|
|
|
@cmp
|
|
|
|
}
|
|
|
|
}
|