Files
habitica/website/client/src/components/achievements/levelUp.vue
T
Matteo Pagliazzi 83aca20ce5 Fall Festival Gem Promo (#138)
* content: add gems blocks

* gemsBlocks: include ios and android identifiers

* wip: promo code

* split common constants into multiple files

* add second promo part

* geCurrentEvent, refactor promo

* fix lint

* fix exports, use world state api

* start adding world state tests

* remove console.log

* use gems block for purchases

* remove comments

* fix most unit tests

* restore comment

* fix lint

* prevent apple/google gift tests from breaking other tests when stub is not reset

* fix unit tests, clarify tests names

* iap: use gift object when gifting gems

* allow gift object with less data

* fix iap tests, remove findById stubs

* iap: require less data from the mobile apps

* apply discounts

* add missing worldState file

* fix lint

* add test event

* start removing 20 gems option for web

* start adding support for all gems packages on web

* fix unit tests for apple, stripe and google

* amazon: support all gems blocks

* paypal: support all gems blocks

* fix payments unit tests, add tests for getGemsBlock

* web: add gems plans with discounts, update stripe

* fix amazon and paypal clients, payments success modals

* amazon pay: disabled state

* update icons, start abstracting payments buttons

* begin redesign

* redesign gems modal

* fix buttons

* fix hover color for gems modal close icon

* add key to world state current event

* extend test event length

* implement gems modals designs

* early test fall2020

* fix header banner position

* add missing files

* use iso 8601 for dates, minor ui fixes

* fix time zones

* events: fix ISO8601 format

* fix css indentation

* start abstracting banners

* refactor payments buttons

* test spooky, fix group plans box

* implement gems promo banners, refactor banners, fixes

* fix lint

* fix dates

* remove unused i18n strings

* fix stripe integration test

* fix world state integration tests

* the current active event

* add missing unit tests

* add storybook story for payments buttons component

* fix typo

* fix(stripe): correct label when gifting subscriptions
2020-09-21 16:22:13 +02:00

205 lines
3.6 KiB
Vue

<template>
<b-modal
id="level-up"
size="sm"
:title="title"
ok-only
:ok-title="$t('onwards')"
:footer-class="{ greyed: displayRewardQuest }"
>
<section class="d-flex">
<span
class="star-group mirror"
v-html="icons.starGroup"
></span>
<avatar
class="avatar"
:member="user"
/>
<span
class="star-group"
v-html="icons.starGroup"
></span>
</section>
<p
v-once
class="text"
>
{{ $t('levelup') }}
</p>
<section
v-if="displayRewardQuest"
class="greyed"
>
<div
v-once
class="your-rewards d-flex"
>
<span
class="sparkles"
v-html="icons.sparkles"
></span>
<span class="text">{{ $t('yourRewards') }}</span>
<span
class="sparkles mirror"
v-html="icons.sparkles"
></span>
</div>
<div :class="questClass"></div>
</section>
<!-- @TODO: Keep this? .checkboxinput(type='checkbox', v-model=
'user.preferences.suppressModals.levelUp', @change='changeLevelupSuppress()')
label(style='display:inline-block') {{ $t('dontShowAgain') }}
-->
</b-modal>
</template>
<style lang="scss">
@import '~@/assets/scss/colors.scss';
#level-up {
.modal-content {
border-radius: 8px;
box-shadow: 0 14px 28px 0 rgba($black, 0.24), 0 10px 10px 0 rgba($black, 0.28);
}
@media (min-width: 576px) {
.modal-sm {
max-width: 330px;
}
}
header {
padding: 0;
border: none;
h5 {
margin: 31px auto 16px;
color: $purple-200;
}
button {
position: absolute;
right: 18px;
top: 12px;
}
}
footer {
padding: 0;
border: none;
button {
margin: 0 auto 32px auto;
}
}
.greyed {
background-color: $gray-700;
}
.modal-body {
padding: 0;
}
.mirror {
transform: scaleX(-1);
}
.star-group {
margin: auto;
svg {
height: 64px;
width: 40px;
}
}
.avatar {
cursor: auto;
}
.class-badge {
display: none !important;
}
.text {
margin: 25px 24px 24px;
min-height: auto;
}
.your-rewards {
margin: 0 auto;
width: fit-content;
.sparkles {
width: 32px;
margin-top: 12px;
}
.text {
font-weight: bold;
margin: 16px;
color: $gray-50;
}
}
section.greyed {
padding-bottom: 17px
}
.scroll {
margin: -11px auto 0;
}
}
</style>
<script>
import Avatar from '../avatar';
import { mapState } from '@/libs/store';
import starGroup from '@/assets/svg/star-group.svg';
import sparkles from '@/assets/svg/sparkles-left.svg';
const levelQuests = {
15: 'atom1',
30: 'vice1',
40: 'goldenknight1',
60: 'moonstone1',
};
export default {
components: {
Avatar,
},
data () {
return {
icons: Object.freeze({
starGroup,
sparkles,
}),
};
},
computed: {
...mapState({ user: 'user.data' }),
title () {
return this.$t('reachedLevel', { level: this.user.stats.lvl });
},
displayRewardQuest () {
return this.user.stats.lvl in levelQuests;
},
questClass () {
return `scroll inventory_quest_scroll_${levelQuests[this.user.stats.lvl]}`;
},
},
methods: {
changeLevelupSuppress () {
// @TODO: dispatch set({"preferences.suppressModals.levelUp":
// user.preferences.suppressModals.levelUp?true: false})
},
},
};
</script>