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 14:22:13 +00:00
|
|
|
<template>
|
|
|
|
|
<div
|
|
|
|
|
v-if="canShow"
|
|
|
|
|
class="habitica-top-banner d-flex justify-content-between align-items-center"
|
|
|
|
|
:class="bannerClass"
|
|
|
|
|
:style="{height}"
|
|
|
|
|
>
|
|
|
|
|
<slot name="content"></slot>
|
|
|
|
|
<div
|
|
|
|
|
v-if="canClose"
|
|
|
|
|
class="close-icon svg-icon icon-12"
|
|
|
|
|
|
|
|
|
|
@click="close()"
|
|
|
|
|
v-html="icons.close"
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
body.modal-open .habitica-top-banner {
|
|
|
|
|
z-index: 1035;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import '~@/assets/scss/colors.scss';
|
|
|
|
|
|
|
|
|
|
.habitica-top-banner {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding-left: 1.5rem;
|
|
|
|
|
padding-right: 1.625rem;
|
|
|
|
|
z-index: 1300;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-11 21:59:41 +00:00
|
|
|
.close-icon.svg-icon {
|
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 14:22:13 +00:00
|
|
|
position: relative;
|
|
|
|
|
top: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
opacity: 0.48;
|
|
|
|
|
|
|
|
|
|
& ::v-deep svg path {
|
|
|
|
|
stroke: $white !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
opacity: 0.75;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import closeIcon from '@/assets/svg/close.svg';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
bannerId: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
bannerClass: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
canClose: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
show: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
// Used to correctly show the layout on certain pages with a fixed height
|
|
|
|
|
// Like the PMs page
|
|
|
|
|
height: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
icons: Object.freeze({
|
|
|
|
|
close: closeIcon,
|
|
|
|
|
}),
|
|
|
|
|
hidden: false,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
canShow () {
|
|
|
|
|
return !this.hidden && this.show;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
canShow: {
|
|
|
|
|
handler (newVal) {
|
|
|
|
|
const valToSet = newVal === true ? this.height : '0px';
|
|
|
|
|
document.documentElement.style
|
|
|
|
|
.setProperty(`--banner-${this.bannerId}-height`, valToSet);
|
|
|
|
|
},
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
show (newVal) {
|
|
|
|
|
// When the show condition is set to false externally, remove the session storage setting
|
|
|
|
|
if (newVal === false) {
|
|
|
|
|
window.sessionStorage.removeItem(`hide-banner-${this.bannerId}`);
|
|
|
|
|
this.hidden = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
const hideStatus = window.sessionStorage.getItem(`hide-banner-${this.bannerId}`);
|
|
|
|
|
if (hideStatus === 'true') {
|
|
|
|
|
this.hidden = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
close () {
|
|
|
|
|
window.sessionStorage.setItem(`hide-banner-${this.bannerId}`, 'true');
|
|
|
|
|
this.hidden = true;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|