Merge branch 'feat/pomodoro' into chore/all-my-stuffs

This commit is contained in:
ShareVB committed 2025-04-12 17:43:43 +02:00
commit d412d9b583
27 files changed
+1166 -4

No files matched your search

+20
View File
@@ -12,10 +12,12 @@ declare module '@vue/runtime-core' {
'404.page': typeof import('./src/pages/404.page.vue')['default']
About: typeof import('./src/pages/About.vue')['default']
AiPromptSplitter: typeof import('./src/tools/ai-prompt-splitter/ai-prompt-splitter.vue')['default']
AlarmSoundToggle: typeof import('./src/tools/pomodoro-timer/app/components/AlarmSoundToggle.vue')['default']
AngleConverter: typeof import('./src/tools/angle-converter/angle-converter.vue')['default']
AnsibleVaultCryptDecrypt: typeof import('./src/tools/ansible-vault-crypt-decrypt/ansible-vault-crypt-decrypt.vue')['default']
ApiTester: typeof import('./src/tools/api-tester/api-tester.vue')['default']
App: typeof import('./src/App.vue')['default']
AppColorPicker: typeof import('./src/tools/pomodoro-timer/app/components/AppColorPicker.vue')['default']
AreaConverter: typeof import('./src/tools/area-converter/area-converter.vue')['default']
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
AspectRatioCalculator: typeof import('./src/tools/aspect-ratio-calculator/aspect-ratio-calculator.vue')['default']
@@ -74,6 +76,7 @@ declare module '@vue/runtime-core' {
CommandPaletteOption: typeof import('./src/modules/command-palette/components/command-palette-option.vue')['default']
CommonRegex: typeof import('./src/tools/common-regex-memo/common-regex.md')['default']
CommonRegexMemo: typeof import('./src/tools/common-regex-memo/common-regex-memo.vue')['default']
Counter: typeof import('./src/tools/pomodoro-timer/app/components/Counter.vue')['default']
CrcCalculator: typeof import('./src/tools/crc-calculator/crc-calculator.vue')['default']
CrontabGenerator: typeof import('./src/tools/crontab-generator/crontab-generator.vue')['default']
CSelect: typeof import('./src/ui/c-select/c-select.vue')['default']
@@ -126,8 +129,10 @@ declare module '@vue/runtime-core' {
FavoriteButton: typeof import('./src/components/FavoriteButton.vue')['default']
FileHasher: typeof import('./src/tools/file-hasher/file-hasher.vue')['default']
FileType: typeof import('./src/tools/file-type/file-type.vue')['default']
FinishedPopup: typeof import('./src/tools/pomodoro-timer/app/components/FinishedPopup.vue')['default']
FloatingPointNumberConverter: typeof import('./src/tools/floating-point-number-converter/floating-point-number-converter.vue')['default']
FolderStructureDiagram: typeof import('./src/tools/folder-structure-diagram/folder-structure-diagram.vue')['default']
Footer: typeof import('./src/tools/pomodoro-timer/app/components/Footer.vue')['default']
ForceConverter: typeof import('./src/tools/force-converter/force-converter.vue')['default']
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
FortuneWheel: typeof import('./src/tools/fortune-wheel/fortune-wheel.vue')['default']
@@ -139,10 +144,12 @@ declare module '@vue/runtime-core' {
HarSanitizer: typeof import('./src/tools/har-sanitizer/har-sanitizer.vue')['default']
HashText: typeof import('./src/tools/hash-text/hash-text.vue')['default']
HddCalculator: typeof import('./src/tools/hdd-calculator/hdd-calculator.vue')['default']
Header: typeof import('./src/tools/pomodoro-timer/app/components/Header.vue')['default']
HeicConverter: typeof import('./src/tools/heic-converter/heic-converter.vue')['default']
HexConverter: typeof import('./src/tools/hex-converter/hex-converter.vue')['default']
HexFileConverter: typeof import('./src/tools/hex-file-converter/hex-file-converter.vue')['default']
HmacGenerator: typeof import('./src/tools/hmac-generator/hmac-generator.vue')['default']
Home: typeof import('./src/tools/pomodoro-timer/app/views/Home.vue')['default']
'Home.page': typeof import('./src/pages/Home.page.vue')['default']
HtmlCleaner: typeof import('./src/tools/html-cleaner/html-cleaner.vue')['default']
HtmlEntities: typeof import('./src/tools/html-entities/html-entities.vue')['default']
@@ -249,6 +256,7 @@ declare module '@vue/runtime-core' {
MicTester: typeof import('./src/tools/mic-tester/mic-tester.vue')['default']
MimeConverter: typeof import('./src/tools/mime-converter/mime-converter.vue')['default']
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
ModeIconBar: typeof import('./src/tools/pomodoro-timer/app/components/ModeIconBar.vue')['default']
MongoObjectidConverter: typeof import('./src/tools/mongo-objectid-converter/mongo-objectid-converter.vue')['default']
MorseConverter: typeof import('./src/tools/morse-converter/morse-converter.vue')['default']
MultiLinkDownloader: typeof import('./src/tools/multi-link-downloader/multi-link-downloader.vue')['default']
@@ -259,6 +267,8 @@ declare module '@vue/runtime-core' {
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
@@ -283,6 +293,7 @@ declare module '@vue/runtime-core' {
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NModal: typeof import('naive-ui')['NModal']
NP: typeof import('naive-ui')['NP']
NRadio: typeof import('naive-ui')['NRadio']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
@@ -294,7 +305,10 @@ declare module '@vue/runtime-core' {
NStatistic: typeof import('naive-ui')['NStatistic']
NSwitch: typeof import('naive-ui')['NSwitch']
NTable: typeof import('naive-ui')['NTable']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NText: typeof import('naive-ui')['NText']
NumberInput: typeof import('./src/tools/pomodoro-timer/app/components/NumberInput.vue')['default']
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
Option43Generator: typeof import('./src/tools/option43-generator/option43-generator.vue')['default']
@@ -315,10 +329,13 @@ declare module '@vue/runtime-core' {
PhoneParserAndFormatter: typeof import('./src/tools/phone-parser-and-formatter/phone-parser-and-formatter.vue')['default']
PhpArrayToJson: typeof import('./src/tools/php-array-to-json/php-array-to-json.vue')['default']
PinCodeGenerator: typeof import('./src/tools/pin-code-generator/pin-code-generator.vue')['default']
PlayPauseBtn: typeof import('./src/tools/pomodoro-timer/app/components/PlayPauseBtn.vue')['default']
PomodoroTimer: typeof import('./src/tools/pomodoro-timer/pomodoro-timer.vue')['default']
PortNumbers: typeof import('./src/tools/port-numbers/port-numbers.vue')['default']
Potrace: typeof import('./src/tools/potrace/potrace.vue')['default']
PowerConverter: typeof import('./src/tools/power-converter/power-converter.vue')['default']
PressureConverter: typeof import('./src/tools/pressure-converter/pressure-converter.vue')['default']
ProgressBar: typeof import('./src/tools/pomodoro-timer/app/components/ProgressBar.vue')['default']
PropertiesToYaml: typeof import('./src/tools/properties-to-yaml/properties-to-yaml.vue')['default']
PunycodeConverter: typeof import('./src/tools/punycode-converter/punycode-converter.vue')['default']
QrCodeDecoder: typeof import('./src/tools/qr-code-decoder/qr-code-decoder.vue')['default']
@@ -330,6 +347,7 @@ declare module '@vue/runtime-core' {
'RegexMemo.content': typeof import('./src/tools/regex-memo/regex-memo.content.md')['default']
RegexTester: typeof import('./src/tools/regex-tester/regex-tester.vue')['default']
RemoveExif: typeof import('./src/tools/remove-exif/remove-exif.vue')['default']
ResetDropup: typeof import('./src/tools/pomodoro-timer/app/components/ResetDropup.vue')['default']
ResultRow: typeof import('./src/tools/ipv4-range-expander/result-row.vue')['default']
RmbNumbers: typeof import('./src/tools/rmb-numbers/rmb-numbers.vue')['default']
RomanNumeralConverter: typeof import('./src/tools/roman-numeral-converter/roman-numeral-converter.vue')['default']
@@ -340,6 +358,7 @@ declare module '@vue/runtime-core' {
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
SensitiveDataMasker: typeof import('./src/tools/sensitive-data-masker/sensitive-data-masker.vue')['default']
Settings: typeof import('./src/tools/pomodoro-timer/app/views/Settings.vue')['default']
SharepointDecoder: typeof import('./src/tools/sharepoint-decoder/sharepoint-decoder.vue')['default']
SipAuth: typeof import('./src/tools/sip-auth/sip-auth.vue')['default']
SlaCalculator: typeof import('./src/tools/sla-calculator/sla-calculator.vue')['default']
@@ -349,6 +368,7 @@ declare module '@vue/runtime-core' {
SnowflakeIdExtractor: typeof import('./src/tools/snowflake-id-extractor/snowflake-id-extractor.vue')['default']
SoftwareLicenceCompatibility: typeof import('./src/tools/software-licence-compatibility/software-licence-compatibility.vue')['default']
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
SplashScreen: typeof import('./src/tools/pomodoro-timer/app/views/SplashScreen.vue')['default']
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
SslCertConverter: typeof import('./src/tools/ssl-cert-converter/ssl-cert-converter.vue')['default']
StacktracePrettier: typeof import('./src/tools/stacktrace-prettier/stacktrace-prettier.vue')['default']
+4
View File
@@ -37,6 +37,9 @@
"release": "node ./scripts/release.mjs"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
"@chenfengyuan/vue-barcode": "^2.0.2",
"@date-fns/utc": "^1.2.0",
"@dice-roller/rpg-dice-roller": "^5.5.1",
@@ -259,6 +262,7 @@
"vue-shadow-dom": "^4.2.0",
"vue-tsc": "^1.8.1",
"vue3-fortune-wheel": "^2.0.5",
"vuex": "^4.1.0",
"vuedraggable": "^4.1.0",
"w-websocket-client": "^1.0.29",
"wcag-contrast-utils": "^1.0.1",
+41 -3
View File
@@ -14,6 +14,15 @@ dependencies:
'@dice-roller/rpg-dice-roller':
specifier: ^5.5.1
version: 5.5.1
'@fortawesome/fontawesome-svg-core':
specifier: ^6.7.2
version: 6.7.2
'@fortawesome/free-solid-svg-icons':
specifier: ^6.7.2
version: 6.7.2
'@fortawesome/vue-fontawesome':
specifier: ^3.0.8
version: 3.0.8(@fortawesome/fontawesome-svg-core@6.7.2)(vue@3.3.4)
'@github/paste-markdown':
specifier: ^1.5.3
version: 1.5.3
@@ -674,6 +683,9 @@ dependencies:
vuedraggable:
specifier: ^4.1.0
version: 4.1.0(vue@3.3.4)
vuex:
specifier: ^4.1.0
version: 4.1.0(vue@3.3.4)
w-websocket-client:
specifier: ^1.0.29
version: 1.0.29
@@ -3427,6 +3439,13 @@ packages:
engines: {node: '>=6'}
dev: false
/@fortawesome/fontawesome-svg-core@6.7.2:
resolution: {integrity: sha512-yxtOBWDrdi5DD5o1pmVdq3WMCvnobT0LU6R8RyyVXPvFRd2o79/0NCuQoCjNTeZz9EzA9xS3JxNWfv54RIHFEA==}
engines: {node: '>=6'}
dependencies:
'@fortawesome/fontawesome-common-types': 6.7.2
dev: false
/@fortawesome/free-regular-svg-icons@6.7.2:
resolution: {integrity: sha512-7Z/ur0gvCMW8G93dXIQOkQqHo2M5HLhYrRVC0//fakJXxcF1VmMPsxnG6Ee8qEylA8b8Q3peQXWMNZ62lYF28g==}
engines: {node: '>=6'}
@@ -3441,6 +3460,16 @@ packages:
'@fortawesome/fontawesome-common-types': 6.7.2
dev: false
/@fortawesome/vue-fontawesome@3.0.8(@fortawesome/fontawesome-svg-core@6.7.2)(vue@3.3.4):
resolution: {integrity: sha512-yyHHAj4G8pQIDfaIsMvQpwKMboIZtcHTUvPqXjOHyldh1O1vZfH4W03VDPv5RvI9P6DLTzJQlmVgj9wCf7c2Fw==}
peerDependencies:
'@fortawesome/fontawesome-svg-core': ~1 || ~6
vue: '>= 3.0.0 < 4'
dependencies:
'@fortawesome/fontawesome-svg-core': 6.7.2
vue: 3.3.4
dev: false
/@github/paste-markdown@1.5.3:
resolution: {integrity: sha512-PzZ1b3PaqBzYqbT4fwKEhiORf38h2OcGp2+JdXNNM7inZ7egaSmfmhyNkQILpqWfS0AYtRS3CDq6z03eZ8yOMQ==}
dev: false
@@ -6666,7 +6695,7 @@ packages:
dependencies:
'@unhead/dom': 0.5.1
'@unhead/schema': 0.5.1
'@vueuse/shared': 13.0.0(vue@3.3.4)
'@vueuse/shared': 13.1.0(vue@3.3.4)
unhead: 0.5.1
vue: 3.3.4
dev: false
@@ -7338,8 +7367,8 @@ packages:
- vue
dev: false
/@vueuse/shared@13.0.0(vue@3.3.4):
resolution: {integrity: sha512-9MiHhAPw+sqCF/RLo8V6HsjRqEdNEWVpDLm2WBRW2G/kSQjb8X901sozXpSCaeLG0f7TEfMrT4XNaA5m1ez7Dg==}
/@vueuse/shared@13.1.0(vue@3.3.4):
resolution: {integrity: sha512-IVS/qRRjhPTZ6C2/AM3jieqXACGwFZwWTdw5sNTSKk2m/ZpkuuN+ri+WCVUP8TqaKwJYt/KuMwmXspMAw8E6ew==}
peerDependencies:
vue: ^3.5.0
dependencies:
@@ -17982,6 +18011,15 @@ packages:
vue: 3.3.4
dev: false
/vuex@4.1.0(vue@3.3.4):
resolution: {integrity: sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==}
peerDependencies:
vue: ^3.2.0
dependencies:
'@vue/devtools-api': 6.5.0
vue: 3.3.4
dev: false
/w-websocket-client@1.0.29:
resolution: {integrity: sha512-zZg+dOo4EP3BmvpjlkpThKIgTAzCHoOFSSp6xSNY6EuywM2xDqfkiQU7Ga3QlzEMC9i8TwdXfkntRauA/D2KWA==}
dependencies:
BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

+7
View File
@@ -1,6 +1,8 @@
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { createHead } from '@vueuse/head';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { install as VueMonacoEditorPlugin, loader } from '@guolao/vue-monaco-editor';
import * as monaco from 'monaco-editor';
@@ -17,6 +19,10 @@ import App from './App.vue';
import router from './router';
import { i18nPlugin } from './plugins/i18n.plugin';
import store from './tools/pomodoro-timer/app/store';
library.add(fas);
// loaded monaco-editor from `node_modules`
loader.config({ monaco });
@@ -32,5 +38,6 @@ app.use(router);
app.use(naive);
app.use(plausible);
app.use(shadow);
app.use(store, 'pomodoro-store');
app.mount('#app');
+157
View File
@@ -0,0 +1,157 @@
<script setup>
import { useStore } from 'vuex';
import Header from './components/Header.vue';
import FinishedPopup from './components/FinishedPopup.vue';
import { startTimer } from './storeUtils';
import PomodoroAbout from './views/About.vue';
import PomodoroHome from './views/Home.vue';
import PomodoroSettings from './views/Settings.vue';
const store = useStore('pomodoro-store');
// Save state on visibilitychange
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
localStorage.setItem('pomodoro-state', JSON.stringify(store.state));
}
});
// Save state on mutation
function subscribeToSavingState() {
store.subscribe((mutation, state) => {
localStorage.setItem('pomodoro-state', JSON.stringify(state));
});
}
// Restore state on load
function restoreStateIfAvaiable() {
if (localStorage.getItem('pomodoro-state')) {
store.replaceState(
Object.assign(store.state, JSON.parse(localStorage.getItem('pomodoro-state'))),
);
store.commit('updateAppColor', {
propName: 'appAccentColor',
propValue: store.state.appAccentColor,
});
}
if (store.state.isTimerRunning) {
startTimer(store.state);
}
}
// Run these on start up
subscribeToSavingState();
restoreStateIfAvaiable();
function isWorkIntervalSet() {
return store.state.workInterval;
}
if (isWorkIntervalSet()) {
store.commit('goToPage', 'home');
}
else {
store.commit('goToPage', 'settings');
}
const currentTab = computed(
{
get() {
return store.state.currentTab;
},
set(newPage) {
store.commit('goToPage', newPage);
},
},
);
</script>
<template>
<link href="//fonts.googleapis.com/css2?family=Varela+Round&display=swap" rel="stylesheet">
<div class="pomodoro-timer-app">
<Header />
<div class="page-container">
<n-tabs v-model:value="currentTab" type="line" animated>
<n-tab-pane name="home" tab="Timer">
<PomodoroHome />
</n-tab-pane>
<n-tab-pane name="about" tab="About">
<PomodoroAbout />
</n-tab-pane>
<n-tab-pane name="settings" tab="Settings">
<PomodoroSettings />
</n-tab-pane>
</n-tabs>
</div>
<!-- <Footer /> -->
<FinishedPopup />
<audio id="alarmPlayer" src="/Beep.mp3" loop />
</div>
</template>
<style>
@import url("https://fonts.googleapis.com/css2?family=Varela+Round&display=swap");
:root {
--pomodoro-app-accent-color: #3b83b0;
--pomodoro-dark-text-color: #303030;
--pomodoro-light-gray-text-color: #767676;
--pomodoro-text-contrast-color: #ffffff;
}
.pomodoro-timer-app *,
.pomodoro-timer-app *::before,
.pomodoro-timer-app *::after {
box-sizing: border-box;
}
.pomodoro-timer-app {
-webkit-text-size-adjust: 100%;
font-size: 1rem;
font-family: "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
sans-serif;
color: var(--pomodoro-dark-text-color);
min-height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
}
.pomodoro-timer-app input,
.pomodoro-timer-app textarea,
.pomodoro-timer-app button {
font: inherit;
}
.pomodoro-timer-app button {
outline: none !important;
border-style: none;
border: white 0.0625rem solid;
box-shadow: 1px 1px 7px -4px black;
font-size: 1.125rem;
border-radius: 0.375rem;
background-color: var(--pomodoro-app-accent-color);
color: var(--pomodoro-text-contrast-color);
padding: 10px 15px 9px 15px;
cursor: pointer;
text-align: center;
}
.pomodoro-timer-app a {
color: var(--pomodoro-app-accent-color);
}
.pomodoro-timer-app .settings-label {
display: inline-block;
width: 12.5rem;
padding: 0.625rem 0rem;
}
.pomodoro-timer-app .page-container {
flex: 1;
display: flex;
justify-content: center;
}
</style>
@@ -0,0 +1,79 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
const props = defineProps({
id: String,
label: String,
});
const store = useStore('pomodoro-store');
// bind v-model="bool" to the vuex store
const bool = computed({
get() {
return store.state[props.id];
},
set() {
store.commit('toggleAlarmSound');
},
});
</script>
<template>
<label :for="id" class="settings-label">{{ label }}
<FontAwesomeIcon icon="fa-solid fa-volume-high" />
</label>
<input :id="id" v-model="bool" class="toggle toggle-spacing" type="checkbox">
</template>
<style scoped>
.toggle-spacing {
margin: 0rem 0rem -0.4375rem 0rem;
}
.toggle {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: 3.875rem;
height: 2rem;
display: inline-block;
position: relative;
border-radius: 3.125rem;
overflow: hidden;
outline: none;
border: none;
cursor: pointer;
background-color: #707070;
transition: background-color ease 0.3s;
}
.toggle:before {
content: "on off";
display: block;
position: absolute;
z-index: 2;
width: 1.75rem;
height: 1.75rem;
background: #fff;
left: 0.125rem;
top: 0.125rem;
border-radius: 50%;
font: 0.625rem/1.75rem Helvetica;
text-transform: uppercase;
font-weight: bold;
text-indent: -1.375rem;
word-spacing: 2.3125rem;
color: #fff;
text-shadow: -0.0625rem -0.0625rem rgba(0,0,0,0.15);
white-space: nowrap;
box-shadow: 0 0.0625rem 0.125rem rgba(0,0,0,0.2);
transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
}
.toggle:checked {
background-color: var(--pomodoro-app-accent-color);
}
.toggle:checked:before {
left: 2rem;
}
</style>
@@ -0,0 +1,48 @@
<script setup>
import { useStore } from 'vuex';
const props = defineProps({
id: String,
label: String,
});
const store = useStore('pomodoro-store');
function setColor(hexColor) {
store.commit('updateAppColor', { propName: props.id, propValue: hexColor });
}
</script>
<template>
<label :for="id" class="settings-label">{{ label }}</label>
<div class="dot-container">
<div class="blue-dot" @click="setColor('#3b83b0')" />
<div class="red-dot" @click="setColor('#c93232')" />
<div class="green-dot" @click="setColor('#008000')" />
</div>
</template>
<style scoped>
.dot-container {
display: inline-block;
}
.dot-container > div {
display: inline-block;
border-radius: 50%;
width: 1.875rem;
height: 1.875rem;
margin-right: 0.3125rem;
}
.blue-dot {
background-color: #3b83b0;
}
.red-dot {
background-color: #c93232;
}
.green-dot {
background-color: #008000;
}
</style>
@@ -0,0 +1,16 @@
<script setup>
import { useStore } from 'vuex';
const store = useStore('pomodoro-store');
</script>
<template>
<span>{{ store.state.counter }}</span>
</template>
<style scoped>
span {
font-family: 'Varela Round', 'Lucida Console', 'Courier New', Courier, monospace;
font-size: 4rem;
}
</style>
@@ -0,0 +1,25 @@
<script setup>
import { useStore } from 'vuex';
const store = useStore('pomodoro-store');
</script>
<template>
<n-modal v-model:show="store.state.isShowFinishedPopup" :mask-closable="false">
<n-card
style="width: 600px"
title="Timer finished"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<p>{{ store.state.finishedMessage }}</p>
<template #footer>
<n-button @click="store.commit('prepareNextTimerMode')">
OK
</n-button>
</template>
</n-card>
</n-modal>
</template>
@@ -0,0 +1,17 @@
<template>
<footer>
<div>©2022 Steven McGrew</div>
</footer>
</template>
<style scoped>
footer {
text-align: right;
font-size: 0.875rem;
color: var(--pomodoro-dark-text-color);
}
footer > div {
padding: 0.3125rem;
}
</style>
@@ -0,0 +1,66 @@
<template>
<header>
<h1 @click="$router.push('/')">
<div class="icon-container">
<div class="circle" />
<img src="/stopwatch.png" alt="Picture of a stopwatch">
</div>
Pomodoro Timer
</h1>
</header>
</template>
<style scoped>
.icon-container {
display: inline-block;
margin-right: 0.3125rem;
}
.circle {
display: inline-block;
background-color: white;
width: 1.875rem;
height: 1.875rem;
border-radius: 50%;
margin-bottom: -0.375rem;
}
img {
height: 2.375rem;
margin-bottom: -0.5rem;
margin-left: -2.125rem;
}
header {
background-color: var(--pomodoro-app-accent-color);
padding: 1.25rem 0.625rem;
color: var(--pomodoro-text-contrast-color);
}
h1 {
display: inline;
margin: 0;
font-weight: 400;
cursor: pointer;
}
.header-nav {
float: right;
padding: 0.625rem;
}
.link {
text-decoration: none;
padding: 1.25rem;
color: var(--pomodoro-text-contrast-color);
}
@media only screen and (max-width: 620px) {
.header-nav {
float: none;
text-align: center;
padding-bottom: 0;
}
h1 {
display: block;
text-align: center;
margin-left: -2.6875rem;
}
.link {
padding-top: 0.625rem;
}
}
</style>
@@ -0,0 +1,61 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
const store = useStore('pomodoro-store');
const progress = computed({
get() {
return store.state.progress.length;
},
set() {
//
},
});
</script>
<template>
<div class="icon-bar-root">
<div class="icons-container">
<template v-for="(shortBreakIndex) in Array.from({ length: store.state.shortBreakCount }, (_, i) => i)" :key="shortBreakIndex">
<FontAwesomeIcon icon="fa-solid fa-computer" :class="{ active: progress === shortBreakIndex * 2 + 1, completed: progress > shortBreakIndex * 2 + 1 }" />
<FontAwesomeIcon icon="fa-solid fa-mug-hot" :class="{ active: progress === shortBreakIndex * 2 + 2, completed: progress > shortBreakIndex * 2 + 2 }" />
</template>
<FontAwesomeIcon icon="fa-solid fa-computer" :class="{ active: progress === store.state.shortBreakCount * 2 + 1, completed: progress > store.state.shortBreakCount * 2 + 1 }" />
<FontAwesomeIcon icon="fa-solid fa-person-walking" :class="{ active: progress === store.state.shortBreakCount * 2 + 2, completed: progress > store.state.shortBreakCount * 2 + 2 }" />
</div>
</div>
</template>
<style scoped>
.icon-bar-root{
width: 90%;
}
.icons-container {
display: flex;
justify-content: space-evenly;
margin-bottom: 1.875rem;
}
i {
line-height: 28px;
padding: 0.1875rem 0.3125rem;
margin: 0 0.3125rem;
color: lightgray;
font-size: 1.375rem;
border-radius: 0.5rem;
}
.active {
color: var(--pomodoro-app-accent-color);
box-shadow: orange 0 0 4px 5px;
}
.completed {
color: var(--pomodoro-app-accent-color);
}
@media only screen and (min-width: 900px) {
i {
line-height: 2.5rem;
font-size: 2.125rem;
}
}
</style>
@@ -0,0 +1,31 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
const props = defineProps({
id: String,
label: String,
min: Number,
max: Number,
});
const store = useStore('pomodoro-store');
// bind v-model="number" to the vuex store
const number = computed({
get() {
return store.state[props.id];
},
set(value) {
store.commit('updateTimeSetting', { propName: props.id, propValue: value });
},
});
// on created...
// store.commit('updateTimeSetting', { propName: props.id, propValue: props.initialValue })
</script>
<template>
<label :for="id" class="settings-label">{{ label }}</label>
<input :id="id" v-model="number" type="number" :min="min" :max="max">
</template>
@@ -0,0 +1,33 @@
<script setup>
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
</script>
<template>
<div class="pp-btn-container">
<FontAwesomeIcon v-show="!$store.state.isTimerRunning" role="button" icon="fa-solid fa-circle-play" @click="$store.commit('toggleTimer')" />
<FontAwesomeIcon v-show="$store.state.isTimerRunning" role="button" icon="fa-solid fa-circle-pause" @click="$store.commit('toggleTimer')" />
</div>
</template>
<style scoped>
.pp-btn-container {
display: inline;
padding: 1.25rem 0rem 1.25rem 1.25rem;
text-align: center;
}
i {
box-shadow: 0px 3px 5px -1px rgb(0 0 0 / 20%), 0px 6px 10px 0px rgb(0 0 0 / 14%), 0px 1px 18px 0px rgb(0 0 0 / 12%);
font-size: 4rem;
cursor: pointer;
color: var(--pomodoro-app-accent-color);
border-radius: 50%;
}
@media only screen and (max-width: 430px) {
.pp-btn-container {
display: block;
padding: 1.25rem;
}
}
</style>
@@ -0,0 +1,46 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
const store = useStore('pomodoro-store');
const progressWidth = computed({
get() {
return store.state.progressPercent;
},
set() {
//
},
});
</script>
<template>
<div class="progress-bar">
<div class="progress" :style="{ width: `${progressWidth}%` }" />
</div>
</template>
<style scoped>
.progress-bar {
width: 90%;
height: 2.5rem;
background-color: #eee;
border-radius: 0.375rem;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
border: 2px solid var(--pomodoro-app-accent-color);
}
.progress {
width: 0;
height: 100%;
background-color: orange;
border-radius: 0.25rem;
}
@media only screen and (max-width: 900px) {
.progress {
height: 1.3125rem;
}
.progress-bar {
height: 1.5625rem;
}
}
</style>
@@ -0,0 +1,48 @@
<script setup>
import { useStore } from 'vuex';
const store = useStore('pomodoro-store');
</script>
<template>
<div class="dropup">
<button class="dropup-btn" @click="store.commit('toggleResetDropup')">
RESET
</button>
<div v-if="store.state.isResetDropupVisible" class="dropup-content">
<button class="reset-btns" @click="store.commit('timerResetAll')">
Reset All
</button>
<button class="reset-btns" @click="store.commit('timerResetCurrent')">
Reset Current
</button>
</div>
</div>
</template>
<style scoped>
.dropup-btn {
background-color: white;
color: var(--pomodoro-app-accent-color);
border: 0.0625rem solid var(--pomodoro-app-accent-color);
box-shadow: none;
width: 11.125rem;
}
.dropup {
position: relative;
display: block;
text-align: center;
padding-top: 1.25rem;
}
.dropup-content {
position: absolute;
bottom: 50px;
z-index: 1;
background-color: white;
padding: 0.625rem;
box-shadow: 1px 1px 7px -4px black;
}
.reset-btns {
margin: 0.625rem;
}
</style>
@@ -0,0 +1,85 @@
import { createStore } from 'vuex';
import { setAppAccentColor, setupNextTimerMode, startOver, startTimer, stopAlarms, stopTimer } from '../storeUtils.js';
export default createStore({
state: {
counter: '25:00',
time: 0,
workInterval: 25,
shortBreak: 5,
shortBreakCount: 3,
longBreak: 30,
isTimerRunning: false,
isTimerInProgress: false,
isShowFinishedPopup: false,
isResetDropupVisible: false,
isFirstVisit: true,
prefersAlarmSound: false,
progress: ['workInterval'],
finishedMessage: '',
appAccentColor: '#3b83b0',
progressPercent: 0,
currentTab: 'home',
},
mutations: {
goToPage(state, payload) {
state.currentTab = payload;
},
setInitialTimer(state) {
setupNextTimerMode(state);
},
setFirstVisitStatus(state, payload) {
state.isFirstVisit = payload.propValue;
},
updateTimeSetting(state, payload) {
state[payload.propName] = payload.propValue;
// eslint-disable-next-line no-unused-expressions
state.isTimerInProgress ? {} : setupNextTimerMode(state);
},
updateAppColor(state, payload) {
state[payload.propName] = payload.propValue;
setAppAccentColor(payload.propValue);
},
toggleAlarmSound(state) {
state.prefersAlarmSound = !state.prefersAlarmSound;
},
toggleTimer(state) {
state.isTimerRunning ? stopTimer(state) : startTimer(state);
},
toggleResetDropup(state) {
state.isResetDropupVisible = !state.isResetDropupVisible;
},
setProgressBarPercent(state, payload) {
state.progressPercent = payload.propValue;
},
prepareNextTimerMode(state) {
stopAlarms();
state.isShowFinishedPopup = false;
setupNextTimerMode(state);
},
timerResetCurrent(state) {
stopTimer(state);
const currentMode = state.progress[state.progress.length - 1];
this.commit('updateTimeSetting', { propName: currentMode, propValue: state[currentMode] });
setupNextTimerMode(state);
state.isResetDropupVisible = false;
},
timerResetAll(state) {
startOver(state);
},
restoreDefaultSettings(state) {
this.commit('updateTimeSetting', { propName: 'workInterval', propValue: 25 });
this.commit('updateTimeSetting', { propName: 'shortBreak', propValue: 5 });
this.commit('updateTimeSetting', { propName: 'shortBreakCount', propValue: 3 });
this.commit('updateTimeSetting', { propName: 'longBreak', propValue: 30 });
state.prefersAlarmSound = false;
this.commit('updateAppColor', { propName: 'appAccentColor', propValue: '#3b83b0' });
},
},
actions: {
},
modules: {
},
});
+146
View File
@@ -0,0 +1,146 @@
function el(idString) {
return document.getElementById(idString);
}
function msToString(ms) {
return new Date(ms).toISOString().slice(14, 19);
}
let titleInterval = null;
function startTitleAlarm(str, delay) {
titleInterval = setInterval(() => {
document.title.startsWith('⏰')
? document.title = `${str} - IT Tools`
: document.title = '⏰⏰⏰⏰⏰⏰⏰⏰⏰⏰' + ' - IT Tools';
}, delay);
}
function stopTitleAlarm() {
// eslint-disable-next-line no-alert
titleInterval ? clearInterval(titleInterval) : alert('Error: something went wrong when trying to stop the title alarm.');
document.title = 'Pomodoro Timer - IT Tools';
}
function getNextTimerMode(state) {
const currentMode = state.progress[state.progress.length - 1];
if (currentMode === 'workInterval') {
return state.progress.length === state.shortBreakCount * 2 + 1 ? 'longBreak' : 'shortBreak';
}
else {
return 'workInterval';
}
}
function formatModeToText(mode) {
if (mode === 'workInterval') {
return 'work interval';
}
if (mode === 'shortBreak') {
return 'short break';
}
if (mode === 'longBreak') {
return 'long break';
}
}
function getAlarmText(nextMode) {
if (nextMode === 'workInterval') {
return 'Work Time';
}
if (nextMode === 'shortBreak') {
return 'Short Break Time';
}
if (nextMode === 'longBreak') {
return 'Long Break Time';
}
}
function startOver(state) {
stopTimer(state);
state.isTimerInProgress = false;
state.progress = ['workInterval'];
setupNextTimerMode(state);
state.isResetDropupVisible = false;
}
function onTimerFinished(state, alarmPlayer) {
state.counter = '00:00';
state.time = 0;
state.progressPercent = 100;
const oldMode = state.progress[state.progress.length - 1];
const newMode = getNextTimerMode(state);
state.progress.push(newMode);
const oldModeText = formatModeToText(oldMode);
const newModeText = formatModeToText(newMode);
state.finishedMessage = `The ${oldModeText} timer has finished. Next up is a ${newModeText}.`;
state.isShowFinishedPopup = true;
const titleText = getAlarmText(newMode);
startTitleAlarm(titleText, 500);
if (state.prefersAlarmSound) {
alarmPlayer.play();
}
stopTimer(state);
}
function setupNextTimerMode(state) {
if (state.progress.length === state.shortBreakCount * 2 + 2) {
startOver(state);
}
else {
const timerMode = state.progress[state.progress.length - 1];
state.time = state[timerMode] * 60000;
state.counter = msToString(state.time);
state.progressPercent = 0;
}
}
function stopAlarms() {
el('alarmPlayer').pause();
stopTitleAlarm();
}
let timerInterval = null;
function startTimer(state) {
state.isTimerRunning = true;
state.isTimerInProgress = true;
const timerMode = state.progress[state.progress.length - 1];
const totalModeTime = state[timerMode] * 60000;
const remainingTime = state.time;
const startTime = Date.now();
timerInterval = setInterval(() => {
const timeElapsed = Date.now() - startTime;
const newRemainingTime = remainingTime - timeElapsed;
if (newRemainingTime <= 0) {
onTimerFinished(state, el('alarmPlayer'));
return;
}
state.time = newRemainingTime;
state.counter = msToString(newRemainingTime);
state.progressPercent = (totalModeTime - newRemainingTime) / totalModeTime * 100;
}, 200);
}
function stopTimer(state) {
if (timerInterval) {
clearInterval(timerInterval);
}
state.isTimerRunning = false;
}
function setAppAccentColor(hexColor) {
const root = document.querySelector(':root');
root.style.setProperty('--pomodoro-app-accent-color', hexColor);
}
export {
startTimer,
stopTimer,
startOver,
setupNextTimerMode,
stopAlarms,
setAppAccentColor,
};
@@ -0,0 +1,40 @@
<template>
<div class="about-root">
<h1>About</h1>
<h2>The Pomodoro Technique</h2>
<p>
The Pomodoro Technique is a time management method developed by Francesco Cirillo in the 1980s. It uses a
timer to break work into intervals, typically 25 minutes in length, separated by short breaks. Each interval
is known as a pomodoro, from the Italian word for tomato, after the tomato-shaped kitchen timer Cirillo used
as a university student.
</p>
<h2>Five steps of the Pomodoro Technique</h2>
<ol>
<li>Decide on a task and set the timer (25 minutes is common).</li>
<li>Work on the task during that time.</li>
<li>When the timer rings, take a short break (5-10 minutes is common).</li>
<li>
Keep repeating Steps 1-3, but after your 4th task, take a long break instead of a short break (20-30
minutes is common).
</li>
<li>Once the long break is finished, return to Step 1.</li>
</ol>
<p>
Source: Wikipedia <a target="_blank" href="https://en.wikipedia.org/wiki/Pomodoro_Technique">https://en.wikipedia.org/wiki/Pomodoro_Technique</a>
</p>
</div>
</template>
<style scoped>
.about-root {
width: 90%;
}
p, ol {
font-size: 0.9375rem;
}
</style>
@@ -0,0 +1,61 @@
<script setup>
import { useStore } from 'vuex';
import ProgressBar from '../components/ProgressBar.vue';
import Counter from '../components/Counter.vue';
import PlayPauseBtn from '../components/PlayPauseBtn.vue';
import ResetDropup from '../components/ResetDropup.vue';
import ModeIconBar from '../components/ModeIconBar.vue';
const store = useStore('pomodoro-store');
</script>
<template>
<div v-if="$store.state.isFirstVisit" class="welcome-msg">
<p>Welcome!</p>
<p>
Go to <a style="cursor: pointer;" @click="store.commit('goToPage', 'settings')">
Settings
</a> to get started.
</p>
</div>
<div v-else class="home">
<div class="graphic">
<ModeIconBar />
<ProgressBar />
</div>
<div class="counter">
<Counter />
<PlayPauseBtn />
<ResetDropup />
</div>
</div>
</template>
<style scoped>
.home {
width: 100%;
display: grid;
grid-template-rows: 1fr auto;
grid-template-areas:
"graphic"
"counter";
}
.graphic {
grid-area: graphic;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.counter {
grid-area: counter;
justify-self: center;
padding-bottom: 1.25rem;
}
.welcome-msg {
font-size: 1.375rem;
text-align: center;
align-self: center;
margin-top: -5rem;
}
</style>
@@ -0,0 +1,63 @@
<script setup>
import { useStore } from 'vuex';
import NumberInput from '../components/NumberInput.vue';
import AppColorPicker from '../components/AppColorPicker.vue';
import AlarmSoundToggle from '../components/AlarmSoundToggle.vue';
const store = useStore('pomodoro-store');
store.commit('setInitialTimer');
store.commit('setFirstVisitStatus', { propValue: false });
</script>
<template>
<form>
<NumberInput id="workInterval" :min="1" :max="120" label="Work Interval" /><span>min</span><br>
<NumberInput id="shortBreak" :min="1" :max="120" label="Short break" /><span>min</span><br>
<NumberInput id="shortBreakCount" :min="1" :max="10" label="Short break count" /><span>breaks</span><br>
<NumberInput id="longBreak" :min="1" :max="120" label="Long break" /><span>min</span><br>
<AlarmSoundToggle id="prefersAlarmSound" label="Alarm Sound" /><br>
<AppColorPicker id="appAccentColor" label="App color" /><br>
<a class="lets-go" @click="store.commit('goToPage', 'home')">
LET'S GO!
</a>
<button type="button" class="reset-btn" @click="store.commit('restoreDefaultSettings')">
RESTORE DEFAULTS
</button>
</form>
</template>
<style scoped>
form {
align-self: center;
margin-top: -0.625rem;
font-size: 1.25rem;
}
.lets-go {
text-decoration: none;
outline: none!important;
border-style: none;
border: white 0.0625rem solid;
box-shadow: 1px 1px 7px -3px black;
border-radius: 0.375rem;
background-color: var(--pomodoro-app-accent-color);
color: var(--pomodoro-text-contrast-color);
padding: 10px 15px 9px 15px;
cursor: pointer;
margin: 0 auto;
display: block;
text-align: center;
width: 90%;
font-size: 1.125rem;
}
.reset-btn {
display: block;
margin: 0 auto;
margin-top: 1.25rem;
width: 90%;
background-color: white;
color: var(--pomodoro-app-accent-color);
border: 0.0625rem solid var(--pomodoro-app-accent-color);
box-shadow: none;
}
</style>
@@ -0,0 +1,48 @@
<script setup>
const store = useStore('pomodoro-store');
function goToHomeOrSettings() {
if (isWorkIntervalSet()) {
store.commit('goToHome');
}
else {
store.commit('goToSettings');
}
}
setTimeout(() => {
goToHomeOrSettings();
}, 2000);
</script>
<template>
<div class="splash-screen">
<p class="splash-title">
Pomodoro Timer
</p>
<p class="splash-loader">
Loading...
</p>
</div>
</template>
<style scoped>
.splash-screen {
position: absolute;
top: 0;
height: 100%;
width: 100%;
background-color: var(--pomodoro-app-accent-color);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
}
.splash-title {
font-size: 2.5rem;
}
.splash-loader {
font-size: 1.25rem;
}
</style>
+13
View File
@@ -0,0 +1,13 @@
import { CalendarTime } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Pomodoro Timer',
path: '/pomodoro-timer',
description: 'Basic Pomodoro Timer',
keywords: ['pomodoro', 'timer'],
component: () => import('./pomodoro-timer.vue'),
icon: CalendarTime,
createdAt: new Date('2025-03-09'),
category: 'Development',
});
@@ -0,0 +1,9 @@
<script setup lang="ts">
import PomodoroApp from './app/App.vue';
</script>
<template>
<div>
<PomodoroApp />
</div>
</template>
+2 -1
View File
@@ -15,6 +15,7 @@
"types": ["naive-ui/volar", "@intlify/unplugin-vue-i18n/messages", "unplugin-icons/types/vue"],
"esModuleInterop": true,
"jsx": "preserve",
"skipLibCheck": true
"skipLibCheck": true,
"allowJs": true
}
}