mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
Pending quest styles (#9106)
* Added pending quest modal * Added quest completed modal * Removed duplicate string
This commit is contained in:
@@ -1,14 +1,20 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
b-modal#quest-completed(v-if='user.party.quest.completed', :title="quests[user.party.quest.completed].text() + '' + $t('completed')",
|
b-modal#quest-completed(v-if='user.party.quest.completed', :title="title",
|
||||||
size='lg', :hide-footer="true")
|
size='md', :hide-footer="true")
|
||||||
.modal-body.text-center
|
.modal-body.text-center
|
||||||
div(:class='`quest_${user.party.quest.completed}`')
|
.quest(:class='`quest_${user.party.quest.completed}`')
|
||||||
p(v-html='quests[user.party.quest.completed].completion()')
|
p(v-html='this.questData.completion()')
|
||||||
.quest-rewards(key='user.party.quest.completed', header-participant="$t('youReceived')", header-quest-owner="$t('questOwnerReceived')")
|
.quest-rewards(key='user.party.quest.completed', header-participant="$t('youReceived')", header-quest-owner="$t('questOwnerReceived')")
|
||||||
.modal-footer
|
.modal-footer
|
||||||
button.btn.btn-primary(@click='setQuestCompleted()') {{ $t('ok') }}
|
button.btn.btn-primary(@click='setQuestCompleted()') {{ $t('ok') }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.quest {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import bModal from 'bootstrap-vue/lib/components/modal';
|
import bModal from 'bootstrap-vue/lib/components/modal';
|
||||||
import quests from 'common/script/content/quests';
|
import quests from 'common/script/content/quests';
|
||||||
@@ -29,6 +35,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data'}),
|
...mapState({user: 'user.data'}),
|
||||||
|
questData () {
|
||||||
|
return this.quests.quests[this.user.party.quest.completed];
|
||||||
|
},
|
||||||
|
title () {
|
||||||
|
return `${this.questData.text()} ${this.$t('completed')}`;
|
||||||
|
},
|
||||||
barStyle () {
|
barStyle () {
|
||||||
return {
|
return {
|
||||||
width: `${percent(this.user.stats.hp, maxHealth)}%`,
|
width: `${percent(this.user.stats.hp, maxHealth)}%`,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
group-form-modal(v-if='isParty')
|
group-form-modal(v-if='isParty')
|
||||||
invite-modal(:group='this.group')
|
invite-modal(:group='this.group')
|
||||||
start-quest-modal(:group='this.group')
|
start-quest-modal(:group='this.group')
|
||||||
|
quest-details-modal(:group='this.group')
|
||||||
.col-8.standard-page
|
.col-8.standard-page
|
||||||
.row
|
.row
|
||||||
.col-6.title-details
|
.col-6.title-details
|
||||||
@@ -80,9 +81,13 @@
|
|||||||
p(v-once) {{ $t('questDescription') }}
|
p(v-once) {{ $t('questDescription') }}
|
||||||
button.btn.btn-secondary(v-once, @click="openStartQuestModal()", v-if='isLeader') {{ $t('startAQuest') }}
|
button.btn.btn-secondary(v-once, @click="openStartQuestModal()", v-if='isLeader') {{ $t('startAQuest') }}
|
||||||
.row.quest-active-section(v-if='isParty && onPendingQuest && !onActiveQuest')
|
.row.quest-active-section(v-if='isParty && onPendingQuest && !onActiveQuest')
|
||||||
h2 Pending quest
|
.col-2
|
||||||
button.btn.btn-secondary(v-once, @click="questForceStart()") {{ $t('begin') }}
|
.quest(:class='`inventory_quest_scroll_${questData.key}`')
|
||||||
button.btn.btn-secondary(v-once, @click="questCancel()") {{ $t('cancel') }}
|
.col-6.titles
|
||||||
|
strong {{ questData.text() }}
|
||||||
|
p {{acceptedCount}} / {{group.memberCount}}
|
||||||
|
.col-4
|
||||||
|
button.btn.btn-secondary(@click="openQuestDetails()") {{ $t('details') }}
|
||||||
.row.quest-active-section(v-if='isParty && !onPendingQuest && onActiveQuest')
|
.row.quest-active-section(v-if='isParty && !onPendingQuest && onActiveQuest')
|
||||||
.col-12.text-center
|
.col-12.text-center
|
||||||
.quest-boss(:class="'quest_' + questData.key")
|
.quest-boss(:class="'quest_' + questData.key")
|
||||||
@@ -353,6 +358,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.quest-active-section {
|
.quest-active-section {
|
||||||
|
.titles {
|
||||||
|
padding-top: .5em;
|
||||||
|
}
|
||||||
|
|
||||||
.quest-box {
|
.quest-box {
|
||||||
background-image: url('~client/assets/svg/for-css/quest-border.svg');
|
background-image: url('~client/assets/svg/for-css/quest-border.svg');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
@@ -431,6 +440,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// @TODO: Break this down into components
|
||||||
|
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import extend from 'lodash/extend';
|
import extend from 'lodash/extend';
|
||||||
import groupUtilities from 'client/mixins/groupsUtilities';
|
import groupUtilities from 'client/mixins/groupsUtilities';
|
||||||
@@ -439,6 +450,7 @@ import { mapState } from 'client/libs/store';
|
|||||||
import * as Analytics from 'client/libs/analytics';
|
import * as Analytics from 'client/libs/analytics';
|
||||||
import membersModal from './membersModal';
|
import membersModal from './membersModal';
|
||||||
import startQuestModal from './startQuestModal';
|
import startQuestModal from './startQuestModal';
|
||||||
|
import questDetailsModal from './questDetailsModal';
|
||||||
import quests from 'common/script/content/quests';
|
import quests from 'common/script/content/quests';
|
||||||
import percent from 'common/script/libs/percent';
|
import percent from 'common/script/libs/percent';
|
||||||
import groupFormModal from './groupFormModal';
|
import groupFormModal from './groupFormModal';
|
||||||
@@ -482,6 +494,7 @@ export default {
|
|||||||
inviteModal,
|
inviteModal,
|
||||||
groupChallenges,
|
groupChallenges,
|
||||||
autocomplete,
|
autocomplete,
|
||||||
|
questDetailsModal,
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
bToggle,
|
bToggle,
|
||||||
@@ -523,6 +536,17 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data'}),
|
...mapState({user: 'user.data'}),
|
||||||
|
acceptedCount () {
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
if (!this.group || !this.group.quest) return count;
|
||||||
|
|
||||||
|
for (let uuid in this.group.quest.members) {
|
||||||
|
if (this.group.quest.members[uuid]) count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
},
|
||||||
communityGuidelinesAccepted () {
|
communityGuidelinesAccepted () {
|
||||||
return this.user.flags.communityGuidelinesAccepted;
|
return this.user.flags.communityGuidelinesAccepted;
|
||||||
},
|
},
|
||||||
@@ -721,6 +745,9 @@ export default {
|
|||||||
openStartQuestModal () {
|
openStartQuestModal () {
|
||||||
this.$root.$emit('show::modal', 'start-quest-modal');
|
this.$root.$emit('show::modal', 'start-quest-modal');
|
||||||
},
|
},
|
||||||
|
openQuestDetails () {
|
||||||
|
this.$root.$emit('show::modal', 'quest-details');
|
||||||
|
},
|
||||||
checkForAchievements () {
|
checkForAchievements () {
|
||||||
// Checks if user's party has reached 2 players for the first time.
|
// Checks if user's party has reached 2 players for the first time.
|
||||||
if (!this.user.achievements.partyUp && this.group.memberCount >= 2) {
|
if (!this.user.achievements.partyUp && this.group.memberCount >= 2) {
|
||||||
@@ -815,11 +842,6 @@ export default {
|
|||||||
this.$store.state.profileOptions.startingPage = 'profile';
|
this.$store.state.profileOptions.startingPage = 'profile';
|
||||||
this.$root.$emit('show::modal', 'profile');
|
this.$root.$emit('show::modal', 'profile');
|
||||||
},
|
},
|
||||||
async questCancel () {
|
|
||||||
if (!confirm(this.$t('sureCancel'))) return;
|
|
||||||
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/cancel'});
|
|
||||||
this.group.quest = quest;
|
|
||||||
},
|
|
||||||
async questAbort () {
|
async questAbort () {
|
||||||
if (!confirm(this.$t('sureAbort'))) return;
|
if (!confirm(this.$t('sureAbort'))) return;
|
||||||
if (!confirm(this.$t('doubleSureAbort'))) return;
|
if (!confirm(this.$t('doubleSureAbort'))) return;
|
||||||
@@ -835,10 +857,6 @@ export default {
|
|||||||
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/accept'});
|
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/accept'});
|
||||||
this.group.quest = quest;
|
this.group.quest = quest;
|
||||||
},
|
},
|
||||||
async questForceStart () {
|
|
||||||
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'});
|
|
||||||
this.group.quest = quest;
|
|
||||||
},
|
|
||||||
// @TODO: Move to notificaitons component?
|
// @TODO: Move to notificaitons component?
|
||||||
async questReject () {
|
async questReject () {
|
||||||
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/reject'});
|
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/reject'});
|
||||||
|
|||||||
210
website/client/components/groups/questDetailsModal.vue
Normal file
210
website/client/components/groups/questDetailsModal.vue
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
b-modal#quest-details(title="Empty", size='md', :hide-footer="true", :hide-header="true")
|
||||||
|
.left-panel.content
|
||||||
|
h3.text-center {{ $t('participantsTitle') }}
|
||||||
|
.row
|
||||||
|
.col-10.offset-1.text-center
|
||||||
|
span.description(v-once) {{ $t('participantDesc') }}
|
||||||
|
.row
|
||||||
|
.col-12.member(v-for='member in members')
|
||||||
|
strong(:class="{'declined-name': member.accepted === false}") {{member.name}}
|
||||||
|
.accepted.float-right(v-if='member.accepted === true') {{ $t('accepted') }}
|
||||||
|
.declined.float-right(v-if='member.accepted === false') {{ $t('declined') }}
|
||||||
|
.pending.float-right(v-if='member.accepted === null') {{ $t('pending') }}
|
||||||
|
div(v-if='questData')
|
||||||
|
questDialogContent(:item="questData")
|
||||||
|
div.text-center.actions
|
||||||
|
div
|
||||||
|
button.btn.btn-secondary(v-once, @click="questForceStart()") {{ $t('begin') }}
|
||||||
|
div
|
||||||
|
.cancel(v-once, @click="questCancel()") {{ $t('cancel') }}
|
||||||
|
.side-panel(v-if='questData')
|
||||||
|
questDialogDrops(:item="questData")
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
@import '~client/assets/scss/colors.scss';
|
||||||
|
|
||||||
|
header {
|
||||||
|
background-color: $white !important;
|
||||||
|
border: none !important;
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
text-indent: -99999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.quest-details {
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: left;
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-panel {
|
||||||
|
background: #4e4a57;
|
||||||
|
color: $white;
|
||||||
|
position: absolute;
|
||||||
|
height: 460px;
|
||||||
|
width: 320px;
|
||||||
|
top: 2.5em;
|
||||||
|
left: -22em;
|
||||||
|
z-index: -1;
|
||||||
|
padding: 2em;
|
||||||
|
overflow: scroll;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected .quest-wrapper {
|
||||||
|
border: solid 1.5px #9a62ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quest-wrapper:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quest-col .quest-wrapper {
|
||||||
|
background: $white;
|
||||||
|
padding: .2em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
text-align: center;
|
||||||
|
color: #a5a1ac;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-panel {
|
||||||
|
position: absolute;
|
||||||
|
right: -350px;
|
||||||
|
top: 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: $gray-600;
|
||||||
|
box-shadow: 0 2px 16px 0 rgba(26, 24, 29, 0.32);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 364px;
|
||||||
|
z-index: -1;
|
||||||
|
height: 93%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member {
|
||||||
|
padding: 1em .5em;
|
||||||
|
border-top: 1px solid #686274;
|
||||||
|
|
||||||
|
.declined-name {
|
||||||
|
color: #878190;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accepted {
|
||||||
|
color: #1ed3a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.declined {
|
||||||
|
color: #f19595;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pending {
|
||||||
|
color: #c3c0c7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
padding-top: 2em;
|
||||||
|
padding-bottom: 2em;
|
||||||
|
|
||||||
|
.cancel {
|
||||||
|
color: #f74e52;
|
||||||
|
margin-top: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from 'client/libs/store';
|
||||||
|
import bModal from 'bootstrap-vue/lib/components/modal';
|
||||||
|
|
||||||
|
import quests from 'common/script/content/quests';
|
||||||
|
|
||||||
|
import copyIcon from 'assets/svg/copy.svg';
|
||||||
|
import greyBadgeIcon from 'assets/svg/grey-badge.svg';
|
||||||
|
import qrCodeIcon from 'assets/svg/qrCode.svg';
|
||||||
|
import facebookIcon from 'assets/svg/facebook.svg';
|
||||||
|
import twitterIcon from 'assets/svg/twitter.svg';
|
||||||
|
import starIcon from 'assets/svg/star.svg';
|
||||||
|
import goldIcon from 'assets/svg/gold.svg';
|
||||||
|
import difficultyStarIcon from 'assets/svg/difficulty-star.svg';
|
||||||
|
import questDialogDrops from '../shops/quests/questDialogDrops';
|
||||||
|
import questDialogContent from '../shops/quests/questDialogContent';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: ['group'],
|
||||||
|
components: {
|
||||||
|
bModal,
|
||||||
|
questDialogDrops,
|
||||||
|
questDialogContent,
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
selectedQuest: {},
|
||||||
|
icons: Object.freeze({
|
||||||
|
copy: copyIcon,
|
||||||
|
greyBadge: greyBadgeIcon,
|
||||||
|
qrCode: qrCodeIcon,
|
||||||
|
facebook: facebookIcon,
|
||||||
|
twitter: twitterIcon,
|
||||||
|
starIcon,
|
||||||
|
goldIcon,
|
||||||
|
difficultyStarIcon,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
user: 'user.data',
|
||||||
|
partyMembers: 'party.members.data',
|
||||||
|
}),
|
||||||
|
questData () {
|
||||||
|
return quests.quests[this.group.quest.key];
|
||||||
|
},
|
||||||
|
members () {
|
||||||
|
return this.partyMembers.map(member => {
|
||||||
|
return {
|
||||||
|
name: member.profile.name,
|
||||||
|
accepted: this.group.quest.members[member._id],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async questForceStart () {
|
||||||
|
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'});
|
||||||
|
this.group.quest = quest;
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
async questCancel () {
|
||||||
|
if (!confirm(this.$t('sureCancel'))) return;
|
||||||
|
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/cancel'});
|
||||||
|
this.group.quest = quest;
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$root.$emit('hide::modal', 'quest-details');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -303,6 +303,10 @@ export default {
|
|||||||
this.$root.$emit('show::modal', 'avatar-modal');
|
this.$root.$emit('show::modal', 'avatar-modal');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.questCompleted) {
|
||||||
|
this.$root.$emit('show::modal', 'quest-completed');
|
||||||
|
}
|
||||||
|
|
||||||
// @TODO: This is a timeout to ensure dom is loaded
|
// @TODO: This is a timeout to ensure dom is loaded
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
this.initTour();
|
this.initTour();
|
||||||
|
|||||||
@@ -388,5 +388,7 @@
|
|||||||
"selectPartyMember": "Select a Party Member",
|
"selectPartyMember": "Select a Party Member",
|
||||||
"areYouSureDeleteMessage": "Are you sure you want to delete this message?",
|
"areYouSureDeleteMessage": "Are you sure you want to delete this message?",
|
||||||
"reverseChat": "Reverse Chat",
|
"reverseChat": "Reverse Chat",
|
||||||
"invites": "Invites"
|
"invites": "Invites",
|
||||||
|
"details": "Details",
|
||||||
|
"participantDesc": "Once all members have either accepted or declined, the Quest begins. Only those that clicked 'accept' will be able to participate in the Quest and receive the drops."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user