Improved search responsiveness
This commit is contained in:
parent
2aec328e9c
commit
20981234f6
@ -7,76 +7,90 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
Icon("tv")
|
Icon("tv")
|
||||||
span Anime
|
span Anime
|
||||||
|
|
||||||
.profile-watching-list.anime-search
|
AnimeSearchResults(animes)
|
||||||
if len(animes) == 0
|
|
||||||
p.no-search-results.mountable No anime found.
|
|
||||||
else
|
|
||||||
each anime in animes
|
|
||||||
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
|
||||||
img.anime-cover-image.anime-search-result.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.Canonical)
|
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("user")
|
Icon("user")
|
||||||
span Characters
|
span Characters
|
||||||
|
|
||||||
.character-search
|
CharacterSearchResults(characters)
|
||||||
if len(characters) == 0
|
|
||||||
p.no-search-results.mountable No characters found.
|
|
||||||
else
|
|
||||||
each character in characters
|
|
||||||
.mountable(data-mountable-type="character")
|
|
||||||
CharacterSmall(character)
|
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("comment")
|
Icon("comment")
|
||||||
span Forum
|
span Forum
|
||||||
|
|
||||||
if len(posts) == 0 && len(threads) == 0
|
ForumSearchResults(posts, threads)
|
||||||
p.no-search-results.mountable No posts found.
|
|
||||||
else
|
|
||||||
.forum-search-results
|
|
||||||
each thread in threads
|
|
||||||
.forum-search-result.mountable(data-mountable-type="forum")
|
|
||||||
.forum-search-result-header
|
|
||||||
a.forum-search-result-title.ajax(href=thread.Link())= thread.Title
|
|
||||||
if thread.Author().HasNick()
|
|
||||||
.forum-search-result-author= thread.Author().Nick
|
|
||||||
.forum-search-result-sample= thread.Text
|
|
||||||
|
|
||||||
each post in posts
|
|
||||||
.forum-search-result.mountable(data-mountable-type="forum")
|
|
||||||
.forum-search-result-header
|
|
||||||
a.forum-search-result-title.ajax(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
|
|
||||||
if post.Author().HasNick()
|
|
||||||
.forum-search-result-author= post.Author().Nick
|
|
||||||
.forum-search-result-sample= post.Text
|
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("music")
|
Icon("music")
|
||||||
span Soundtracks
|
span Soundtracks
|
||||||
|
|
||||||
if len(tracks) == 0
|
SoundTrackSearchResults(tracks)
|
||||||
p.no-search-results.mountable No soundtracks found.
|
|
||||||
else
|
|
||||||
ul.soundtrack-search
|
|
||||||
each track in tracks
|
|
||||||
li.mountable(data-mountable-type="track")
|
|
||||||
a.ajax(href=track.Link())= track.Title
|
|
||||||
|
|
||||||
.widget
|
.widget
|
||||||
h3.widget-title
|
h3.widget-title
|
||||||
Icon("user")
|
Icon("user")
|
||||||
span Users
|
span Users
|
||||||
|
|
||||||
.user-avatars.user-search
|
UserSearchResults(users)
|
||||||
if len(users) == 0
|
|
||||||
p.no-search-results.mountable No users found.
|
component AnimeSearchResults(animes []*arn.Anime)
|
||||||
else
|
if len(animes) == 0
|
||||||
each user in users
|
p.no-search-results.mountable No anime found.
|
||||||
.mountable(data-mountable-type="user")
|
else
|
||||||
Avatar(user)
|
.profile-watching-list.anime-search
|
||||||
//- a.ajax(href=user.Link())= user.Nick
|
each anime in animes
|
||||||
|
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
||||||
|
img.anime-cover-image.anime-search-result.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.Canonical)
|
||||||
|
|
||||||
|
component CharacterSearchResults(characters []*arn.Character)
|
||||||
|
if len(characters) == 0
|
||||||
|
p.no-search-results.mountable No characters found.
|
||||||
|
else
|
||||||
|
.character-search
|
||||||
|
each character in characters
|
||||||
|
.mountable(data-mountable-type="character")
|
||||||
|
CharacterSmall(character)
|
||||||
|
|
||||||
|
component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread)
|
||||||
|
if len(posts) == 0 && len(threads) == 0
|
||||||
|
p.no-search-results.mountable No posts found.
|
||||||
|
else
|
||||||
|
.forum-search-results
|
||||||
|
each thread in threads
|
||||||
|
.forum-search-result.mountable(data-mountable-type="forum")
|
||||||
|
.forum-search-result-header
|
||||||
|
a.forum-search-result-title.ajax(href=thread.Link())= thread.Title
|
||||||
|
if thread.Author().HasNick()
|
||||||
|
.forum-search-result-author= thread.Author().Nick
|
||||||
|
.forum-search-result-sample= thread.Text
|
||||||
|
|
||||||
|
each post in posts
|
||||||
|
.forum-search-result.mountable(data-mountable-type="forum")
|
||||||
|
.forum-search-result-header
|
||||||
|
a.forum-search-result-title.ajax(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
|
||||||
|
if post.Author().HasNick()
|
||||||
|
.forum-search-result-author= post.Author().Nick
|
||||||
|
.forum-search-result-sample= post.Text
|
||||||
|
|
||||||
|
component SoundTrackSearchResults(tracks []*arn.SoundTrack)
|
||||||
|
if len(tracks) == 0
|
||||||
|
p.no-search-results.mountable No soundtracks found.
|
||||||
|
else
|
||||||
|
ul.soundtrack-search
|
||||||
|
each track in tracks
|
||||||
|
li.mountable(data-mountable-type="track")
|
||||||
|
a.ajax(href=track.Link())= track.Title
|
||||||
|
|
||||||
|
component UserSearchResults(users []*arn.User)
|
||||||
|
if len(users) == 0
|
||||||
|
p.no-search-results.mountable No users found.
|
||||||
|
else
|
||||||
|
.user-avatars.user-search
|
||||||
|
each user in users
|
||||||
|
.mountable(data-mountable-type="user")
|
||||||
|
Avatar(user)
|
||||||
|
|
@ -671,11 +671,12 @@ export class AnimeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let path = "/_" + url
|
let path = "/_" + url
|
||||||
|
let request = this.app.get(path)
|
||||||
|
|
||||||
let request = fetch(path, {
|
// let request = fetch(path, {
|
||||||
credentials: "same-origin"
|
// credentials: "same-origin"
|
||||||
})
|
// })
|
||||||
.then(response => response.text())
|
// .then(response => response.text())
|
||||||
|
|
||||||
history.pushState(url, null, url)
|
history.pushState(url, null, url)
|
||||||
this.app.currentPath = url
|
this.app.currentPath = url
|
||||||
|
Loading…
Reference in New Issue
Block a user