Disable old profile pages

This commit is contained in:
Eduard Urbach 2018-11-24 15:57:52 +09:00
parent 5668c66b31
commit cfb481df52
18 changed files with 280 additions and 283 deletions

View File

@ -8,9 +8,6 @@ import (
"github.com/animenotifier/notify.moe/pages/compare" "github.com/animenotifier/notify.moe/pages/compare"
"github.com/animenotifier/notify.moe/pages/notifications" "github.com/animenotifier/notify.moe/pages/notifications"
"github.com/animenotifier/notify.moe/pages/profile" "github.com/animenotifier/notify.moe/pages/profile"
"github.com/animenotifier/notify.moe/pages/profile/profilecharacters"
"github.com/animenotifier/notify.moe/pages/profile/profilequotes"
"github.com/animenotifier/notify.moe/pages/profile/profiletracks"
"github.com/animenotifier/notify.moe/pages/recommended" "github.com/animenotifier/notify.moe/pages/recommended"
"github.com/animenotifier/notify.moe/pages/user" "github.com/animenotifier/notify.moe/pages/user"
) )
@ -20,19 +17,19 @@ func Register(l *layout.Layout) {
// User profiles // User profiles
l.Page("/user", user.Get) l.Page("/user", user.Get)
l.Page("/user/:nick", profile.Get) l.Page("/user/:nick", profile.Get)
l.Page("/user/:nick/characters/liked", profilecharacters.Liked) // l.Page("/user/:nick/characters/liked", profilecharacters.Liked)
l.Page("/user/:nick/forum/threads", profile.GetThreadsByUser) // l.Page("/user/:nick/forum/threads", profile.GetThreadsByUser)
l.Page("/user/:nick/forum/posts", profile.GetPostsByUser) // l.Page("/user/:nick/forum/posts", profile.GetPostsByUser)
l.Page("/user/:nick/soundtracks/added", profiletracks.Added) // l.Page("/user/:nick/soundtracks/added", profiletracks.Added)
l.Page("/user/:nick/soundtracks/added/from/:index", profiletracks.Added) // l.Page("/user/:nick/soundtracks/added/from/:index", profiletracks.Added)
l.Page("/user/:nick/soundtracks/liked", profiletracks.Liked) // l.Page("/user/:nick/soundtracks/liked", profiletracks.Liked)
l.Page("/user/:nick/soundtracks/liked/from/:index", profiletracks.Liked) // l.Page("/user/:nick/soundtracks/liked/from/:index", profiletracks.Liked)
l.Page("/user/:nick/quotes/added", profilequotes.Added) // l.Page("/user/:nick/quotes/added", profilequotes.Added)
l.Page("/user/:nick/quotes/added/from/:index", profilequotes.Added) // l.Page("/user/:nick/quotes/added/from/:index", profilequotes.Added)
l.Page("/user/:nick/quotes/liked", profilequotes.Liked) // l.Page("/user/:nick/quotes/liked", profilequotes.Liked)
l.Page("/user/:nick/quotes/liked/from/:index", profilequotes.Liked) // l.Page("/user/:nick/quotes/liked/from/:index", profilequotes.Liked)
l.Page("/user/:nick/stats", profile.GetStatsByUser) // l.Page("/user/:nick/stats", profile.GetStatsByUser)
l.Page("/user/:nick/followers", profile.GetFollowers) // l.Page("/user/:nick/followers", profile.GetFollowers)
l.Page("/user/:nick/animelist/anime/:id", animelistitem.Get) l.Page("/user/:nick/animelist/anime/:id", animelistitem.Get)
l.Page("/user/:nick/recommended/anime", recommended.Anime) l.Page("/user/:nick/recommended/anime", recommended.Anime)
l.Page("/user/:nick/notifications", notifications.ByUser) l.Page("/user/:nick/notifications", notifications.ByUser)

View File

@ -1,26 +1,26 @@
package profile package profile
import ( // import (
"net/http" // "net/http"
"github.com/aerogo/aero" // "github.com/aerogo/aero"
"github.com/animenotifier/arn" // "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" // "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" // "github.com/animenotifier/notify.moe/utils"
) // )
// GetFollowers shows the followers of a particular user. // // GetFollowers shows the followers of a particular user.
func GetFollowers(ctx *aero.Context) string { // func GetFollowers(ctx *aero.Context) string {
nick := ctx.Get("nick") // nick := ctx.Get("nick")
viewUser, err := arn.GetUserByNick(nick) // viewUser, err := arn.GetUserByNick(nick)
if err != nil { // if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err) // return ctx.Error(http.StatusNotFound, "User not found", err)
} // }
followers := viewUser.Followers() // followers := viewUser.Followers()
arn.SortUsersLastSeenFirst(followers) // arn.SortUsersLastSeenFirst(followers)
return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.URI())) // return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.URI()))
} // }

