2024-04-08 16:59:42 +07:00
|
|
|
package homeview
|
|
|
|
|
2024-04-08 21:50:52 +07:00
|
|
|
import "github.com/tigorlazuardi/redmage/views/components"
|
|
|
|
import "github.com/tigorlazuardi/redmage/views"
|
2024-04-09 16:09:08 +07:00
|
|
|
import "github.com/tigorlazuardi/redmage/api"
|
2024-04-08 21:50:52 +07:00
|
|
|
|
2024-04-09 16:09:08 +07:00
|
|
|
type Data struct {
|
|
|
|
SubredditsList api.ListSubredditsResult
|
|
|
|
Error error
|
|
|
|
}
|
|
|
|
|
|
|
|
templ Home(c *views.Context, data Data) {
|
2024-04-08 21:50:52 +07:00
|
|
|
@components.Doctype() {
|
2024-04-09 16:09:08 +07:00
|
|
|
@components.Head(c)
|
|
|
|
@components.Body(c) {
|
|
|
|
@components.Container() {
|
|
|
|
if data.Error != nil {
|
|
|
|
@components.ErrorToast(data.Error.Error())
|
|
|
|
} else {
|
|
|
|
@home(c, data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-08 21:50:52 +07:00
|
|
|
}
|
2024-04-08 16:59:42 +07:00
|
|
|
}
|
2024-04-09 16:09:08 +07:00
|
|
|
|
|
|
|
templ home(c *views.Context, data Data) {
|
|
|
|
<div class="prose">
|
|
|
|
<h1>Recently Added</h1>
|
|
|
|
</div>
|
|
|
|
}
|