This commit is contained in:
2017-07-22 15:04:54 +02:00
parent e9e0aa89eb
commit 16cbd5167f
29 changed files with 262 additions and 204 deletions

10
pages/amvs/amvs.go Normal file
View File

@ -0,0 +1,10 @@
package amvs
import (
"github.com/aerogo/aero"
)
// Get AMVs.
func Get(ctx *aero.Context) string {
return ctx.HTML("Coming soon™.")
}

View File

@ -14,7 +14,7 @@
align-items flex-start
.anime-cover-image
width 230px
width 142px
height auto
border-radius 3px

View File

@ -28,5 +28,5 @@ func Get(ctx *aero.Context) string {
animeList.PrefetchAnime()
animeList.Sort()
return ctx.HTML(components.AnimeLists(animeList.SplitByStatus(), animeList.User(), user, ctx.URI()))
return ctx.HTML(components.ProfileAnimeLists(animeList.SplitByStatus(), animeList.User(), user, ctx.URI()))
}

View File

@ -1,8 +1,15 @@
component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User, uri string)
component ProfileAnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri)
h1.page-title.anime-list-owner= viewUser.Nick + "'s collection"
AnimeLists(animeLists, viewUser, user)
//- for status, animeList := range animeLists
//- h3= status
//- AnimeList(animeList, user)
component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User)
if len(animeLists[arn.AnimeListStatusWatching].Items) == 0 && len(animeLists[arn.AnimeListStatusCompleted].Items) == 0 && len(animeLists[arn.AnimeListStatusPlanned].Items) == 0 && len(animeLists[arn.AnimeListStatusHold].Items) == 0 && len(animeLists[arn.AnimeListStatusDropped].Items) == 0
p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
else
@ -30,10 +37,6 @@ component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, u
.anime-list-container
h3.status-name Dropped
AnimeList(animeLists[arn.AnimeListStatusDropped], viewUser, user)
//- for status, animeList := range animeLists
//- h3= status
//- AnimeList(animeList, user)
component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User)
table.anime-list

View File

@ -2,7 +2,7 @@
vertical
width 100%
max-width table-width-normal
margin 0 auto
// margin 0 auto
margin-bottom 1rem
.anime-list

View File

@ -19,7 +19,7 @@ func FilterByStatus(status string) aero.Handle {
return response
}
return ctx.HTML(components.AnimeListFilteredByStatus(list, list.User(), user, status, ctx.URI()))
return ctx.HTML(components.ProfileAnimeListFilteredByStatus(list, list.User(), user, status, ctx.URI()))
}
}

View File

@ -1,9 +1,12 @@
component AnimeListFilteredByStatus(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User, status string, uri string)
component ProfileAnimeListFilteredByStatus(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User, status string, uri string)
ProfileHeader(viewUser, user, uri)
AnimeListFilteredByStatus(animeList, viewUser, user, status)
component AnimeListFilteredByStatus(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User, status string)
if len(animeList.Items) == 0
p.no-data.mountable= viewUser.Nick + " hasn't added any anime to this list yet."
else
.anime-list-container.fill-screen
h3.status-name= arn.ListItemStatusName(status)
//- h3.status-name= arn.ListItemStatusName(status)
AnimeList(animeList, viewUser, user)

View File

@ -0,0 +1,10 @@
package artworks
import (
"github.com/aerogo/aero"
)
// Get artworks.
func Get(ctx *aero.Context) string {
return ctx.HTML("Coming soon™.")
}

View File

@ -7,7 +7,6 @@ import (
"github.com/aerogo/flow"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/pages/frontpage"
"github.com/animenotifier/notify.moe/utils"
)
@ -16,19 +15,8 @@ const maxFollowing = 5
const maxSoundTracks = 5
const maxScheduleItems = 5
// Get the dashboard or the frontpage when logged out.
// Get the dashboard.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
if user == nil {
return frontpage.Get(ctx)
}
return dashboard(ctx)
}
// Render the dashboard.
func dashboard(ctx *aero.Context) string {
var forumActivity []arn.Postable
var followingList []*arn.User
var soundTracks []*arn.SoundTrack

31
pages/home/home.go Normal file
View 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))
}

View File