View File

@ -1,19 +1,19 @@
component ProfileFollowers(followers []*arn.User, viewUser *arn.User, user *arn.User, uri string) //- component ProfileFollowers(followers []*arn.User, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
if len(followers) > 0 //- if len(followers) > 0
UserGrid(followers) //- UserGrid(followers)
else //- else
p.no-data.mountable= viewUser.Nick + " doesn't have a follower yet." //- p.no-data.mountable= viewUser.Nick + " doesn't have a follower yet."
component UserGrid(users []*arn.User) //- component UserGrid(users []*arn.User)
.user-avatars //- .user-avatars
each user in users //- each user in users
if user.Nick != "" //- if user.Nick != ""
if user.IsActive() //- if user.IsActive()
.mountable //- .mountable
Avatar(user) //- Avatar(user)
else //- else
.mountable //- .mountable
.inactive-user //- .inactive-user
Avatar(user) //- Avatar(user)

View File

@ -1,2 +1,2 @@
.inactive-user // .inactive-user
// opacity 0.25 // // opacity 0.25

View File

@ -1,32 +1,32 @@
package profile package profile
import ( // import (
"net/http" // "net/http"
"github.com/aerogo/aero" // "github.com/aerogo/aero"
"github.com/animenotifier/arn" // "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" // "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" // "github.com/animenotifier/notify.moe/utils"
) // )
const postLimit = 10 // const postLimit = 10
// GetPostsByUser shows all forum posts of a particular user. // // GetPostsByUser shows all forum posts of a particular user.
func GetPostsByUser(ctx *aero.Context) string { // func GetPostsByUser(ctx *aero.Context) string {
nick := ctx.Get("nick") // nick := ctx.Get("nick")
viewUser, err := arn.GetUserByNick(nick) // viewUser, err := arn.GetUserByNick(nick)
if err != nil { // if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err) // return ctx.Error(http.StatusNotFound, "User not found", err)
} // }
posts := viewUser.Posts() // posts := viewUser.Posts()
arn.SortPostsLatestFirst(posts) // arn.SortPostsLatestFirst(posts)
if len(posts) >= postLimit { // if len(posts) >= postLimit {
posts = posts[:postLimit] // posts = posts[:postLimit]
} // }
return ctx.HTML(components.LatestPosts(arn.ToPostables(posts), viewUser, utils.GetUser(ctx), ctx.URI())) // return ctx.HTML(components.LatestPosts(arn.ToPostables(posts), viewUser, utils.GetUser(ctx), ctx.URI()))
} // }

View File

@ -1,14 +1,14 @@
component ProfileForumTabs(viewUser *arn.User) //- component ProfileForumTabs(viewUser *arn.User)
.tabs //- .tabs
Tab("Threads", "list", "/+" + viewUser.Nick + "/forum/threads") //- Tab("Threads", "list", "/+" + viewUser.Nick + "/forum/threads")
Tab("Posts", "comments", "/+" + viewUser.Nick + "/forum/posts") //- Tab("Posts", "comments", "/+" + viewUser.Nick + "/forum/posts")
component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User, uri string) //- component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
ProfileForumTabs(viewUser) //- ProfileForumTabs(viewUser)
if len(postables) > 0 //- if len(postables) > 0
h1.page-title= len(postables), " latest posts by ", postables[0].Creator().Nick //- h1.page-title= len(postables), " latest posts by ", postables[0].Creator().Nick
PostableList(postables, user) //- PostableList(postables, user)
else //- else
p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet." //- p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet."

