|
| 1 | +<template> |
| 2 | + <div class="pomodoro-popup-block" v-if="isEnabled"> |
| 3 | + <p>Pomodoro Mode is enabled</p> |
| 4 | + <span v-if="isWorkingTime">WORK</span> |
| 5 | + <span v-if="!isWorkingTime">REST</span> |
| 6 | + <input |
| 7 | + type="button" |
| 8 | + :value="t('pomodoroSettings.message')" |
| 9 | + @click="openPage(SettingsTab.Pomodoro)" |
| 10 | + /> |
| 11 | + </div> |
| 12 | +</template> |
| 13 | + |
| 14 | +<script lang="ts"> |
| 15 | +export default { |
| 16 | + name: 'PomodoroInfo', |
| 17 | +}; |
| 18 | +</script> |
| 19 | + |
| 20 | +<script lang="ts" setup> |
| 21 | +import { computed, onMounted, ref } from 'vue'; |
| 22 | +import { StorageParams, IS_POMODORO_ENABLED_DEFAULT } from '../storage/storage-params'; |
| 23 | +import { useI18n } from 'vue-i18n'; |
| 24 | +import { injecStorage } from '../storage/inject-storage'; |
| 25 | +import { openPage } from '../utils/open-page'; |
| 26 | +import { SettingsTab } from '../utils/enums'; |
| 27 | +import { checkPomodoro } from '../functions/pomodoro'; |
| 28 | +
|
| 29 | +const { t } = useI18n(); |
| 30 | +const settingsStorage = injecStorage(); |
| 31 | +
|
| 32 | +const isEnabled = ref<boolean>(); |
| 33 | +const isWorkingTime = ref<boolean>(); |
| 34 | +
|
| 35 | +onMounted(async () => { |
| 36 | + isEnabled.value = await settingsStorage.getValue( |
| 37 | + StorageParams.IS_POMODORO_ENABLED, |
| 38 | + IS_POMODORO_ENABLED_DEFAULT, |
| 39 | + ); |
| 40 | +
|
| 41 | + isWorkingTime.value = (await checkPomodoro())?.isWork; |
| 42 | +}); |
| 43 | +</script> |
| 44 | + |
| 45 | +<style scoped> |
| 46 | +.pomodoro-popup-block { |
| 47 | + width: -webkit-fill-available; |
| 48 | + position: fixed; |
| 49 | + bottom: 0; |
| 50 | + padding: 8px 20px; |
| 51 | + font-size: 14px; |
| 52 | + background-color: #efefef; |
| 53 | +} |
| 54 | +.pomodoro-popup-block p { |
| 55 | + display: inline-block; |
| 56 | + margin: 8px; |
| 57 | + font-size: 17px; |
| 58 | + font-weight: 500; |
| 59 | +} |
| 60 | +.pomodoro-popup-block span { |
| 61 | + padding: 5px; |
| 62 | + background-color: rgb(105, 202, 105); |
| 63 | + color: black; |
| 64 | + margin-left: 10px; |
| 65 | + border-radius: 5px; |
| 66 | + font-weight: 500; |
| 67 | + font-size: 13px; |
| 68 | +} |
| 69 | +.pomodoro-popup-block input[type='button'] { |
| 70 | + float: right; |
| 71 | +} |
| 72 | +</style> |
0 commit comments