|
| 1 | +<template> |
| 2 | + <div class="review-block" v-if="showReview && canShowPromo"> |
| 3 | + <p>{{ t('promoClearYoutube.message') }}</p> |
| 4 | + <img height="15" src="../assets/icons/close.svg" @click="closeBlock()" /> |
| 5 | + <input type="button" :value="t('promoClearYoutube.description')" @click="openStore()" /> |
| 6 | + </div> |
| 7 | +</template> |
| 8 | + |
| 9 | +<script lang="ts"> |
| 10 | +export default { |
| 11 | + name: 'PromoClearYouTube', |
| 12 | +}; |
| 13 | +</script> |
| 14 | + |
| 15 | +<script lang="ts" setup> |
| 16 | +import { computed, ref } from 'vue'; |
| 17 | +import { useI18n } from 'vue-i18n'; |
| 18 | +import { injecStorage } from '../storage/inject-storage'; |
| 19 | +import { StorageParams } from '../storage/storage-params'; |
| 20 | +import { CHROME_STORE_CLEAR_YOUTUBE_URL } from '../utils/chrome-url'; |
| 21 | +import { usePromoExtension } from '../compositions/usePromoExtension'; |
| 22 | +
|
| 23 | +const { t } = useI18n(); |
| 24 | +
|
| 25 | +const settingsStorage = injecStorage(); |
| 26 | +const showReview = ref<boolean>(); |
| 27 | +
|
| 28 | +const canShowPromo = computed(async () => await usePromoExtension()); |
| 29 | +
|
| 30 | +async function closeBlock() { |
| 31 | + showReview.value = false; |
| 32 | + await settingsStorage.saveValue(StorageParams.PROMO_CLEAR_YOUTUBE, true); |
| 33 | +} |
| 34 | +
|
| 35 | +async function openStore() { |
| 36 | + window.open(CHROME_STORE_CLEAR_YOUTUBE_URL, '_blank'); |
| 37 | + await settingsStorage.saveValue(StorageParams.PROMO_CLEAR_YOUTUBE, true); |
| 38 | +} |
| 39 | +</script> |
| 40 | + |
| 41 | +<style scoped> |
| 42 | +.review-block { |
| 43 | + width: -webkit-fill-available; |
| 44 | + position: fixed; |
| 45 | + bottom: 0; |
| 46 | + padding: 8px 20px; |
| 47 | + font-size: 14px; |
| 48 | + background-color: #efefef; |
| 49 | +} |
| 50 | +.review-block input[type='button'] { |
| 51 | + margin: 0 20px 0 0; |
| 52 | + float: right; |
| 53 | + width: auto; |
| 54 | +} |
| 55 | +.review-block p { |
| 56 | + display: inline-block; |
| 57 | + margin: 8px; |
| 58 | + font-size: 17px; |
| 59 | +} |
| 60 | +.review-block img { |
| 61 | + padding: 9px 0 0 0; |
| 62 | + cursor: pointer; |
| 63 | + float: right; |
| 64 | +} |
| 65 | +</style> |
0 commit comments