View File

@ -38,7 +38,8 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
animeList = animeList.WithoutPrivateItems() animeList = animeList.WithoutPrivateItems()
} }
animeList.SortByRating() completedList := animeList.FilterStatus(arn.AnimeListStatusCompleted)
completedList.SortByRating()
// Genres // Genres
topGenres := animeList.TopGenres(5) topGenres := animeList.TopGenres(5)
@ -127,5 +128,5 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
} }
ctx.Data = openGraph ctx.Data = openGraph
return ctx.HTML(components.Profile(viewUser, user, animeList, characters, friends, topGenres, dayToActivityCount, ctx.URI())) return ctx.HTML(components.Profile(viewUser, user, animeList, completedList, characters, friends, topGenres, dayToActivityCount, ctx.URI()))
} }

View File

@ -1,6 +1,6 @@
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, characters []*arn.Character, friends []*arn.User, topGenres []string, dayToActivityCount map[int]int, uri string) component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, completedList *arn.AnimeList, characters []*arn.Character, friends []*arn.User, topGenres []string, dayToActivityCount map[int]int, uri string)
.profile .profile
ProfileHeader(viewUser, user, uri) ProfileHeader(viewUser, animeList, user, uri)
.profile-columns .profile-columns
//- Favorites //- Favorites
@ -9,11 +9,11 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
.profile-section .profile-section
h3.profile-column-header.mountable(data-mountable-type="favorites") Anime h3.profile-column-header.mountable(data-mountable-type="favorites") Anime
if len(animeList.Items) == 0 if len(completedList.Items) == 0
p.no-data.mountable(data-mountable-type="favorites") Nothing here yet. p.no-data.mountable(data-mountable-type="favorites") Nothing here yet.
else else
.profile-favorite-anime-container.mountable(data-mountable-type="favorites") .profile-favorite-anime-container.mountable(data-mountable-type="favorites")
each item in animeList.Top(6) each item in completedList.Top(6)
a.profile-favorite-anime.tip.mountable(href=item.Anime().Link(), aria-label=item.Anime().Title.ByUser(user), data-mountable-type="anime") a.profile-favorite-anime.tip.mountable(href=item.Anime().Link(), aria-label=item.Anime().Title.ByUser(user), data-mountable-type="anime")
img.profile-favorite-anime-image.lazy(data-src=item.Anime().ImageLink("small"), data-webp=true, alt=item.Anime().Title.ByUser(user)) img.profile-favorite-anime-image.lazy(data-src=item.Anime().ImageLink("small"), data-webp=true, alt=item.Anime().Title.ByUser(user))
@ -77,10 +77,10 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
if day == 2 if day == 2
.spacer-box .spacer-box
component ProfileHeader(viewUser *arn.User, user *arn.User, uri string) component ProfileHeader(viewUser *arn.User, animeList *arn.AnimeList, user *arn.User, uri string)
ProfileHead(viewUser, user, uri) ProfileHead(viewUser, animeList, user, uri)
component ProfileHead(viewUser *arn.User, user *arn.User, uri string) component ProfileHead(viewUser *arn.User, animeList *arn.AnimeList, user *arn.User, uri string)
.profile-head .profile-head
img.profile-cover.lazy(data-src=viewUser.CoverLink("large"), data-webp="true", alt="Cover image") img.profile-cover.lazy(data-src=viewUser.CoverLink("large"), data-webp="true", alt="Cover image")
@ -95,7 +95,7 @@ component ProfileHead(viewUser *arn.User, user *arn.User, uri string)
.profile-tags .profile-tags
a.profile-tag.mountable.never-unmount(href="/+" + viewUser.Nick + "/animelist/watching", data-mountable-type="header") a.profile-tag.mountable.never-unmount(href="/+" + viewUser.Nick + "/animelist/watching", data-mountable-type="header")
Icon("list") Icon("list")
span= fmt.Sprintf("%d anime", len(viewUser.AnimeList().Items)) span= fmt.Sprintf("%d anime", len(animeList.Items))
if user != nil && viewUser.Settings().Privacy.ShowAge && viewUser.Settings().Privacy.ShowGender && viewUser.AgeInYears() != 0 if user != nil && viewUser.Settings().Privacy.ShowAge && viewUser.Settings().Privacy.ShowGender && viewUser.AgeInYears() != 0
.profile-tag.mountable.never-unmount(data-mountable-type="header") .profile-tag.mountable.never-unmount(data-mountable-type="header")

