Skip to content

Commit a8b399f

Browse files
committed
Add running indicator animation and document in Guide
1 parent fa1cd78 commit a8b399f

File tree

7 files changed

+72
-12
lines changed

7 files changed

+72
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "myapp",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"private": true,
55
"homepage": "https://kroljs.com/LP-Timer",
66
"dependencies": {

src/components/pages/AboutPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function AboutPage() {
1515
<p>The front-end for this progressive web application is built using the JavaScript framework, <a href="https://reactjs.org" target="_blank" rel="noopener noreferrer">ReactJS v16.13.1</a>. It is hosted on GitHub Pages, and the code is entirely open-source for you to read, nitpick, and expand upon. The pre-build files may be found on <a href="https://github.com/jacobkrol/LP-Timer" target="_blank" rel="noopener noreferrer">GitHub</a>.</p>
1616
<p>To handle feedback submission, the back-end is built using <a href="https://nodejs.org" target="_blank" rel="noopener noreferrer">Node.js v13.8.0</a>, with the <a href="https://expressjs.com" target="_blank" rel="noopener noreferrer">Express v4.17.1</a> framework. It is hosted using <a href="https://heroku.com" target="_blank" rel="noopener noreferrer">Heroku</a> and implements a CORS-protected REST API endpoint for feedback submission. Feedback is submitted to the database through the endpoint, and via email through an SMTP client. Feedback review is strictly available through the <a href="https://devcenter.heroku.com/articles/heroku-cli" target="_blank" rel="noopener noreferrer">Heroku CLI v7.42.1</a> or through a locally-accessible endpoint.</p>
1717
<h3>Licensing</h3>
18-
<p>The limited preparation timer progressive web application is open-sourced with a MIT license. To read the conditions of this license, visit the <a href="https://github.com/jacobkrol/LP-Timer/blob/master/LICENSE" target="_blank" rel="noopener noreferrer">LICENSE file in the host repository</a>.</p>
18+
<p>The limited preparation timer progressive web application is open-sourced under a MIT license. To read the conditions of this license, visit the <a href="https://github.com/jacobkrol/LP-Timer/blob/master/LICENSE" target="_blank" rel="noopener noreferrer">LICENSE file in the host repository</a>.</p>
1919
</div>
2020
)
2121
}

