2018-11-15 16:23:09 +09:00

141 lines
7.6 KiB
Plaintext

component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, uri string)
ProfileHeader(viewUser, user, uri)
//- if len(animeList.Items) == 0
//- p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
//- else
//- .profile-watching-list.mountable
//- each item in animeList.Items
//- if item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusCompleted
//- a.profile-watching-list-item.tip(href=item.Anime().Link(), aria-label=item.Anime().Title.ByUser(user) + " (" + fmt.Sprint(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
//- img.profile-watching-list-item-image.lazy(data-src=item.Anime().ImageLink("small"), data-webp="true", data-color=item.Anime().AverageColor(), alt=item.Anime().Title.ByUser(user), importance="high")
//- .footer
//- .buttons
//- if user != nil && (user.Role == "admin" || user.Role == "editor")
//- a.button.profile-action(href="/api/user/" + viewUser.ID, target="_blank", rel="noopener")
//- Icon("search-plus")
//- span JSON
component ProfileTabs(viewUser *arn.User, uri string)
.tabs.mountable.never-unmount
Tab("Anime", "th", "/+" + viewUser.Nick)
Tab("Characters", "child", "/+" + viewUser.Nick + "/characters/liked")
Tab("Forum", "comment", "/+" + viewUser.Nick + "/forum/threads")
Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks/liked")
Tab("Quotes", "quote-left", "/+" + viewUser.Nick + "/quotes/liked")
Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats")
Tab("Followers", "users", "/+" + viewUser.Nick + "/followers")
if strings.Contains(uri, "/soundtracks")
.tabs
Tab("Liked", "heart", "/+" + viewUser.Nick + "/soundtracks/liked")
Tab("Added", "plus", "/+" + viewUser.Nick + "/soundtracks/added")
if strings.Contains(uri, "/quotes")
.tabs
Tab("Liked", "heart", "/+" + viewUser.Nick + "/quotes/liked")
Tab("Added", "plus", "/+" + viewUser.Nick + "/quotes/added")
component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
ProfileHead(viewUser, user, uri)
//- ProfileTabs(viewUser, uri)
component ProfileHead(viewUser *arn.User, user *arn.User, uri string)
.profile
img.profile-cover.lazy(data-src=viewUser.CoverLink("large"), data-webp="true", alt="Cover image")
.profile-image-container.mountable.never-unmount
ProfileImage(viewUser)
.profile-info.mountable.never-unmount
h1#nick= viewUser.Nick
.profile-introduction!= markdown.Render(viewUser.Introduction)
.profile-tags-container
.profile-tags
a.profile-tag.mountable.never-unmount(href="/+" + viewUser.Nick + "/animelist/watching", data-mountable-type="header")
Icon("list")
span= fmt.Sprintf("%d anime", len(viewUser.AnimeList().Items))
if user != nil && viewUser.Settings().Privacy.ShowAge && viewUser.Settings().Privacy.ShowGender && viewUser.AgeInYears() != 0
.profile-tag.mountable.never-unmount(data-mountable-type="header")
if viewUser.Gender == "male"
Icon("mars")
else if viewUser.Gender == "female"
Icon("venus")
else
Icon("venus-mars")
span= viewUser.AgeInYears()
if user != nil && viewUser.Settings().Privacy.ShowLocation && viewUser.Location.CountryName != ""
a.profile-tag.mountable.never-unmount(href="/users/country/" + strings.ToLower(viewUser.Location.CountryName), data-mountable-type="header")
Icon("map-marker")
span= viewUser.Location.CountryName
if viewUser.IsPro()
a.profile-tag.mountable.never-unmount(href="/support", aria-label="Supporter", data-mountable-type="header")
Icon("star")
span.profile-pro-status-text PRO
if viewUser.Role != ""
a.profile-tag.mountable.never-unmount(href="/users/staff", aria-label="Staff member", data-mountable-type="header")
Icon("rocket")
span= stringutils.Capitalize(viewUser.Role)
if viewUser.Registered != ""
.profile-tag.mountable.never-unmount(title="Member since", data-mountable-type="header")
Icon("calendar")
span= viewUser.RegisteredTime().Format("Jan 2006")
if !viewUser.IsActive()
.profile-tag.mountable.never-unmount(title="Hasn't been online for the past 2 weeks", data-mountable-type="header")
Icon("bed")
span Inactive
.profile-tag.action.tip.mountable.never-unmount(data-action="showMore", data-trigger="click", aria-label="Show more", data-mountable-type="header")
RawIcon("ellipsis-h")
if viewUser.Website != ""
a.profile-tag.tip.mountable.never-unmount.show-more(href=viewUser.WebsiteURL(), target="_blank", rel="nofollow", aria-label=viewUser.WebsiteShortURL(), data-mountable-type="header")
RawIcon("globe")
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, aria-label=fmt.Sprintf("osu! | %.0f pp | Level %.0f | Accuracy: %.1f%%", viewUser.Accounts.Osu.PP, viewUser.Accounts.Osu.Level, viewUser.Accounts.Osu.Accuracy), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("trophy")
if viewUser.Accounts.Overwatch.BattleTag != "" && viewUser.Accounts.Overwatch.SkillRating >= 1000
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), aria-label=fmt.Sprintf("Overwatch | %d SR | %s", viewUser.Accounts.Overwatch.SkillRating, stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier)), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("overwatch")
if viewUser.Accounts.FinalFantasyXIV.Nick != "" && viewUser.Accounts.FinalFantasyXIV.Class != ""
.profile-tag.tip.mountable.never-unmount.show-more(aria-label=fmt.Sprintf("Final Fantasy XIV | %s | Level %d | IL %d", viewUser.Accounts.FinalFantasyXIV.Class, viewUser.Accounts.FinalFantasyXIV.Level, viewUser.Accounts.FinalFantasyXIV.ItemLevel), data-mountable-type="header")
RawIcon("gamepad")
if viewUser.Accounts.Discord.Nick != "" && viewUser.Accounts.Discord.Verified
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://discord.gg/0kimAmMCeXGXuzNF", aria-label=fmt.Sprintf("Discord | %s", viewUser.Accounts.Discord.Nick), data-mountable-type="header")
RawIcon("discord")
if user != nil && user.ID != viewUser.ID
a.profile-tag.tip.mountable.never-unmount.show-more(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick, aria-label="Compare", data-mountable-type="header")
RawIcon("exchange")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/recommended/anime", aria-label="Recommendations", data-mountable-type="header")
RawIcon("archive")
if user != nil && (user.Role == "editor" || user.Role == "admin")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/log", aria-label="Log", data-mountable-type="header")
RawIcon("list")
.profile-actions
if user != nil && user.ID != viewUser.ID
if !user.Follows().Contains(viewUser.ID)
button.profile-action.action.mountable.never-unmount(data-action="followUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/add/" + viewUser.ID)
Icon("user-plus")
span Follow
else
button.profile-action.action.mountable.never-unmount(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID)
Icon("user-times")
span Unfollow