View File

@ -1,11 +1,10 @@
component ProfileCharacters(characters []*arn.Character, viewUser *arn.User, user *arn.User, uri string) //- component ProfileCharacters(characters []*arn.Character, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
if len(characters) == 0
p.no-data.mountable= viewUser.Nick + " hasn't liked any characters yet."
else
.characters.profile-characters
each character in characters
.mountable
Character(character, user)
//- if len(characters) == 0
//- p.no-data.mountable= viewUser.Nick + " hasn't liked any characters yet."
//- else
//- .characters.profile-characters
//- each character in characters
//- .mountable
//- Character(character, user)

View File

@ -1,2 +1,2 @@
.profile-characters // .profile-characters
justify-content center // justify-content center

View File

@ -1,21 +1,21 @@
component ProfileQuotes(quotes []*arn.Quote, viewUser *arn.User, nextIndex int, user *arn.User, uri string) //- component ProfileQuotes(quotes []*arn.Quote, viewUser *arn.User, nextIndex int, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
if strings.Contains(uri, "/added") //- if strings.Contains(uri, "/added")
h1.page-title= "Quotes added by " + viewUser.Nick //- h1.page-title= "Quotes added by " + viewUser.Nick
else //- else
h1.page-title= "Quotes liked by " + viewUser.Nick //- h1.page-title= "Quotes liked by " + viewUser.Nick
if len(quotes) == 0 //- if len(quotes) == 0
if strings.Contains(uri, "/added") //- if strings.Contains(uri, "/added")
p.no-data.mountable= viewUser.Nick + " hasn't added any quotes yet." //- p.no-data.mountable= viewUser.Nick + " hasn't added any quotes yet."
else //- else
p.no-data.mountable= viewUser.Nick + " hasn't liked any quotes yet." //- p.no-data.mountable= viewUser.Nick + " hasn't liked any quotes yet."
else //- else
#load-more-target.quotes //- #load-more-target.quotes
QuotesScrollable(quotes, user) //- QuotesScrollable(quotes, user)
if nextIndex != -1 //- if nextIndex != -1
.buttons //- .buttons
LoadMore(nextIndex) //- LoadMore(nextIndex)

View File

@ -1,21 +1,21 @@
component ProfileSoundTracks(tracks []*arn.SoundTrack, viewUser *arn.User, nextIndex int, user *arn.User, uri string) //- component ProfileSoundTracks(tracks []*arn.SoundTrack, viewUser *arn.User, nextIndex int, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
if strings.Contains(uri, "/added") //- if strings.Contains(uri, "/added")
h1.page-title= "Tracks added by " + viewUser.Nick //- h1.page-title= "Tracks added by " + viewUser.Nick
else //- else
h1.page-title= "Tracks liked by " + viewUser.Nick //- h1.page-title= "Tracks liked by " + viewUser.Nick
if len(tracks) == 0 //- if len(tracks) == 0
if strings.Contains(uri, "/added") //- if strings.Contains(uri, "/added")
p.no-data.mountable= viewUser.Nick + " hasn't added any tracks yet." //- p.no-data.mountable= viewUser.Nick + " hasn't added any tracks yet."
else //- else
p.no-data.mountable= viewUser.Nick + " hasn't liked any tracks yet." //- p.no-data.mountable= viewUser.Nick + " hasn't liked any tracks yet."
else //- else
#load-more-target.soundtracks //- #load-more-target.soundtracks
SoundTracksScrollable(tracks, user) //- SoundTracksScrollable(tracks, user)
if nextIndex != -1 //- if nextIndex != -1
.buttons //- .buttons
LoadMore(nextIndex) //- LoadMore(nextIndex)

