File tree Expand file tree Collapse file tree 5 files changed +33
-8
lines changed Expand file tree Collapse file tree 5 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 1.2.0] - 2021-06-01
9+
10+ ### Added
11+
12+ - Progress bar
13+
814## [ 1.1.2] - 2021-05-31
915
1016### Fixed
Original file line number Diff line number Diff line change 1111 "repository" : {
1212 "url" : " https://github.com/cupcakearmy/unpixel"
1313 },
14- "version" : " 1.1.2 " ,
14+ "version" : " 1.2.0 " ,
1515 "main" : " ./dist/back/index.js" ,
1616 "scripts" : {
1717 "start" : " electron ." ,
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ export default class Updater {
3838 . then ( ( { response } ) => {
3939 if ( response === 0 ) {
4040 shell . openExternal ( 'https://github.com/cupcakearmy/unpixel/releases' )
41- process . exit ( 0 )
4241 }
4342 } )
4443 } else {
Original file line number Diff line number Diff line change @@ -19,11 +19,6 @@ main {
1919 align-items : center;
2020}
2121
22- h1 {
23- border-bottom : 0.5em solid currentColor;
24- padding-bottom : 0.15em ;
25- }
26-
2722.countdown {
2823 font-size : min (8rem , 25vh );
2924}
@@ -58,3 +53,16 @@ button {
5853button : hover {
5954 background-color : # 2c2cce ;
6055}
56+
57+ .progress {
58+ width : 100% ;
59+ height : 3rem ;
60+ border : 0.125rem solid currentColor;
61+ }
62+
63+ .progress > div {
64+ background-color : currentColor;
65+ height : 100% ;
66+ width : 100% ;
67+ transition : width ease-out 250ms ;
68+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ const Banner: React.FC = () => {
3030
3131 const [ done , setDone ] = useState ( false )
3232 const [ auto , setAuto ] = useState ( false )
33+ const [ progress , setProgress ] = useState ( 100 )
34+ const [ max , setMax ] = useState ( 0 )
3335 const [ countdown , setCountdown ] = useState < null | number > ( null )
3436
3537 const handler = useCallback (
@@ -57,16 +59,26 @@ const Banner: React.FC = () => {
5759 }
5860 } , [ countdown ] )
5961
62+ useEffect ( ( ) => {
63+ if ( countdown !== null ) {
64+ setProgress ( ( countdown / max ) * 100 )
65+ }
66+ } , [ countdown , max ] )
67+
6068 useEffect ( ( ) => {
6169 const autoClose = ipcRenderer . sendSync ( 'load' , { key : 'autoClose' } )
6270 setAuto ( autoClose )
6371 const time = ipcRenderer . sendSync ( 'load' , { key : 'duration' } )
6472 setCountdown ( time )
73+ setMax ( time )
6574 } , [ ] )
6675
6776 return (
6877 < div >
69- < h1 className = "ma0 mb4" > Look Away</ h1 >
78+ < h1 className = "ma0 mb3" > Look Away</ h1 >
79+ < div className = "progress mb4" >
80+ < div style = { { width : progress . toFixed ( 2 ) + '%' } } />
81+ </ div >
7082 < div className = "code countdown" > { countdown } </ div >
7183 < div className = "tile message" >
7284 Look at least < b > 6 meters</ b > away. < br />
You can’t perform that action at this time.
0 commit comments