93 lines
5.0 KiB
Plaintext

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
if len(animeLists[arn.AnimeListStatusWatching].Items) > 0
.anime-list-container
h3.status-name Watching
AnimeList(animeLists[arn.AnimeListStatusWatching], viewUser, user)
if len(animeLists[arn.AnimeListStatusCompleted].Items) > 0
.anime-list-container
h3.status-name Completed
AnimeList(animeLists[arn.AnimeListStatusCompleted], viewUser, user)
if len(animeLists[arn.AnimeListStatusPlanned].Items) > 0
.anime-list-container
h3.status-name Planned
AnimeList(animeLists[arn.AnimeListStatusPlanned], viewUser, user)
if len(animeLists[arn.AnimeListStatusHold].Items) > 0
.anime-list-container
h3.status-name On hold
AnimeList(animeLists[arn.AnimeListStatusHold], viewUser, user)
if len(animeLists[arn.AnimeListStatusDropped].Items) > 0
.anime-list-container
h3.status-name Dropped
AnimeList(animeLists[arn.AnimeListStatusDropped], viewUser, user)
component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User)
.anime-list
each item in animeList.Items
.anime-list-item.mountable(title=item.Notes, data-api="/api/animelist/" + animeList.UserID + "/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(animeList.User().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)