diff --git a/layout/sidebar/sidebar.pixy b/layout/sidebar/sidebar.pixy index 18222b97..949cae9c 100644 --- a/layout/sidebar/sidebar.pixy +++ b/layout/sidebar/sidebar.pixy @@ -18,7 +18,7 @@ component Sidebar(user *arn.User) //- Sidebar buttons if user != nil - SidebarButton("Home", "/animelist/watching", "home") + SidebarButton("Home", "/+" + user.Nick + "/animelist/watching", "home") else SidebarButton("Home", "/", "home") diff --git a/mixins/AnimeList.pixy b/mixins/AnimeList.pixy new file mode 100644 index 00000000..17828fb0 --- /dev/null +++ b/mixins/AnimeList.pixy @@ -0,0 +1,59 @@ +component AnimeList(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User) + #load-more-target.anime-list + AnimeListScrollable(animeListItems, viewUser, user) + + if nextIndex != -1 + .buttons + LoadMore(nextIndex) + +component AnimeListScrollable(animeListItems []*arn.AnimeListItem, viewUser *arn.User, user *arn.User) + each item in animeListItems + .anime-list-item.mountable(title=item.Notes, data-api="/api/animelist/" + viewUser.ID + "/field/Items[AnimeID=\"" + item.AnimeID + "\"]") + .anime-list-item-image-container + a.anime-list-item-image-link.ajax(href=item.Anime().Link()) + img.anime-list-item-image.lazy(data-src=item.Anime().Image("small"), data-webp="true", alt=item.Anime().Title.ByUser(user)) + + .anime-list-item-name + a.ajax(href=item.Link(viewUser.Nick))= item.Anime().Title.ByUser(user) + + .anime-list-item-actions + if user != nil && item.Status == arn.AnimeListStatusWatching + //- if user.ID == "KpdWUlPzR" + //- a(href=arn.Nyaa.GetLink(item.Anime()), title="Search on Nyaa", target="_blank", rel="noopener") + //- RawIcon("download") + //- else + if item.Anime().EpisodeByNumber(item.Episodes + 1) != nil + for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links + a(href=link, title="Watch episode " + toString(item.Episodes + 1) + " on twist.moe", target="_blank", rel="noopener") + RawIcon("eye") + + .anime-list-item-airing-date + if (item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusPlanned) && item.Anime().UpcomingEpisode() != nil + span.utc-airing-date(data-start-date=item.Anime().UpcomingEpisode().Episode.AiringDate.Start, data-end-date=item.Anime().UpcomingEpisode().Episode.AiringDate.End, data-episode-number=item.Anime().UpcomingEpisode().Episode.Number) + + if item.Status != arn.AnimeListStatusCompleted + .anime-list-item-episodes + .anime-list-item-episodes-watched + .action(contenteditable=utils.SameUser(user, viewUser), data-field="Episodes", data-type="number", data-trigger="focusout", data-action="save")= item.Episodes + + if item.Status == arn.AnimeListStatusWatching + .plus-episode.action(data-action="increaseEpisode", data-trigger="click") + + else + .plus-episode-dummy + + + .anime-list-item-episodes-separator / + .anime-list-item-episodes-max= item.Anime().EpisodeCountString() + + .anime-list-item-rating(title="Overall rating") + .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Overall", data-type="number", data-trigger="focusout", data-action="save")= utils.FormatRating(item.Rating.Overall) + + //- if item.Status == arn.AnimeListStatusCompleted + //- .anime-list-item-rating(title="Story rating") + //- span.rating-label S: + //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Story", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Story) + //- .anime-list-item-rating(title="Visuals rating") + //- span.rating-label V: + //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Visuals", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Visuals) + //- .anime-list-item-rating(title="Soundtrack rating") + //- span.rating-label M: + //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Soundtrack", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Soundtrack) diff --git a/mixins/AnimeListItems.pixy b/mixins/AnimeListItems.pixy new file mode 100644 index 00000000..cee31332 --- /dev/null +++ b/mixins/AnimeListItems.pixy @@ -0,0 +1,6 @@ +component AnimeListItems(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User) + if len(animeListItems) == 0 + p.no-data.mountable= viewUser.Nick + " hasn't added any anime to this list yet." + else + .anime-list-container + AnimeList(animeListItems, nextIndex, viewUser, user) \ No newline at end of file diff --git a/pages/animelist/animelist.go b/pages/animelist/animelist.go deleted file mode 100644 index 463193dd..00000000 --- a/pages/animelist/animelist.go +++ /dev/null @@ -1,31 +0,0 @@ -package animelist - -import ( - "net/http" - - "github.com/aerogo/aero" - "github.com/animenotifier/arn" - "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/utils" -) - -// Get anime list. -func Get(ctx *aero.Context) string { - nick := ctx.Get("nick") - user := utils.GetUser(ctx) - viewUser, err := arn.GetUserByNick(nick) - - if err != nil { - return ctx.Error(http.StatusNotFound, "User not found", err) - } - - animeList := viewUser.AnimeList() - - if animeList == nil { - return ctx.Error(http.StatusNotFound, "Anime list not found", nil) - } - - animeList.Sort() - - return ctx.HTML(components.ProfileAnimeLists(animeList.SplitByStatus(), animeList.User(), user, ctx.URI())) -} diff --git a/pages/animelist/animelist.pixy b/pages/animelist/animelist.pixy index 4e6cda70..8df90a7f 100644 --- a/pages/animelist/animelist.pixy +++ b/pages/animelist/animelist.pixy @@ -1,99 +1,9 @@ -component ProfileAnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User, uri string) - ProfileHeader(viewUser, user, uri) +component HomeAnimeList(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User, status string) + h1.page-title= viewUser.Nick + "'s anime list" - 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 - if len(animeLists[arn.AnimeListStatusWatching].Items) > 0 - .anime-list-container - h3.status-name Watching - AnimeList(animeLists[arn.AnimeListStatusWatching].Items, -1, viewUser, user) - - if len(animeLists[arn.AnimeListStatusCompleted].Items) > 0 - .anime-list-container - h3.status-name Completed - AnimeList(animeLists[arn.AnimeListStatusCompleted].Items, -1, viewUser, user) - - if len(animeLists[arn.AnimeListStatusPlanned].Items) > 0 - .anime-list-container - h3.status-name Planned - AnimeList(animeLists[arn.AnimeListStatusPlanned].Items, -1, viewUser, user) - - if len(animeLists[arn.AnimeListStatusHold].Items) > 0 - .anime-list-container - h3.status-name On hold - AnimeList(animeLists[arn.AnimeListStatusHold].Items, -1, viewUser, user) - - if len(animeLists[arn.AnimeListStatusDropped].Items) > 0 - .anime-list-container - h3.status-name Dropped - AnimeList(animeLists[arn.AnimeListStatusDropped].Items, -1, viewUser, user) - -component AnimeList(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User) - #load-more-target.anime-list - AnimeListScrollable(animeListItems, viewUser, user) + if user.ID != viewUser.ID + .anime-list-user-avatar + Avatar(viewUser) - if nextIndex != -1 - .buttons - LoadMore(nextIndex) - -component AnimeListScrollable(animeListItems []*arn.AnimeListItem, viewUser *arn.User, user *arn.User) - each item in animeListItems - .anime-list-item.mountable(title=item.Notes, data-api="/api/animelist/" + viewUser.ID + "/field/Items[AnimeID=\"" + item.AnimeID + "\"]") - .anime-list-item-image-container - a.anime-list-item-image-link.ajax(href=item.Anime().Link()) - img.anime-list-item-image.lazy(data-src=item.Anime().Image("small"), data-webp="true", alt=item.Anime().Title.ByUser(user)) - - .anime-list-item-name - a.ajax(href=item.Link(viewUser.Nick))= item.Anime().Title.ByUser(user) - - .anime-list-item-actions - if user != nil && item.Status == arn.AnimeListStatusWatching - //- if user.ID == "KpdWUlPzR" - //- a(href=arn.Nyaa.GetLink(item.Anime()), title="Search on Nyaa", target="_blank", rel="noopener") - //- RawIcon("download") - //- else - if item.Anime().EpisodeByNumber(item.Episodes + 1) != nil - for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links - a(href=link, title="Watch episode " + toString(item.Episodes + 1) + " on twist.moe", target="_blank", rel="noopener") - RawIcon("eye") - - .anime-list-item-airing-date - if (item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusPlanned) && item.Anime().UpcomingEpisode() != nil - span.utc-airing-date(data-start-date=item.Anime().UpcomingEpisode().Episode.AiringDate.Start, data-end-date=item.Anime().UpcomingEpisode().Episode.AiringDate.End, data-episode-number=item.Anime().UpcomingEpisode().Episode.Number) - - if item.Status != arn.AnimeListStatusCompleted - .anime-list-item-episodes - .anime-list-item-episodes-watched - .action(contenteditable=utils.SameUser(user, viewUser), data-field="Episodes", data-type="number", data-trigger="focusout", data-action="save")= item.Episodes - - if item.Status == arn.AnimeListStatusWatching - .plus-episode.action(data-action="increaseEpisode", data-trigger="click") + - else - .plus-episode-dummy + - - .anime-list-item-episodes-separator / - .anime-list-item-episodes-max= item.Anime().EpisodeCountString() - - .anime-list-item-rating(title="Overall rating") - .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Overall", data-type="number", data-trigger="focusout", data-action="save")= utils.FormatRating(item.Rating.Overall) - - //- if item.Status == arn.AnimeListStatusCompleted - //- .anime-list-item-rating(title="Story rating") - //- span.rating-label S: - //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Story", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Story) - //- .anime-list-item-rating(title="Visuals rating") - //- span.rating-label V: - //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Visuals", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Visuals) - //- .anime-list-item-rating(title="Soundtrack rating") - //- span.rating-label M: - //- .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Soundtrack", data-type="number", data-trigger="focusout", data-action="save")= fmt.Sprintf("%.1f", item.Rating.Soundtrack) + StatusTabs("/+" + viewUser.Nick + "/animelist") + AnimeListItems(animeListItems, nextIndex, viewUser, user) \ No newline at end of file diff --git a/pages/animelist/animelist.scarlet b/pages/animelist/animelist.scarlet index 4be323d7..0c539bdb 100644 --- a/pages/animelist/animelist.scarlet +++ b/pages/animelist/animelist.scarlet @@ -1,3 +1,8 @@ +.anime-list-user-avatar + position absolute + top calc(content-padding / 2) + left calc(content-padding / 2) + .anime-list-container width 100% max-width 800px @@ -107,6 +112,9 @@ display none !important > 700px + .anime-list-title + display block + .anime-list-item-airing-date display flex !important text-align right diff --git a/pages/animelist/full.pixy b/pages/animelist/full.pixy new file mode 100644 index 00000000..108cd08a --- /dev/null +++ b/pages/animelist/full.pixy @@ -0,0 +1,33 @@ +//- 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) + +//- 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 +//- if len(animeLists[arn.AnimeListStatusWatching].Items) > 0 +//- .anime-list-container +//- h3.status-name Watching +//- AnimeList(animeLists[arn.AnimeListStatusWatching].Items, -1, viewUser, user) + +//- if len(animeLists[arn.AnimeListStatusCompleted].Items) > 0 +//- .anime-list-container +//- h3.status-name Completed +//- AnimeList(animeLists[arn.AnimeListStatusCompleted].Items, -1, viewUser, user) + +//- if len(animeLists[arn.AnimeListStatusPlanned].Items) > 0 +//- .anime-list-container +//- h3.status-name Planned +//- AnimeList(animeLists[arn.AnimeListStatusPlanned].Items, -1, viewUser, user) + +//- if len(animeLists[arn.AnimeListStatusHold].Items) > 0 +//- .anime-list-container +//- h3.status-name On hold +//- AnimeList(animeLists[arn.AnimeListStatusHold].Items, -1, viewUser, user) + +//- if len(animeLists[arn.AnimeListStatusDropped].Items) > 0 +//- .anime-list-container +//- h3.status-name Dropped +//- AnimeList(animeLists[arn.AnimeListStatusDropped].Items, -1, viewUser, user) \ No newline at end of file diff --git a/pages/animelist/profileanimelist.go b/pages/animelist/profileanimelist.go new file mode 100644 index 00000000..22f72ff3 --- /dev/null +++ b/pages/animelist/profileanimelist.go @@ -0,0 +1,45 @@ +package animelist + +import ( + "net/http" + + "github.com/aerogo/aero" + "github.com/animenotifier/arn" + "github.com/animenotifier/notify.moe/components" + "github.com/animenotifier/notify.moe/utils" +) + +// ProfileFilterByStatus returns a handler for the given anime list item status. +func ProfileFilterByStatus(status string) aero.Handle { + return func(ctx *aero.Context) string { + user := utils.GetUser(ctx) + list, response := statusList(ctx, status) + + if response != "" { + return response + } + + return ctx.HTML(components.ProfileAnimeListItems(list.Items, list.User(), user, status, ctx.URI())) + } +} + +// statusList handles the request for an anime list with a given status. +func statusList(ctx *aero.Context, status string) (*arn.AnimeList, string) { + nick := ctx.Get("nick") + viewUser, err := arn.GetUserByNick(nick) + + if err != nil { + return nil, ctx.Error(http.StatusNotFound, "User not found", err) + } + + animeList := viewUser.AnimeList() + + if animeList == nil { + return nil, ctx.Error(http.StatusNotFound, "Anime list not found", nil) + } + + watchingList := animeList.FilterStatus(status) + watchingList.Sort() + + return watchingList, "" +} diff --git a/pages/animelist/redirect.go b/pages/animelist/redirect.go new file mode 100644 index 00000000..5b69f33a --- /dev/null +++ b/pages/animelist/redirect.go @@ -0,0 +1,19 @@ +package animelist + +import ( + "net/http" + + "github.com/aerogo/aero" + "github.com/animenotifier/notify.moe/utils" +) + +// Redirect to the full URL including the user nick. +func Redirect(ctx *aero.Context) string { + user := utils.GetUser(ctx) + + if user == nil { + return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + } + + return ctx.Redirect("/+" + user.Nick + ctx.URI()) +} diff --git a/pages/animelist/status.go b/pages/animelist/status.go index 641efd3f..1ffbfa73 100644 --- a/pages/animelist/status.go +++ b/pages/animelist/status.go @@ -6,40 +6,66 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" + "github.com/animenotifier/notify.moe/pages/frontpage" "github.com/animenotifier/notify.moe/utils" + "github.com/animenotifier/notify.moe/utils/infinitescroll" ) +const maxAnimeListItems = 50 + // FilterByStatus returns a handler for the given anime list item status. func FilterByStatus(status string) aero.Handle { return func(ctx *aero.Context) string { user := utils.GetUser(ctx) - list, response := statusList(ctx, status) - if response != "" { - return response + if user == nil { + return frontpage.Get(ctx) } - return ctx.HTML(components.ProfileAnimeListFilteredByStatus(list, list.User(), user, status, ctx.URI())) + return HomeAnimeList(ctx, user, status) } } -// statusList handles the request for an anime list with a given status. -func statusList(ctx *aero.Context, status string) (*arn.AnimeList, string) { +// HomeAnimeList renders the anime list items. +func HomeAnimeList(ctx *aero.Context, user *arn.User, status string) string { nick := ctx.Get("nick") + index, _ := ctx.GetInt("index") viewUser, err := arn.GetUserByNick(nick) if err != nil { - return nil, ctx.Error(http.StatusNotFound, "User not found", err) + return ctx.Error(http.StatusNotFound, "User not found", err) } + // Fetch all eligible items animeList := viewUser.AnimeList() if animeList == nil { - return nil, ctx.Error(http.StatusNotFound, "Anime list not found", nil) + return ctx.Error(http.StatusNotFound, "Anime list not found", nil) } - watchingList := animeList.FilterStatus(status) - watchingList.Sort() + animeList = animeList.FilterStatus(status) - return watchingList, "" + // Sort the items + animeList.Sort() + + // These are all animer list items for the given status + allItems := animeList.Items + + // Slice the part that we need + items := allItems[index:] + + if len(items) > maxAnimeListItems { + items = items[:maxAnimeListItems] + } + + // Next index + nextIndex := infinitescroll.NextIndex(ctx, len(allItems), maxAnimeListItems, index) + + // In case we're scrolling, send items only (without the page frame) + if index > 0 { + return ctx.HTML(components.AnimeListScrollable(items, viewUser, user)) + } + + // Otherwise, send the full page + return ctx.HTML(components.HomeAnimeList(items, nextIndex, viewUser, user, status)) } diff --git a/pages/animelist/status.pixy b/pages/animelist/status.pixy index e74b2890..3c1f5be7 100644 --- a/pages/animelist/status.pixy +++ b/pages/animelist/status.pixy @@ -1,12 +1,3 @@ -component ProfileAnimeListFilteredByStatus(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User, status string, uri string) +component ProfileAnimeListItems(animeListItems []*arn.AnimeListItem, viewUser *arn.User, user *arn.User, status string, uri string) ProfileHeader(viewUser, user, uri) - - AnimeListFilteredByStatus(animeList.Items, -1, viewUser, user, status) - -component AnimeListFilteredByStatus(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User, status string) - if len(animeListItems) == 0 - p.no-data.mountable= viewUser.Nick + " hasn't added any anime to this list yet." - else - .anime-list-container - //- h3.status-name= arn.ListItemStatusName(status) - AnimeList(animeListItems, nextIndex, viewUser, user) \ No newline at end of file + AnimeListItems(animeListItems, -1, viewUser, user) \ No newline at end of file diff --git a/pages/embed/embed.pixy b/pages/embed/embed.pixy index 8a2883c7..45f0dead 100644 --- a/pages/embed/embed.pixy +++ b/pages/embed/embed.pixy @@ -6,7 +6,7 @@ component ExtensionNavigation(user *arn.User) button.action(data-trigger="click", data-action="toggleSidebar") RawIcon("bars") - if user != nil + if user != nil && !user.IsPro() .spacer a.button(href="/support", target="_blank") diff --git a/pages/home/animelist.go b/pages/home/animelist.go deleted file mode 100644 index 8ff418f4..00000000 --- a/pages/home/animelist.go +++ /dev/null @@ -1,88 +0,0 @@ -package home - -import ( - "net/http" - - "github.com/aerogo/aero" - "github.com/animenotifier/arn" - "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/pages/frontpage" - "github.com/animenotifier/notify.moe/utils" - "github.com/animenotifier/notify.moe/utils/infinitescroll" -) - -const maxAnimeListItems = 50 - -// FilterByStatus returns a handler for the given anime list item status. -func FilterByStatus(status string) aero.Handle { - return func(ctx *aero.Context) string { - user := utils.GetUser(ctx) - - if user == nil { - return frontpage.Get(ctx) - } - - return AnimeListItems(ctx, user, status) - } -} - -// // AnimeList sends the anime list with the given status for given user. -// func AnimeList(ctx *aero.Context, user *arn.User, status string) string { -// viewUser := user -// animeList := viewUser.AnimeList() - -// if animeList == nil { -// return ctx.Error(http.StatusNotFound, "Anime list not found", nil) -// } - -// animeList = animeList.FilterStatus(status) -// animeList.Sort() -// items := animeList.Items - -// if len(items) > maxAnimeListItems { -// items = items[:maxAnimeListItems] -// } - -// fmt.Println(len(items)) - -// return ctx.HTML(components.Home(items, viewUser, user, status)) -// } - -// AnimeListItems renders the anime list items. -func AnimeListItems(ctx *aero.Context, user *arn.User, status string) string { - viewUser := user - index, _ := ctx.GetInt("index") - - // Fetch all eligible items - animeList := viewUser.AnimeList() - - if animeList == nil { - return ctx.Error(http.StatusNotFound, "Anime list not found", nil) - } - - animeList = animeList.FilterStatus(status) - - // Sort the items - animeList.Sort() - - // These are all animer list items for the given status - allItems := animeList.Items - - // Slice the part that we need - items := allItems[index:] - - if len(items) > maxAnimeListItems { - items = items[:maxAnimeListItems] - } - - // Next index - nextIndex := infinitescroll.NextIndex(ctx, len(allItems), maxAnimeListItems, index) - - // In case we're scrolling, send items only (without the page frame) - if index > 0 { - return ctx.HTML(components.AnimeListScrollable(items, viewUser, user)) - } - - // Otherwise, send the full page - return ctx.HTML(components.Home(items, nextIndex, viewUser, user, status)) -} diff --git a/pages/home/home.go b/pages/home/home.go index 1a31d48a..b10f2554 100644 --- a/pages/home/home.go +++ b/pages/home/home.go @@ -14,6 +14,5 @@ func Get(ctx *aero.Context) string { return frontpage.Get(ctx) } - return ctx.Redirect("/animelist/watching") - //return AnimeList(ctx, user, arn.AnimeListStatusWatching) + return ctx.Redirect("/+" + user.Nick + "/animelist/watching") } diff --git a/pages/home/home.pixy b/pages/home/home.pixy deleted file mode 100644 index 52b0333b..00000000 --- a/pages/home/home.pixy +++ /dev/null @@ -1,3 +0,0 @@ -component Home(animeListItems []*arn.AnimeListItem, nextIndex int, viewUser *arn.User, user *arn.User, status string) - StatusTabs("/animelist") - AnimeListFilteredByStatus(animeListItems, nextIndex, viewUser, user, status) \ No newline at end of file diff --git a/pages/index.go b/pages/index.go index 7ed721d4..c24c95fa 100644 --- a/pages/index.go +++ b/pages/index.go @@ -176,28 +176,28 @@ func Configure(app *aero.Application) { l.Page("/user/:nick/soundtracks/liked/from/:index", profiletracks.Liked) l.Page("/user/:nick/stats", profile.GetStatsByUser) l.Page("/user/:nick/followers", profile.GetFollowers) - l.Page("/user/:nick/animelist", animelist.Get) - l.Page("/user/:nick/animelist/watching", animelist.FilterByStatus(arn.AnimeListStatusWatching)) - l.Page("/user/:nick/animelist/completed", animelist.FilterByStatus(arn.AnimeListStatusCompleted)) - l.Page("/user/:nick/animelist/planned", animelist.FilterByStatus(arn.AnimeListStatusPlanned)) - l.Page("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold)) - l.Page("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped)) l.Page("/user/:nick/animelist/anime/:id", animelistitem.Get) l.Page("/user/:nick/recommended/anime", recommended.Anime) l.Page("/user/:nick/notifications", notifications.ByUser) // Anime list - l.Page("/animelist/watching", home.FilterByStatus(arn.AnimeListStatusWatching)) - l.Page("/animelist/completed", home.FilterByStatus(arn.AnimeListStatusCompleted)) - l.Page("/animelist/planned", home.FilterByStatus(arn.AnimeListStatusPlanned)) - l.Page("/animelist/hold", home.FilterByStatus(arn.AnimeListStatusHold)) - l.Page("/animelist/dropped", home.FilterByStatus(arn.AnimeListStatusDropped)) + l.Page("/user/:nick/animelist/watching", animelist.FilterByStatus(arn.AnimeListStatusWatching)) + l.Page("/user/:nick/animelist/completed", animelist.FilterByStatus(arn.AnimeListStatusCompleted)) + l.Page("/user/:nick/animelist/planned", animelist.FilterByStatus(arn.AnimeListStatusPlanned)) + l.Page("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold)) + l.Page("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped)) - l.Page("/animelist/watching/from/:index", home.FilterByStatus(arn.AnimeListStatusWatching)) - l.Page("/animelist/completed/from/:index", home.FilterByStatus(arn.AnimeListStatusCompleted)) - l.Page("/animelist/planned/from/:index", home.FilterByStatus(arn.AnimeListStatusPlanned)) - l.Page("/animelist/hold/from/:index", home.FilterByStatus(arn.AnimeListStatusHold)) - l.Page("/animelist/dropped/from/:index", home.FilterByStatus(arn.AnimeListStatusDropped)) + l.Page("/user/:nick/animelist/watching/from/:index", animelist.FilterByStatus(arn.AnimeListStatusWatching)) + l.Page("/user/:nick/animelist/completed/from/:index", animelist.FilterByStatus(arn.AnimeListStatusCompleted)) + l.Page("/user/:nick/animelist/planned/from/:index", animelist.FilterByStatus(arn.AnimeListStatusPlanned)) + l.Page("/user/:nick/animelist/hold/from/:index", animelist.FilterByStatus(arn.AnimeListStatusHold)) + l.Page("/user/:nick/animelist/dropped/from/:index", animelist.FilterByStatus(arn.AnimeListStatusDropped)) + + l.Page("/animelist/watching", animelist.Redirect) + l.Page("/animelist/completed", animelist.Redirect) + l.Page("/animelist/planned", animelist.Redirect) + l.Page("/animelist/hold", animelist.Redirect) + l.Page("/animelist/dropped", animelist.Redirect) // Compare l.Page("/compare/animelist/:nick-1/:nick-2", compare.AnimeList) diff --git a/pages/profile/profile.pixy b/pages/profile/profile.pixy index 0e2cdd2d..48239221 100644 --- a/pages/profile/profile.pixy +++ b/pages/profile/profile.pixy @@ -24,14 +24,15 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, component ProfileTabs(viewUser *arn.User, uri string) .tabs Tab("Anime", "th", "/+" + viewUser.Nick) - Tab("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching") + //- Tab("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching") Tab("Forum", "comment", "/+" + viewUser.Nick + "/forum/threads") Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks/liked") Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats") Tab("Followers", "users", "/+" + viewUser.Nick + "/followers") - if strings.Contains(uri, "/animelist") - StatusTabs("/+" + viewUser.Nick + "/animelist") + //- if strings.Contains(uri, "/animelist") + //- StatusTabs("/+" + viewUser.Nick + "/animelist") + if strings.Contains(uri, "/soundtracks") .tabs Tab("Liked", "heart", "/+" + viewUser.Nick + "/soundtracks/liked") @@ -109,7 +110,13 @@ component ProfileHead(viewUser *arn.User, user *arn.User, uri string) button.profile-action.action(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID) Icon("user-times") span Unfollow - + + if user.ID != viewUser.ID a.button.profile-action.ajax(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick) Icon("exchange") - span Compare \ No newline at end of file + span Compare + + a.button.profile-action.ajax(href="/+" + viewUser.Nick + "/animelist/watching") + Icon("list") + span Anime list + \ No newline at end of file