mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 02:24:31 +00:00
Update navbar, add avatar
This commit is contained in:
parent
88fc867c07
commit
19abf1b4dc
15 changed files with 46 additions and 1 deletions
8
resources/assets/js/app.js
vendored
8
resources/assets/js/app.js
vendored
|
@ -200,6 +200,14 @@ window.App.util = {
|
||||||
|
|
||||||
clipboard: (function(data) {
|
clipboard: (function(data) {
|
||||||
return navigator.clipboard.writeText(data);
|
return navigator.clipboard.writeText(data);
|
||||||
|
}),
|
||||||
|
|
||||||
|
navatar: (function() {
|
||||||
|
$('#navbarDropdown .far').addClass('d-none');
|
||||||
|
$('#navbarDropdown img').attr('src',window._sharedData.curUser.avatar)
|
||||||
|
.removeClass('d-none')
|
||||||
|
.addClass('rounded-circle border shadow')
|
||||||
|
.attr('width', 34).attr('height', 34);
|
||||||
})
|
})
|
||||||
|
|
||||||
};
|
};
|
|
@ -130,6 +130,10 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchNotifications() {
|
fetchNotifications() {
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
axios.get('/api/pixelfed/v1/notifications', {
|
axios.get('/api/pixelfed/v1/notifications', {
|
||||||
params: {
|
params: {
|
||||||
pg: true
|
pg: true
|
||||||
|
|
|
@ -191,6 +191,8 @@ export default {
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.currentUser = res.data;
|
this.currentUser = res.data;
|
||||||
this.owner = this.currentUser.id == this.profileId;
|
this.owner = this.currentUser.id == this.profileId;
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -145,6 +145,10 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchRecentPosts();
|
this.fetchRecentPosts();
|
||||||
this.fetchItems();
|
this.fetchItems();
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addToIds(id) {
|
addToIds(id) {
|
||||||
|
|
|
@ -246,6 +246,7 @@ export default {
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
window._sharedData.curUser = res.data;
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,7 @@
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
window._sharedData.curUser = res.data;
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,10 @@
|
||||||
this.posts = res.data.posts;
|
this.posts = res.data.posts;
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
});
|
});
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchCategories() {
|
fetchCategories() {
|
||||||
|
|
|
@ -123,6 +123,12 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getResults() {
|
getResults() {
|
||||||
|
if(this.authenticated) {
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
|
}
|
||||||
axios.get('/api/v2/discover/tag', {
|
axios.get('/api/v2/discover/tag', {
|
||||||
params: {
|
params: {
|
||||||
hashtag: this.hashtag,
|
hashtag: this.hashtag,
|
||||||
|
|
|
@ -841,6 +841,7 @@ export default {
|
||||||
self.status = response.data.status;
|
self.status = response.data.status;
|
||||||
self.user = response.data.user;
|
self.user = response.data.user;
|
||||||
window._sharedData.curUser = self.user;
|
window._sharedData.curUser = self.user;
|
||||||
|
window.App.util.navatar();
|
||||||
self.media = self.status.media_attachments;
|
self.media = self.status.media_attachments;
|
||||||
self.reactions = response.data.reactions;
|
self.reactions = response.data.reactions;
|
||||||
self.likes = response.data.likes;
|
self.likes = response.data.likes;
|
||||||
|
|
|
@ -705,6 +705,8 @@
|
||||||
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.user = res.data;
|
this.user = res.data;
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
if(res.data.id == this.profileId || this.relationship.following == true) {
|
if(res.data.id == this.profileId || this.relationship.following == true) {
|
||||||
axios.get('/api/stories/v0/exists/' + this.profileId)
|
axios.get('/api/stories/v0/exists/' + this.profileId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
@ -526,6 +526,10 @@ export default {
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
swal('Oops!', 'An error occured, please try refreshing the page.', 'error');
|
swal('Oops!', 'An error occured, please try refreshing the page.', 'error');
|
||||||
});
|
});
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
likesModal() {
|
likesModal() {
|
||||||
|
|
|
@ -220,6 +220,8 @@
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.user = res.data
|
this.user = res.data
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
});
|
});
|
||||||
axios.get('/api/pixelfed/v1/accounts/' + this.profileId)
|
axios.get('/api/pixelfed/v1/accounts/' + this.profileId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
@ -361,6 +361,10 @@ export default {
|
||||||
let lexer = this.searchLexer();
|
let lexer = this.searchLexer();
|
||||||
this.analysis = lexer;
|
this.analysis = lexer;
|
||||||
this.fetchSearchResults();
|
this.fetchSearchResults();
|
||||||
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchSearchResults() {
|
fetchSearchResults() {
|
||||||
|
|
|
@ -781,6 +781,7 @@
|
||||||
this.modes.mod = true;
|
this.modes.mod = true;
|
||||||
}
|
}
|
||||||
window._sharedData.curUser = res.data;
|
window._sharedData.curUser = res.data;
|
||||||
|
window.App.util.navatar();
|
||||||
this.hasStory();
|
this.hasStory();
|
||||||
// this.expRec();
|
// this.expRec();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav align-items-center">
|
||||||
<li class="nav-item px-md-2 d-none d-md-block">
|
<li class="nav-item px-md-2 d-none d-md-block">
|
||||||
<a class="nav-link font-weight-bold text-muted" href="{{route('discover')}}" title="Discover" data-toggle="tooltip" data-placement="bottom">
|
<a class="nav-link font-weight-bold text-muted" href="{{route('discover')}}" title="Discover" data-toggle="tooltip" data-placement="bottom">
|
||||||
<i class="far fa-compass fa-lg"></i>
|
<i class="far fa-compass fa-lg"></i>
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="User Menu" data-toggle="tooltip" data-placement="bottom">
|
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="User Menu" data-toggle="tooltip" data-placement="bottom">
|
||||||
<i class="far fa-user fa-lg text-muted"></i>
|
<i class="far fa-user fa-lg text-muted"></i>
|
||||||
<span class="sr-only">User Menu</span>
|
<span class="sr-only">User Menu</span>
|
||||||
|
<img class="d-none" src="/storage/avatars/default.png?v=0" class="rounded-circle border shadow" width="34" height="34" onerror="this.onerror=null;this.src='/storage/avatars/default.png?v=0';">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
|
|
Loading…
Reference in a new issue