package homeview import "github.com/tigorlazuardi/redmage/views/components" import "github.com/tigorlazuardi/redmage/views" import "github.com/tigorlazuardi/redmage/views/utils" import "time" templ Home(c *views.Context, data Data) { @components.Doctype() { @components.Head(c, components.HeadTitle("Redmage - Home")) @components.Body(c) { @components.Container() { if data.Error != nil { @components.ErrorToast(data.Error.Error()) } else { @home(c, data) } } } } } templ home(_ *views.Context, data Data) {

Recently Added

for _, deviceMapValue := range data.RecentlyAddedImages {

{ deviceMapValue.device.Name }

for _, subreddit := range deviceMapValue.subreddits {

{ subreddit.subreddit.Name }

@RecentlyAddedImageList(subreddit.images, 0) } }

Subreddits

for _, subreddit := range data.SubredditsList.Data {

{ subreddit.Name } - { utils.NextScheduleTime(subreddit.Schedule).Format(time.RubyDate) }

}
}