src/components/pages/GuidePage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function HowPage() {
1717
<p><strong>Status: Off</strong> represents a new timer.</p>
1818
<p><strong>Status: Running</strong> means the timer is running (even if you can't see it!)</p>
1919
<p><strong>Status: Paused</strong> represents a timer that has started, but has been paused by the user. When it is resumed, it will continue where it was when paused.</p>
20+
<p> The <span id="timer-anim-ex" aria-label="indicator"></span> in the top-left corner of each timer serves as an additional indicator that the timer is running.</p>
2021

2122
<h3>Extemporaneous Timer</h3>
2223
<p><strong>Duration:</strong> 7 minutes</p>

src/components/utilities/Footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
55
function Footer() {
66
return (
77
<footer>
8-
<p>LP Timer PWA v1.1.1 - Copyright 2020 <a href="https://kroljs.com" target="_blank" rel="noopener noreferrer">Jacob Krol</a> - <Link to="/about">Learn More</Link></p>
8+
<p>LP Timer PWA v1.2.0 - Copyright 2020 <a href="https://kroljs.com" target="_blank" rel="noopener noreferrer">Jacob Krol</a> - <Link to="/about">Learn More</Link></p>
99
</footer>
1010
)
1111
}

src/components/utilities/Timer.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import React from 'react';
2-
import { FaPlay, FaPause, FaStop, FaVolumeMute } from 'react-icons/fa';
2+
import {
3+
FaPlay,
4+
FaPause,
5+
FaStop,
6+
FaVolumeMute,
7+
FaHourglassEnd,
8+
FaHourglassHalf,
9+
FaHourglassStart
10+
} from 'react-icons/fa';
311
import '../../styles/Timer.css';
412
import Verbal30 from '../../audio/30-seconds-verbal.wav';
513
import Verbal60 from '../../audio/60-seconds-verbal.wav';
@@ -22,7 +30,8 @@ class Timer extends React.PureComponent {
2230
signalText: null, //string of hand signals
2331
isOvertime: false, //boolean flagging overtime
2432
isMuted: true, //boolean to mute verbals
25-
playVerbal: 0 //int 0,30,60,90 for last verbal given
33+
playVerbal: 0, //int 0,30,60,90 for last verbal given
34+
hourglass: 0
2635
};
2736
}
2837

@@ -33,6 +42,7 @@ class Timer extends React.PureComponent {
3342
if(this.props.mode === "imp") this.setState({isMuted: false});
3443
//font debugging
3544
if(this.props.mode === "test") this.setState({signalText: "30 sec"});
45+
3646
}
3747

3848
componentWillUnmount() {
@@ -58,6 +68,7 @@ class Timer extends React.PureComponent {
5868
break;
5969
case 90:
6070
verbal = Verbal90;
71+
this.setState({isMuted: true});
6172
break;
6273
default:
6374
break;
@@ -91,6 +102,7 @@ class Timer extends React.PureComponent {
91102
this.setState({status: "running"}, () => {
92103
document.getElementById("timer-status").innerText = this.state.status[0].toUpperCase()+this.state.status.substr(1);
93104
});
105+
document.getElementById("timer-anim-fill").className = "run";
94106
}
95107

96108
pauseTimer = () => {
@@ -102,6 +114,7 @@ class Timer extends React.PureComponent {
102114
}, () => {
103115
document.getElementById("timer-status").innerText = this.state.status[0].toUpperCase()+this.state.status.substr(1);
104116
});
117+
document.getElementById("timer-anim-fill").className = "";
105118
}
106119

107120
updateTimer = () => {
@@ -145,7 +158,7 @@ class Timer extends React.PureComponent {
145158
this.setState({playVerbal: 60});
146159
} else if(Number(min) === this.props.min-2 && Number(sec) === 30) {
147160
//trigger 90 second verbal
148-
this.setState({playVerbal: 90, isMuted: true});
161+
this.setState({playVerbal: 90});
149162
}
150163

151164
//hand signals
@@ -195,6 +208,7 @@ class Timer extends React.PureComponent {
195208
}, () => {
196209
document.getElementById("timer-status").innerText = this.state.status[0].toUpperCase()+this.state.status.substr(1);
197210
});
211+
document.getElementById("timer-anim-fill").className = "";
198212
}
199213

200214
handleKeyPush = (evt) => {
@@ -231,12 +245,17 @@ class Timer extends React.PureComponent {
231245
</div>
232246
</div>
233247
<div id="timer-display">
234-
{this.props.mode === "none"
235-
? this.props.showMS
236-
? <p><span id="timer-display-min">{this.props.min}</span><span id="timer-display-sec">00</span><span id="timer-display-ms">000</span></p>
237-
: <p><span id="timer-display-min">{this.props.min}</span><span id="timer-display-sec">00</span></p>
238-
: <p><span id="timer-display-signal">{this.state.signalText}</span></p>
239-
}
248+
<div id="timer-anim-box">
249+
<div id="timer-anim-fill"></div>
250+
</div>
251+
<div id="timer-text">
252+
{this.props.mode === "none"
253+
? this.props.showMS
254+
? <p><span id="timer-display-min">{this.props.min}</span><span id="timer-display-sec">00</span><span id="timer-display-ms">000</span></p>
255+
: <p><span id="timer-display-min">{this.props.min}</span><span id="timer-display-sec">00</span></p>
256+
: <p><span id="timer-display-signal">{this.state.signalText}</span></p>
257+
}
258+
</div>
240259
</div>
241260
</div>
242261
)

src/styles/GuidePage.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
padding: 4px;
2222
}
2323

24+
#timer-anim-ex {
25+
display: inline-block;
26+
height: 12px;
27+
width: 12px;
28+
margin: 0;
29+
border: 2px solid rgba(40,40,40,0.5);
30+
border-radius: 4px;
31+
background-color: transparent;
32+
}
33+
2434
.no-break {
2535
white-space: nowrap;
2636
}

src/styles/Timer.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,36 @@
6161
} */
6262
}
6363

64+
/* ADD TIMER ANIMATION */
65+
#timer-anim-box {
66+
margin: 10px;
67+
height: 20px;
68+
width: 20px;
69+
border: 4px solid rgba(40,40,40,0.5);
70+
border-radius: 5px;
71+
background-color: transparent;
72+
}
73+
#timer-anim-fill {
74+
height: 100%;
75+
width: 0%;
76+
background-color: rgba(40,40,40,0.5);
77+
border-radius: 0px;
78+
}
79+
#timer-anim-fill.run {
80+
animation: myfill 5s infinite;
81+
}
82+
@keyframes myfill {
83+
50% {
84+
width: 100%;
85+
}
86+
100% {
87+
width: 0%;
88+
}
89+
}
90+
#timer-text {
91+
margin-top: -40px;
92+
}
93+
6494
/* DEFINE FONT FACES */
6595
#timer-display-min, #timer-display-sec, #timer-display-ms {
6696
font-family: 'Cursed Timer', 'Titillium Web', Arial, sans-serif;

0 commit comments

Comments
 (0)