View File

@ -1,102 +1,102 @@
package profile package profile
import ( // import (
"net/http" // "net/http"
"strconv" // "strconv"
"strings" // "strings"
"time" // "time"
"github.com/aerogo/aero" // "github.com/aerogo/aero"
"github.com/animenotifier/arn" // "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" // "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" // "github.com/animenotifier/notify.moe/utils"
) // )
type stats map[string]float64 // type stats map[string]float64
// GetStatsByUser shows statistics for a given user. // // GetStatsByUser shows statistics for a given user.
func GetStatsByUser(ctx *aero.Context) string { // func GetStatsByUser(ctx *aero.Context) string {
nick := ctx.Get("nick") // nick := ctx.Get("nick")
viewUser, err := arn.GetUserByNick(nick) // viewUser, err := arn.GetUserByNick(nick)
userStats := utils.UserStats{} // userStats := utils.UserStats{}
ratings := stats{} // ratings := stats{}
status := stats{} // status := stats{}
types := stats{} // types := stats{}
years := stats{} // years := stats{}
studios := stats{} // studios := stats{}
genres := stats{} // genres := stats{}
trackTags := stats{} // trackTags := stats{}
if err != nil { // if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err) // return ctx.Error(http.StatusNotFound, "User not found", err)
} // }
animeList, err := arn.GetAnimeList(viewUser.ID) // animeList, err := arn.GetAnimeList(viewUser.ID)
if err != nil { // if err != nil {
return ctx.Error(http.StatusInternalServerError, "Anime list not found", err) // return ctx.Error(http.StatusInternalServerError, "Anime list not found", err)
} // }
animeList.Lock() // animeList.Lock()
defer animeList.Unlock() // defer animeList.Unlock()
for _, item := range animeList.Items { // for _, item := range animeList.Items {
status[item.Status]++ // status[item.Status]++
if item.Status == arn.AnimeListStatusPlanned { // if item.Status == arn.AnimeListStatusPlanned {
continue // continue
} // }
currentWatch := item.Episodes * item.Anime().EpisodeLength // currentWatch := item.Episodes * item.Anime().EpisodeLength
reWatch := item.RewatchCount * item.Anime().EpisodeCount * item.Anime().EpisodeLength // reWatch := item.RewatchCount * item.Anime().EpisodeCount * item.Anime().EpisodeLength
duration := time.Duration(currentWatch + reWatch) // duration := time.Duration(currentWatch + reWatch)
userStats.AnimeWatchingTime += duration * time.Minute // userStats.AnimeWatchingTime += duration * time.Minute
ratings[strconv.Itoa(int(item.Rating.Overall+0.5))]++ // ratings[strconv.Itoa(int(item.Rating.Overall+0.5))]++
types[item.Anime().Type]++ // types[item.Anime().Type]++
for _, studio := range item.Anime().Studios() { // for _, studio := range item.Anime().Studios() {
studios[studio.Name.English]++ // studios[studio.Name.English]++
} // }
for _, genre := range item.Anime().Genres { // for _, genre := range item.Anime().Genres {
genres[genre]++ // genres[genre]++
} // }
if item.Anime().StartDate != "" { // if item.Anime().StartDate != "" {
year := item.Anime().StartDate[:4] // year := item.Anime().StartDate[:4]
if year < "2000" { // if year < "2000" {
year = "Before 2000" // year = "Before 2000"
} // }
years[year]++ // years[year]++
} // }
} // }
for track := range arn.StreamSoundTracks() { // for track := range arn.StreamSoundTracks() {
if !track.LikedBy(viewUser.ID) { // if !track.LikedBy(viewUser.ID) {
continue // continue
} // }
for _, tag := range track.Tags { // for _, tag := range track.Tags {
if strings.Contains(tag, ":") { // if strings.Contains(tag, ":") {
continue // continue
} // }
trackTags[tag]++ // trackTags[tag]++
} // }
} // }
userStats.PieCharts = []*arn.PieChart{ // userStats.PieCharts = []*arn.PieChart{
arn.NewPieChart("Genres", genres), // arn.NewPieChart("Genres", genres),
arn.NewPieChart("Studios", studios), // arn.NewPieChart("Studios", studios),
arn.NewPieChart("Years", years), // arn.NewPieChart("Years", years),
arn.NewPieChart("Ratings", ratings), // arn.NewPieChart("Ratings", ratings),
arn.NewPieChart("Types", types), // arn.NewPieChart("Types", types),
arn.NewPieChart("Status", status), // arn.NewPieChart("Status", status),
arn.NewPieChart("Soundtracks", trackTags), // arn.NewPieChart("Soundtracks", trackTags),
} // }
return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.URI())) // return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.URI()))
} // }

