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.ajax(href=item.Anime().Link(), title=item.Anime().Title.ByUser(user) + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
						img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image("small"), data-webp="true", alt=item.Anime().Title.ByUser(user))

	.footer
		.buttons
			a.button.profile-action.ajax(href="/+" + viewUser.Nick + "/recommended/anime")
				Icon("tv")
				span View recommendations
				
			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("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching")
		Tab("Forum", "comment", "/+" + viewUser.Nick + "/forum/threads")
		Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks")
		Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats")
		Tab("Followers", "users", "/+" + viewUser.Nick + "/followers")

	if strings.Contains(uri, "/animelist")
		StatusTabs("/+" + viewUser.Nick + "/animelist")

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=arn.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= arn.Capitalize(viewUser.Role)

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

		if user != nil
			.profile-actions
				if 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.ajax(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick)
						Icon("exchange")
						span Compare