diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 8b0c0e115..e3c4253fb 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -859,7 +859,9 @@ export default { } } this.loaded = true; - this.fetchProfilePosts(); + setTimeout(function() { + self.fetchProfilePosts(); + }, 3000); setTimeout(function() { document.querySelectorAll('.status-comment .comment-text a').forEach(function(i, e) { if(i.href.startsWith(window.location.origin)) { @@ -947,12 +949,16 @@ export default { } else { this.reactions.liked = true; let user = this.user; - this.likes.push(user); + this.likes.unshift(user); + setTimeout(function() { + event.target.classList.add('animate__animated', 'animate__bounce'); + },100); } }).catch(err => { console.error(err); swal('Error', 'Something went wrong, please try again later.', 'error'); }); + window.navigator.vibrate(200); }, shareStatus() { @@ -1383,6 +1389,9 @@ export default { }, fetchProfilePosts() { + if(!$('body').hasClass('loggedIn') && this.loaded) { + return; + } let self = this; let apiUrl = '/api/pixelfed/v1/accounts/' + this.statusProfileId + '/statuses'; axios.get(apiUrl, { @@ -1426,6 +1435,9 @@ export default { }, showTaggedPeopleModal() { + if(!$('body').hasClass('loggedIn') && this.loaded) { + return; + } this.$refs.taggedModal.show(); }, diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index 12d11b2c0..62328c6eb 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -11,10 +11,57 @@
Showing results for {{query}}
+PLACES ({{results.placesPagination.total}})
++ {{hashtag.value}} +
++ + Previous + + + Previous + + + {{placesCursor}}/{{results.placesPagination.last_page}} + + + Next + + + Next + +
+HASHTAGS ({{results.hashtags.length}})
@@ -284,7 +331,8 @@ export default { results: { hashtags: [], profiles: [], - statuses: [] + statuses: [], + places: [], }, filters: { hashtags: true, @@ -292,6 +340,10 @@ export default { statuses: true }, analysis: 'profile', + showPlaces: false, + placesCursor: 1, + placesCache: [], + placesSearchEnabled: false } }, beforeMount() { @@ -300,6 +352,9 @@ export default { mounted() { $('.search-bar input').val(this.query); }, + updated() { + $('[data-toggle="tooltip"]').tooltip(); + }, methods: { bootSearch() { let lexer = this.searchLexer(); @@ -388,7 +443,7 @@ export default { params: { 'q': this.query, 'src': 'metro', - 'v': 1, + 'v': 2, 'scope': 'all' } }).then(res => { @@ -396,6 +451,9 @@ export default { this.results.hashtags = results.hashtags ? results.hashtags : []; this.results.profiles = results.profiles ? results.profiles : []; this.results.statuses = results.posts ? results.posts : []; + this.results.places = results.places ? results.places : []; + this.placesCache = results.places; + this.results.placesPagination = results.placesPagination ? results.placesPagination : []; this.loading = false; }).catch(err => { this.loading = false; @@ -500,6 +558,50 @@ export default { this.networkError = true; break; } + }, + + placesPrevPage() { + this.placesCursor--; + if(this.placesCursor == 1) { + this.results.places = this.placesCache.slice(0, 20); + return; + } + let plc = this.placesCursor * 20; + this.results.places = this.placesCache.slice(plc, 20); + return; + }, + + placesNextPage() { + this.placesCursor++; + let plc = this.placesCursor * 20; + if(this.placesCache.length > 20) { + this.results.places = this.placesCache.slice(this.placesCursor == 1 ? 0 : plc, 20); + return; + } + axios.get('/api/search', { + params: { + 'q': this.query, + 'src': 'metro', + 'v': 2, + 'scope': 'all', + 'page': this.placesCursor + } + }).then(res => { + let results = res.data; + this.results.places = results.places ? results.places : []; + this.placesCache.push(...results.places); + this.loading = false; + }).catch(err => { + this.loading = false; + console.log(err); + this.networkError = true; + }); + + }, + + formatCount(num) { + let count = window.App.util.format.count(num); + return count; } } diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 6760f3359..cef317ce2 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -162,7 +162,8 @@{{s.favourites_count == 1 ? '1 like' : s.favourites_count+' likes'}} - +