Improved user profiles

This commit is contained in:
Eduard Urbach 2018-10-31 09:33:56 +09:00
parent b4d0df2eb7
commit 2649457ed9
3 changed files with 103 additions and 67 deletions

View File

@ -48,83 +48,83 @@ component ProfileHead(viewUser *arn.User, user *arn.User, uri string)
.profile-image-container.mountable.never-unmount
ProfileImage(viewUser)
.intro-container.mountable.never-unmount
.profile-info.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.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.
.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 viewUser.Website != ""
p.profile-field.website
a.profile-tag.mountable.never-unmount(href=viewUser.WebsiteURL(), target="_blank", rel="nofollow", aria-label="Website", data-mountable-type="header")
Icon("home")
a(href=viewUser.WebsiteURL(), target="_blank", rel="nofollow")= viewUser.WebsiteShortURL()
span= viewUser.WebsiteShortURL()
//- if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
//- p.profile-field.osu(title="osu! Level " + fmt.Sprint(int(viewUser.Accounts.Osu.Level)) + " | Accuracy: " + fmt.Sprintf("%.1f", viewUser.Accounts.Osu.Accuracy) + "%")
//- a.profile-tag.tip.mountable.never-unmount(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, aria-label="osu! | Level " + fmt.Sprint(int(viewUser.Accounts.Osu.Level)) + " | Accuracy: " + fmt.Sprintf("%.1f", viewUser.Accounts.Osu.Accuracy) + "%", target="_blank", rel="noopener", data-mountable-type="header")
//- Icon("trophy")
//- a(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, target="_blank", rel="noopener")= fmt.Sprint(int(viewUser.Accounts.Osu.PP)) + " pp"
//- span= fmt.Sprint(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)")
//- a.profile-tag.tip.mountable.never-unmount(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), aria-label=fmt.Sprintf("Overwatch | %s", stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier)), target="_blank", rel="noopener", data-mountable-type="header")
//- Icon("overwatch")
//- a(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), target="_blank", rel="noopener")= fmt.Sprint(viewUser.Accounts.Overwatch.SkillRating) + " SR"
//- span= fmt.Sprint(viewUser.Accounts.Overwatch.SkillRating) + " SR"
//- if viewUser.dataEditCount
//- p.profile-field.editor-contribution(title="Anime data modifications")
//- Icon("edit")
//- span= viewUser.dataEditCount
//- if viewUser.Accounts.FinalFantasyXIV.Nick != "" && viewUser.Accounts.FinalFantasyXIV.Class != ""
//- .profile-tag.tip.mountable.never-unmount(aria-label=fmt.Sprintf("Final Fantasy XIV | Level %d | IL %d", viewUser.Accounts.FinalFantasyXIV.Level, viewUser.Accounts.FinalFantasyXIV.ItemLevel), data-mountable-type="header")
//- Icon("gamepad")
//- span= viewUser.Accounts.FinalFantasyXIV.Class
if viewUser.Registered != ""
p.profile-field.registration-date(title="Member since")
.profile-tag.tip.mountable.never-unmount(aria-label="Member since", data-mountable-type="header")
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")
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 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
.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)
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(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID)
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
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

View File

@ -24,13 +24,12 @@ const profile-image-size = 280px
a
color white
.intro-container
.profile-info
vertical
align-items center
margin-top calc(content-padding * 1.5)
.profile-actions
vertical
horizontal-wrap
margin-top content-padding
:empty
@ -50,12 +49,12 @@ const profile-image-size = 280px
> 740px
.profile
horizontal
align-items flex-start
align-items stretch
.profile-field
text-align left
.intro-container
.profile-info
align-items flex-start
margin-top 0
padding content-padding

View File

@ -0,0 +1,37 @@
.profile-tags-container
// ...
.profile-tags
horizontal-wrap
justify-content center
margin-bottom typography-margin
margin-top content-padding
.profile-tag
default-transition
padding 0.25rem 0.75rem
font-size 85%
color hsl(0, 0%, 90%)
background rgba(255, 255, 255, 0.1)
border-radius ui-element-border-radius
margin 0.35rem
&.mounted
opacity 0.8
:hover
color hsl(0, 0%, 90%)
opacity 1.0
text-shadow none
background rgba(255, 255, 255, 0.2)
> 800px
.profile-tags
justify-content flex-start
margin-bottom 0
.profile-tags-container
vertical
flex 1
justify-content flex-end
align-items flex-end