Skip to content
Merged
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
37 changes: 29 additions & 8 deletions src/renderer/components/drawer/Drawer-settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@
></div>
</div>
<div class="Setting-wrapper">
<p class="Setting-title">Auto-start Timer</p>
<p class="Setting-title">Auto-start Work Timer</p>
<div
class="Checkbox"
@click="selectAutoStartTimer"
:class="autoStartTimer ? 'is-active' : 'is-inactive'"
@click="selectAutoStartWorkTimer"
:class="autoStartWorkTimer ? 'is-active' : 'is-inactive'"
></div>
</div>
<div class="Setting-wrapper">
<p class="Setting-title">Auto-start Break Timer</p>
<div
class="Checkbox"
@click="selectAutoStartBreakTimer"
:class="autoStartBreakTimer ? 'is-active' : 'is-inactive'"
></div>
</div>
<div class="Setting-wrapper">
Expand Down Expand Up @@ -55,8 +63,12 @@ export default {
return this.$store.getters.alwaysOnTop
},

autoStartTimer() {
return this.$store.getters.autoStartTimer
autoStartWorkTimer() {
return this.$store.getters.autoStartWorkTimer
},

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

minToTray() {
Expand Down Expand Up @@ -87,10 +99,19 @@ export default {
this.$store.dispatch('setViewState', payload)
},

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

selectAutoStartBreakTimer() {
const payload = {
key: 'autoStartTimer',
val: !this.autoStartTimer
key: 'autoStartBreakTimer',
val: !this.autoStartBreakTimer
}
this.$store.dispatch('setSetting', payload)
this.$store.dispatch('setViewState', payload)
Expand Down
13 changes: 10 additions & 3 deletions src/renderer/components/timer/Timer-controller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import { logger } from '@/utils/logger'
export default {
computed: {
// store getters
autoStartTimer() {
return this.$store.getters.autoStartTimer
autoStartWorkTimer() {
return this.$store.getters.autoStartWorkTimer
},

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

currentRound() {
Expand Down Expand Up @@ -51,7 +55,10 @@ export default {
},
dispatchTimer() {
EventBus.$emit('timer-init', {
auto: this.autoStartTimer
auto:
this.currentRound === 'work'
? this.autoStartWorkTimer
: this.autoStartBreakTimer
})
}
},
Expand Down
18 changes: 13 additions & 5 deletions src/renderer/store/modules/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import { localStore } from './index'
const state = {
currentDrawer: 'appDrawerTimer',
drawerOpen: false,
autoStartTimer:
localStore.get('autoStartTimer') === undefined
autoStartWorkTimer:
localStore.get('autoStartWorkTimer') === undefined
? true
: localStore.get('autoStartTimer'),
: localStore.get('autoStartWorkTimer'),
autoStartBreakTimer:
localStore.get('autoStartBreakTimer') === undefined
? true
: localStore.get('autoStartBreakTimer'),
alwaysOnTop: localStore.get('alwaysOnTop'),
minToTray: localStore.get('minToTray'),
notifications: localStore.get('notifications'),
Expand All @@ -15,8 +19,12 @@ const state = {
}

const getters = {
autoStartTimer() {
return state.autoStartTimer
autoStartWorkTimer() {
return state.autoStartWorkTimer
},

autoStartBreakTimer() {
return state.autoStartBreakTimer
},

currentDrawer() {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/utils/LocalStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const defaults = generateSettings()
function generateSettings() {
return {
alwaysOnTop: false,
autoStartTimer: true,
autoStartWorkTimer: true,
autoStartBreakTimer: true,
minToTray: false,
notifications: true,
workRounds: 4,
Expand Down