web: moved endpoint /schedules to /history

This commit is contained in:
Tigor Hutasuhut 2024-05-13 19:06:29 +07:00
parent 515704f018
commit a17fdf9551
3 changed files with 6 additions and 6 deletions

View file

@ -90,6 +90,6 @@ func (routes *Routes) registerWWWRoutes(router chi.Router) {
r.Get("/devices/details/{slug}", routes.PageDeviceDetails) r.Get("/devices/details/{slug}", routes.PageDeviceDetails)
r.Get("/devices/edit/{slug}", routes.PageDevicesEdit) r.Get("/devices/edit/{slug}", routes.PageDevicesEdit)
r.Post("/devices/edit/{slug}", routes.DevicesUpdateHTMX) r.Post("/devices/edit/{slug}", routes.DevicesUpdateHTMX)
r.Get("/schedules", routes.PageScheduleHistory) r.Get("/history", routes.PageScheduleHistory)
}) })
} }

View file

@ -87,7 +87,7 @@ templ navList(c *views.Context) {
@createLink(c, "/config", "Config") @createLink(c, "/config", "Config")
@createLink(c, "/devices", "Devices") @createLink(c, "/devices", "Devices")
@createLink(c, "/subreddits", "Subreddits") @createLink(c, "/subreddits", "Subreddits")
@createLink(c, "/schedules", "Schedules") @createLink(c, "/history", "History")
<div class="flex-1 flex-shrink-0"></div> <div class="flex-1 flex-shrink-0"></div>
<div class="divider"></div> <div class="divider"></div>
@createLink(c, "/about", "About") @createLink(c, "/about", "About")

View file

@ -23,8 +23,8 @@ templ ScheduleHistoriesContent(c *views.Context, data Data) {
if data.Error != "" { if data.Error != "" {
@components.ErrorToast(data.Error) @components.ErrorToast(data.Error)
} else { } else {
<h1>Schedule History</h1> <h1>Schedule History ({ time.Local.String() })</h1>
<div class="divider"></div> <div class="divider my-0"></div>
if data.Total < 1 { if data.Total < 1 {
<h2>There are no history schedules to be found. You can populate this page's history by manually trigger a <a href="/subreddits" class="text-primary">Subreddit</a> { "for" } downloading.</h2> <h2>There are no history schedules to be found. You can populate this page's history by manually trigger a <a href="/subreddits" class="text-primary">Subreddit</a> { "for" } downloading.</h2>
} }
@ -33,12 +33,12 @@ templ ScheduleHistoriesContent(c *views.Context, data Data) {
for _, scheduleGroup := range data.splitByDays() { for _, scheduleGroup := range data.splitByDays() {
<h2>{ scheduleGroup.Day.Format("Monday, _2 January 2006") }</h2> <h2>{ scheduleGroup.Day.Format("Monday, _2 January 2006") }</h2>
<div class="divider"></div> <div class="divider"></div>
<div class="hidden sm:grid sm:grid-cols-[1fr,3fr]"> <div class="hidden sm:grid sm:grid-cols-[8rem,auto]">
<span class="font-bold">Time</span> <span class="font-bold">Time</span>
<span class="font-bold">Event</span> <span class="font-bold">Event</span>
</div> </div>
for _, schedule := range scheduleGroup.Schedules { for _, schedule := range scheduleGroup.Schedules {
<div class="grid sm:grid-cols-[1fr,3fr] mb-4 sm:mb-2"> <div class="grid sm:grid-cols-[8rem,auto] mb-4 sm:mb-2">
<span> <span>
<div <div
data-name="schedule-tooltip" data-name="schedule-tooltip"