View File

@ -1,15 +1,15 @@
component ProfileStats(stats *utils.UserStats, viewUser *arn.User, user *arn.User, uri string) //- component ProfileStats(stats *utils.UserStats, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
.stats //- .stats
each pie in stats.PieCharts //- each pie in stats.PieCharts
.widget.mountable //- .widget.mountable
h3.widget-title //- h3.widget-title
Icon("pie-chart") //- Icon("pie-chart")
span= pie.Title //- span= pie.Title
PieChart(pie.Slices) //- PieChart(pie.Slices)
.footer.mountable //- .footer.mountable
span= viewUser.Nick + " spent " //- span= viewUser.Nick + " spent "
span= int(stats.AnimeWatchingTime / time.Hour / 24) //- span= int(stats.AnimeWatchingTime / time.Hour / 24)
span days watching anime. //- span days watching anime.

View File

@ -1,7 +1,7 @@
.stats // .stats
horizontal-wrap // horizontal-wrap
justify-content space-around // justify-content space-around
.widget // .widget
min-width 200px // min-width 200px
max-width 300px // max-width 300px

View File

@ -1,31 +1,31 @@
package profile package profile
import ( // import (
"net/http" // "net/http"
"github.com/aerogo/aero" // "github.com/aerogo/aero"
"github.com/animenotifier/arn" // "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" // "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" // "github.com/animenotifier/notify.moe/utils"
) // )
const maxThreads = 20 // const maxThreads = 20
// GetThreadsByUser shows all forum threads of a particular user. // // GetThreadsByUser shows all forum threads of a particular user.
func GetThreadsByUser(ctx *aero.Context) string { // func GetThreadsByUser(ctx *aero.Context) string {
nick := ctx.Get("nick") // nick := ctx.Get("nick")
viewUser, err := arn.GetUserByNick(nick) // viewUser, err := arn.GetUserByNick(nick)
if err != nil { // if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err) // return ctx.Error(http.StatusNotFound, "User not found", err)
} // }
threads := viewUser.Threads() // threads := viewUser.Threads()
arn.SortThreadsLatestFirst(threads) // arn.SortThreadsLatestFirst(threads)
if len(threads) > maxThreads { // if len(threads) > maxThreads {
threads = threads[:maxThreads] // threads = threads[:maxThreads]
} // }
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx), ctx.URI())) // return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx), ctx.URI()))
} // }

View File

@ -1,9 +1,9 @@
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string) //- component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) //- ProfileHeader(viewUser, user, uri)
ProfileForumTabs(viewUser) //- ProfileForumTabs(viewUser)
if len(threads) == 0 //- if len(threads) == 0
p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet." //- p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet."
else //- else
.forum //- .forum
ThreadList(threads) //- ThreadList(threads)

View File

@ -1,15 +1,15 @@
.profile-watching-list // .profile-watching-list
horizontal-wrap // horizontal-wrap
justify-content center // justify-content center
// CSS grid variant: // // CSS grid variant:
// display grid // // display grid
// grid-gap 0.5rem // // grid-gap 0.5rem
// grid-template-columns repeat(auto-fill, 55px) // // grid-template-columns repeat(auto-fill, 55px)
// justify-content center // // justify-content center
.profile-watching-list-item // .profile-watching-list-item
anime-mini-item // anime-mini-item
.profile-watching-list-item-image // .profile-watching-list-item-image
anime-mini-item-image // anime-mini-item-image