Skip to content

Commit

Permalink
Add red border when in Pomodoro mode, and green border when in 'break…
Browse files Browse the repository at this point in the history
…' mode

Resolves #59
  • Loading branch information
dracan committed Feb 25, 2018
1 parent 23fdd84 commit d496634
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ ipcMain.on('pomodoro-stop', (evt) => {
slack.setDoNotDisturb(0)
})

ipcMain.on('break-stop', (evt) => {
countdown.stop()
})

ipcMain.on('get-settings', (evt) => {
settingsWindow && settingsWindow.webContents.send('got-settings', settings)
})
Expand Down
32 changes: 25 additions & 7 deletions src/renderer/Overlay.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="overlay">
<div id="overlay" v-bind:class="{ breakMode: isBreak }">
<div id="countdown">25:00</div>
<div id="buttons">
<i id="overlay-button-start-stop" class="fa fa-play overlay-button" onclick="onClickStartStop()"></i>
Expand All @@ -10,6 +10,7 @@
<style>
html, body {
overflow: hidden;
height: 100%;
}
</style>

Expand All @@ -24,14 +25,22 @@
}
#overlay {
border: 3px solid #800000;
background-color: black;
height: 100%;
color: white;
cursor: default;
display: flex;
justify-content: space-around;
align-items: center;
}
.breakMode {
border: 3px solid green !important;
}
border: 3px solid green; */
.overlay-button {
color: grey;
}
Expand All @@ -44,10 +53,19 @@
const ipc = electron.ipcRenderer
var audio = new Audio(path.join(__static, 'timer.wav'));
var audio = new Audio(path.join(__static, 'timer.wav'))
let pomodoroRunning = false
let isNextTimerABreak = false
const data = {
isBreak: false,
}
module.exports = {
data: function() {
return data
},
}
const getTimeString = (seconds) => {
let momentTime = moment.duration(seconds, 'seconds')
Expand All @@ -69,11 +87,11 @@
onClickStartStop = function () {
if(pomodoroRunning) {
onStop()
ipc.send(isNextTimerABreak ? "break-stop" : "pomodoro-stop")
isNextTimerABreak = false
ipc.send(data.isBreak ? "break-stop" : "pomodoro-stop")
data.isBreak = false
} else {
onStart()
ipc.send(isNextTimerABreak ? "break-start" : "pomodoro-start")
ipc.send(data.isBreak ? "break-start" : "pomodoro-start")
}
}
Expand All @@ -94,6 +112,6 @@
function onComplete() {
audio.play();
onStop()
isNextTimerABreak = !isNextTimerABreak
data.isBreak = !data.isBreak
}
</script>

0 comments on commit d496634

Please sign in to comment.