Skip to content

Commit

Permalink
Merge pull request #38 from hovancik/topic
Browse files Browse the repository at this point in the history
New stuff for 0.4.0
  • Loading branch information
hovancik authored Nov 6, 2016
2 parents 2481fe8 + f9c7998 commit 6f74ff8
Show file tree
Hide file tree
Showing 24 changed files with 636 additions and 150 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
npm-debug.log
.DS_Store
dist
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [0.4.0] - 2016-11-05
### Fixed
- version check when offline

### Changed
- settings window split into 2

### Added
- start break anytime from menu
- longer breaks
- enable/disable microbreaks and breaks
- skip to next break/microbreak anytime from menu
- notification on breaks resume
- notification when entering Settings that settings are applied once changed
- reset settings to the defaults
- reset (restart) breaks from menu

## [0.3.0] - 2016-10-15
### Added
Expand Down Expand Up @@ -47,7 +58,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- resume/pause functionality for reminder
- scripts for creating installers for OS X, Windows, Linux

[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.3.0...HEAD
[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.4.0...HEAD
[0.4.0]: https://github.com/hovancik/stretchly/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/hovancik/stretchly/compare/v0.2.1...v0.3.0
[0.2.1]: https://github.com/hovancik/stretchly/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/hovancik/stretchly/compare/v0.1.1...v0.2.0
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Feel free to join development of this app via Issues and Pull Requests.
- [x] create about page
- [x] only one instance
- [ ] notification on 2nd instance
- [ ] create longer breaks (5min every 30 minutes)
- [x] create longer breaks (5min every 30 minutes)
- [x] create settings for breaks
- [x] remember settings after restart
- [x] autostart app
Expand All @@ -58,6 +58,7 @@ Feel free to join development of this app via Issues and Pull Requests.
- [ ] color-picker for themes
- [x] sound notification at the end of the break
- [ ] information about when will be the next break
- [ ] strict mode (can't finish break early)

### Contributors
*(by date of the first contribution)*
Expand All @@ -70,6 +71,8 @@ Feel free to join development of this app via Issues and Pull Requests.
- https://github.com/typefoo/node-icns
- https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
- http://web.stanford.edu/dept/EHS/prod/general/ergo/microbreaks.html
- https://www.spineuniverse.com/wellness/ergonomics/workstation-ergonomics-take-break
- http://www.lifehack.org/articles/productivity/21-counter-intuitive-break-ideas-to-boost-your-productivity-at-work.html
- http://www.latofonts.com/lato-free-fonts/

#### Sounds credits
Expand Down
18 changes: 18 additions & 0 deletions app/break.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Time to take a break!</title>
<link rel="stylesheet" type="text/css" href="css/app.css">
</head>
<body>
<div class="microbreak">
<div class="break-idea"></div>
<div class="break-text"></div>
<a id="close">...nah, I'll just keep going on</a>
</div>
<script>
require('./break.js')
</script>
</body>
</html>
12 changes: 12 additions & 0 deletions app/break.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const {ipcRenderer} = require('electron')

document.getElementById('close').addEventListener('click', function (e) {
ipcRenderer.send('finish-break', false)
})

ipcRenderer.on('breakIdea', (event, message) => {
let breakIdea = document.getElementsByClassName('break-idea')[0]
breakIdea.innerHTML = message[0]
let breakText = document.getElementsByClassName('break-text')[0]
breakText.innerHTML = message[1]
})
14 changes: 14 additions & 0 deletions app/breakIdeas.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions app/breaksPlanner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const Scheduler = require('./utils/scheduler')

class BreaksPlanner {
constructor (settings, microbreakFunc, breakFunc) {
this.settings = settings
this.microbreakFunc = microbreakFunc
this.breakFunc = breakFunc
this.breakNumber = 0
this.scheduler = null
}

get nextBreak () {
let shouldBreak = this.settings.get('break')
let shouldMicrobreak = this.settings.get('microbreak')
let interval = this.settings.get('microbreakInterval')
if (!shouldBreak && shouldMicrobreak) {
this.scheduler = new Scheduler(this.microbreakFunc, interval)
} else if (shouldBreak && !shouldMicrobreak) {
this.scheduler = new Scheduler(this.breakFunc, interval * (this.settings.get('breakInterval') + 1))
} else if (shouldBreak && shouldMicrobreak) {
this.breakNumber = this.breakNumber + 1
let breakInterval = this.settings.get('breakInterval') + 1
if (this.breakNumber % breakInterval === 0) {
this.scheduler = new Scheduler(this.breakFunc, interval)
} else {
this.scheduler = new Scheduler(this.microbreakFunc, interval)
}
}
return this.scheduler
}

skipToMicrobreak () {
this.scheduler.cancel()
let shouldBreak = this.settings.get('break')
let shouldMicrobreak = this.settings.get('microbreak')
let breakInterval = this.settings.get('breakInterval') + 1
if (shouldBreak && shouldMicrobreak) {
if (this.breakNumber % breakInterval === 0) {
this.breakNumber = 1
}
}
this.scheduler = new Scheduler(this.microbreakFunc, 100)
return this.scheduler
}

skipToBreak () {
this.scheduler.cancel()
let shouldBreak = this.settings.get('break')
let shouldMicrobreak = this.settings.get('microbreak')
if (shouldBreak && shouldMicrobreak) {
let breakInterval = this.settings.get('breakInterval') + 1
this.breakNumber = breakInterval
}
this.scheduler = new Scheduler(this.breakFunc, 100)
return this.scheduler
}

pause () {
this.scheduler.cancel()
this.breakNumber = 0
}

resume () {
return this.nextBreak
}

reset () {
this.pause()
this.resume()
}
}

module.exports = BreaksPlanner
33 changes: 31 additions & 2 deletions app/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ body {
padding-top: 20px;
}

.scheme {
.scheme,
.enabled {
display: inline-block;
text-align: center;
width: 130px;
Expand All @@ -45,14 +46,42 @@ body {
cursor: pointer;
}

.break-idea,
.microbreak-idea,
.about-name,
.start-name {
font-size: 70px;
}

.break-text {
padding-top: 30px;
}

.previous,
.next {
position: absolute;
top: 35%;
font-size: 60px;
}

.previous {
left: 20px;
}

.next {
right: 20px;
}

.previous a,
.next a {
color: #fff;
text-decoration: none;
font-size: 90px;
}

#close,
#about-footer {
#about-footer,
#defaults {
color: #fff;
position: absolute;
bottom: 20px;
Expand Down
Loading

0 comments on commit 6f74ff8

Please sign in to comment.