Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: reset round #269

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29,977 changes: 16,470 additions & 13,507 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"del": "^5.1.0",
"devtron": "^1.4.0",
"electron": "^11.0.1",
"electron-builder": "^22.10.5",
"electron-builder": "^22.11.4",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0",
"eslint": "^7.26.0",
Expand All @@ -145,7 +145,7 @@
"mini-css-extract-plugin": "^0.11.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.14.1",
"sass": "^1.66.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.2.1",
"url-loader": "^4.1.1",
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/components/TrayIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import { EventBus } from '@/utils/EventBus'
export default {
data() {
return {
currentRound: null,
paused: true,
lastElapsed: 0,
total: 1
}
},

computed: {
currentRound() {
return this.$store.getters.currentRound
},

minToTray() {
return this.$store.getters.minToTray
}
Expand Down Expand Up @@ -45,19 +48,16 @@ export default {
}

EventBus.$on('ready-long-break', () => {
this.currentRound = 'long-break'
this.lastElapsed = -1
updateTrayImage(0, 1)
})

EventBus.$on('ready-short-break', () => {
this.currentRound = 'short-break'
this.lastElapsed = -1
updateTrayImage(0, 1)
})

EventBus.$on('ready-work', () => {
this.currentRound = 'work'
this.lastElapsed = -1
updateTrayImage(0, 1)
})
Expand Down
21 changes: 21 additions & 0 deletions src/renderer/components/drawer/Drawer-settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
:class="minToTrayOnClose ? 'is-active' : 'is-inactive'"
></div>
</div>
<div class="Setting-wrapper">
<p class="Setting-title">Right Click to Reset Round</p>
<div
class="Checkbox"
@click="selectRightClickToResetRound"
:class="rightClickToResetRound ? 'is-active' : 'is-inactive'"
></div>
</div>

<p class="Drawer-heading">Global Shortcuts</p>

Expand Down Expand Up @@ -139,6 +147,10 @@ export default {
return this.$store.getters.notifications
},

rightClickToResetRound() {
return this.$store.getters.rightClickToResetRound
},

os() {
return this.$store.getters.os
},
Expand Down Expand Up @@ -239,6 +251,15 @@ export default {
)
},

selectRightClickToResetRound() {
const payload = {
key: 'rightClickToResetRound',
val: !this.rightClickToResetRound
}
this.$store.dispatch('setSetting', payload)
this.$store.dispatch('setViewState', payload)
},

setGlobalShortcut(event, shortcut) {
const newShortcut = JSON.parse(JSON.stringify(this.globalShortcuts))
newShortcut[event] = shortcut
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/components/timer/Timer-footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>({{ totalWorkRounds }})</span
>
</p>
<p class="TextButton" title="Reset current round" @click="callForReset">
<p class="TextButton" title="Reset current round" @click="callForReset" @click.right="callForResetRound">
Reset
</p>
</div>
Expand Down Expand Up @@ -163,6 +163,12 @@ export default {
EventBus.$emit('call-timer-reset')
},

callForResetRound() {
if (this.$store.getters.rightClickToResetRound) {
EventBus.$emit('call-timer-reset-round')
}
},

/**
* Hides the volume slider unless the last recorded mouse position
* falls within a range containing the volume slider.
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/components/timer/Timer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ export default {
this.timerStarted = false
},

resetRound() {
this.$store.dispatch('setCurrentRound', 'work')
this.$store.dispatch('resetRound')
EventBus.$emit('timer-init', { auto: false })
},

resumeTimer() {
if (!this.timerWorker) return
this.timerWorker.postMessage({ event: 'resume' })
Expand Down Expand Up @@ -342,6 +348,11 @@ export default {

EventBus.$on('call-timer-reset', () => {
this.resetTimer()
logger.info(`${this.currentRoundDisplay} timer reset`)
})

EventBus.$on('call-timer-reset-round', () => {
this.resetRound()
logger.info(`${this.currentRoundDisplay} round reset`)
})

Expand Down
5 changes: 5 additions & 0 deletions src/renderer/store/modules/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const state = {
minToTray: localStore.get('minToTray'),
minToTrayOnClose: localStore.get('minToTrayOnClose'),
notifications: localStore.get('notifications'),
rightClickToResetRound: localStore.get('rightClickToResetRound'),
os: process.platform,
theme: localStore.get('theme') || 'Pomotroid'
}
Expand Down Expand Up @@ -57,6 +58,10 @@ const getters = {
return state.notifications
},

rightClickToResetRound() {
return state.rightClickToResetRound
},

os() {
return state.os
},
Expand Down