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) + " (" + toString(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))

	.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
		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)

		.intro-container.mountable.never-unmount
			h1#nick= viewUser.Nick

			if viewUser.Tagline != ""
				p.profile-field.tagline
					Icon("comment")
					span.tagline-text= viewUser.Tagline
			else
				p.profile-field.tagline
					Icon("comment")
					span.tagline-text No tagline yet.

			if viewUser.Website != ""
				p.profile-field.website
					Icon("home")
					a(href=viewUser.WebsiteURL(), target="_blank", rel="nofollow")= viewUser.WebsiteShortURL()

			if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
				p.profile-field.osu(title="osu! Level " + toString(int(viewUser.Accounts.Osu.Level)) + " | Accuracy: " + fmt.Sprintf("%.1f", viewUser.Accounts.Osu.Accuracy) + "%")
					Icon("trophy")
					a(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, target="_blank", rel="noopener")= toString(int(viewUser.Accounts.Osu.PP)) + " pp"

			if viewUser.Accounts.Overwatch.BattleTag != "" && viewUser.Accounts.Overwatch.SkillRating >= 1000
				p.profile-field.overwatch(title=stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier) + " (Overwatch)")
					Icon("overwatch")
					a(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), target="_blank", rel="noopener")= toString(viewUser.Accounts.Overwatch.SkillRating) + " SR"

			//- if viewUser.dataEditCount
			//- 	p.profile-field.editor-contribution(title="Anime data modifications")
			//- 		Icon("edit")
			//- 		span= viewUser.dataEditCount

			if viewUser.Registered != ""
				p.profile-field.registration-date(title="Member since")
					Icon("calendar")
					//- span= time.Parse(time.RFC3339, viewUser.Registered)
					span= viewUser.RegisteredTime().Format("Jan 2006")
					//- span= monthNames[joined.getMonth()] + ' ' + joined.getFullYear()

			if viewUser.Role != ""
				p.profile-field.role
					Icon("rocket")
					span= stringutils.Capitalize(viewUser.Role)

		if viewUser.IsPro()
			p.profile-field.profile-pro-status
				a(href="/shop", title="PRO user")
					Icon("star")
					span.profile-pro-status-text PRO

		
		.profile-actions
			if user != nil && user.ID != viewUser.ID
				if !user.Follows().Contains(viewUser.ID)
					button.profile-action.action(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(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID)
						Icon("user-times")
						span Unfollow
			
			a.button.profile-action(href="/+" + viewUser.Nick + "/animelist/watching")
				Icon("list")
				span Anime list

			if user != nil && user.ID != viewUser.ID
				a.button.profile-action(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick)
					Icon("exchange")
					span Compare
			
			a.button.profile-action(href="/+" + viewUser.Nick + "/recommended/anime")
				Icon("archive")
				span Recomms

			if user != nil && (user.Role == "editor" || user.Role == "admin")
				a.button.profile-action(href="/+" + viewUser.Nick + "/log")
					Icon("edit")
					span Log