mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added habitica event for profile display (#9576)
This commit is contained in:
@@ -478,10 +478,10 @@ export default {
|
|||||||
|
|
||||||
// Open the modal only if the data is available
|
// Open the modal only if the data is available
|
||||||
if (profile && !profile.rejected) {
|
if (profile && !profile.rejected) {
|
||||||
// @TODO move to action or anyway move from here because it's super duplicate
|
this.$root.$emit('habitica:show-profile', {
|
||||||
this.$store.state.profileUser = profile;
|
user: profile,
|
||||||
this.$store.state.profileOptions.startingPage = 'profile';
|
startingPage: 'profile',
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -869,9 +869,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async showMemberProfile (leader) {
|
async showMemberProfile (leader) {
|
||||||
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: leader._id });
|
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: leader._id });
|
||||||
this.$store.state.profileUser = heroDetails.data.data;
|
this.$root.$emit('habitica:show-profile', {
|
||||||
this.$store.state.profileOptions.startingPage = 'profile';
|
user: heroDetails.data.data,
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
startingPage: 'profile',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
async questAbort () {
|
async questAbort () {
|
||||||
if (!confirm(this.$t('sureAbort'))) return;
|
if (!confirm(this.$t('sureAbort'))) return;
|
||||||
|
|||||||
@@ -199,9 +199,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async clickMember (hero) {
|
async clickMember (hero) {
|
||||||
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: hero._id });
|
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: hero._id });
|
||||||
this.$store.state.profileUser = heroDetails.data.data;
|
this.$root.$emit('habitica:show-profile', {
|
||||||
this.$store.state.profileOptions.startingPage = 'profile';
|
user: heroDetails.data.data,
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
startingPage: 'profile',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
userLevelStyle () {
|
userLevelStyle () {
|
||||||
// @TODO: implement
|
// @TODO: implement
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ menu-dropdown.item-notifications(:right="true")
|
|||||||
button.btn.btn-primary(@click.stop='accept(guild, index, "guild")') Accept
|
button.btn.btn-primary(@click.stop='accept(guild, index, "guild")') Accept
|
||||||
button.btn.btn-primary(@click.stop='reject(guild, index, "guild")') Reject
|
button.btn.btn-primary(@click.stop='reject(guild, index, "guild")') Reject
|
||||||
a.dropdown-item(v-if='user.flags.classSelected && !user.preferences.disableClasses && user.stats.points',
|
a.dropdown-item(v-if='user.flags.classSelected && !user.preferences.disableClasses && user.stats.points',
|
||||||
@click='go("/user/profile")')
|
@click='showProfile()')
|
||||||
span.glyphicon.glyphicon-plus-sign
|
span.glyphicon.glyphicon-plus-sign
|
||||||
span {{ $t('haveUnallocated', {points: user.stats.points}) }}
|
span {{ $t('haveUnallocated', {points: user.stats.points}) }}
|
||||||
a.dropdown-item(v-for='message in userNewMessages')
|
a.dropdown-item(v-for='message in userNewMessages')
|
||||||
@@ -279,6 +279,12 @@ export default {
|
|||||||
let quest = await this.$store.dispatch('quests:sendAction', {groupId: partyId, action: 'quests/reject'});
|
let quest = await this.$store.dispatch('quests:sendAction', {groupId: partyId, action: 'quests/reject'});
|
||||||
this.user.party.quest = quest;
|
this.user.party.quest = quest;
|
||||||
},
|
},
|
||||||
|
showProfile () {
|
||||||
|
this.$root.$emit('habitica:show-profile', {
|
||||||
|
user: this.user,
|
||||||
|
startingPage: 'stats',
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -98,9 +98,10 @@ export default {
|
|||||||
this.$root.$emit('bv::show::modal', 'inbox-modal');
|
this.$root.$emit('bv::show::modal', 'inbox-modal');
|
||||||
},
|
},
|
||||||
showProfile (startingPage) {
|
showProfile (startingPage) {
|
||||||
this.$store.state.profileUser = this.user;
|
this.$root.$emit('habitica:show-profile', {
|
||||||
this.$store.state.profileOptions.startingPage = startingPage;
|
user: this.user,
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
startingPage,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
showBuyGemsModal (startingPage) {
|
showBuyGemsModal (startingPage) {
|
||||||
this.$store.state.gemModalOptions.startingPage = startingPage;
|
this.$store.state.gemModalOptions.startingPage = startingPage;
|
||||||
|
|||||||
@@ -245,9 +245,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
percent,
|
percent,
|
||||||
showMemberModal (member) {
|
showMemberModal (member) {
|
||||||
this.$store.state.profileUser = member;
|
this.$root.$emit('habitica:show-profile', {
|
||||||
this.$store.state.profileOptions.startingPage = 'profile';
|
user: member,
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
startingPage: 'profile',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -631,6 +631,18 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$root.$on('habitica:show-profile', (data) => {
|
||||||
|
if (!data.user || !data.startingPage) return;
|
||||||
|
// @TODO: We may be able to remove the need for store
|
||||||
|
this.$store.state.profileUser = data.user;
|
||||||
|
this.$store.state.profileOptions.startingPage = data.startingPage;
|
||||||
|
this.$root.$emit('bv::show::modal', 'profile');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
this.$root.$off('habitica:show-profile');
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
userLoggedIn: 'user.data',
|
userLoggedIn: 'user.data',
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ export default {
|
|||||||
profile,
|
profile,
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$store.state.profileUser = {};
|
// @TODO: Do we need this page?
|
||||||
this.$root.$emit('bv::show::modal', 'profile');
|
this.$root.$emit('habitica:show-profile', {
|
||||||
|
user: {},
|
||||||
|
startingPage: 'profile',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user