Redesign
This commit is contained in:
31
pages/home/home.go
Normal file
31
pages/home/home.go
Normal file
@ -0,0 +1,31 @@
|
||||
package home
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/pages/frontpage"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get the dashboard or the frontpage when logged out.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
return frontpage.Get(ctx)
|
||||
}
|
||||
|
||||
viewUser := user
|
||||
animeList := viewUser.AnimeList()
|
||||
|
||||
if animeList == nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime list not found", nil)
|
||||
}
|
||||
|
||||
animeList.PrefetchAnime()
|
||||
animeList.Sort()
|
||||
|
||||
return ctx.HTML(components.AnimeLists(animeList.SplitByStatus(), animeList.User(), user))
|
||||
}
|
Reference in New Issue
Block a user