@ -59,60 +59,38 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
ProfileNavigation(viewUser, uri)
component ProfileNavigation(viewUser *arn.User, uri string)
.buttons.tabs
a.button.tab.action(href="/+" + viewUser.Nick, data-action="diff", data-trigger="click")
.tabs
a.tab.action(href="/+" + viewUser.Nick, data-action="diff", data-trigger="click")
Icon("th")
span.tab-text Anime
a.button.tab.action(href="/+" + viewUser.Nick + "/animelist/watching", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/animelist/watching", data-action="diff", data-trigger="click")
Icon("list")
span.tab-text Collection
a.button.tab.action(href="/+" + viewUser.Nick + "/threads", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/threads", data-action="diff", data-trigger="click")
Icon("comment")
span.tab-text Threads
a.button.tab.action(href="/+" + viewUser.Nick + "/posts", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/posts", data-action="diff", data-trigger="click")
Icon("comments")
span.tab-text Posts
a.button.tab.action(href="/+" + viewUser.Nick + "/soundtracks", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/soundtracks", data-action="diff", data-trigger="click")
Icon("music")
span.tab-text Tracks
a.button.tab.action(href="/+" + viewUser.Nick + "/stats", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/stats", data-action="diff", data-trigger="click")
Icon("area-chart")
span.tab-text Stats
a.button.tab.action(href="/+" + viewUser.Nick + "/followers", data-action="diff", data-trigger="click")
a.tab.action(href="/+" + viewUser.Nick + "/followers", data-action="diff", data-trigger="click")
Icon("users")
span.tab-text Followers
if strings.Contains(uri, "/animelist")
hr
StatusTabs("/+" + viewUser.Nick + "/animelist")
component StatusTabs(urlPrefix string)
.buttons.tabs.status-tabs
a.button.tab.status-tab.action(href=urlPrefix + "/watching", data-action="diff", data-trigger="click")
Icon("play")
span.tab-text Watching
a.button.tab.status-tab.action(href=urlPrefix + "/completed", data-action="diff", data-trigger="click")
Icon("check")
span.tab-text Completed
a.button.tab.status-tab.action(href=urlPrefix + "/planned", data-action="diff", data-trigger="click")
Icon("forward")
span.tab-text Planned
a.button.tab.status-tab.action(href=urlPrefix + "/hold", data-action="diff", data-trigger="click")
Icon("pause")
span.tab-text On Hold
a.button.tab.status-tab.action(href=urlPrefix + "/dropped", data-action="diff", data-trigger="click")
Icon("stop")
span.tab-text Dropped
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack, uri string)
ProfileHeader(viewUser, user, uri)

View File

@ -14,12 +14,12 @@ component Statistics(pieCharts ...*arn.PieChart)
p Data is collected for statistical purposes only. We respect user privacy and we will never display or sell critical data to 3rd party services.
component StatisticsHeader
.buttons.tabs
a.button.tab.action(href="/statistics", data-action="diff", data-trigger="click")
.tabs
a.tab.action(href="/statistics", data-action="diff", data-trigger="click")
Icon("user")
span.tab-text Users
a.button.tab.action(href="/statistics/anime", data-action="diff", data-trigger="click")
a.tab.action(href="/statistics/anime", data-action="diff", data-trigger="click")
Icon("tv")
span.tab-text Anime

View File

@ -1,20 +1,20 @@
component Users(users []*arn.User)
h1.page-title Users
.buttons.tabs
a.button.tab.action(href="/users", data-action="diff", data-trigger="click")
.tabs
a.tab.action(href="/users", data-action="diff", data-trigger="click")
Icon("users")
span.tab-text Active
a.button.tab.action(href="/users/anime/watching", data-action="diff", data-trigger="click")
a.tab.action(href="/users/anime/watching", data-action="diff", data-trigger="click")
Icon("tv")
span.tab-text Watching
a.button.tab.action(href="/users/osu", data-action="diff", data-trigger="click")
a.tab.action(href="/users/osu", data-action="diff", data-trigger="click")
Icon("gamepad")
span.tab-text Osu
a.button.tab.action(href="/users/staff", data-action="diff", data-trigger="click")
a.tab.action(href="/users/staff", data-action="diff", data-trigger="click")
Icon("user-secret")
span.tab-text Staff