1
- import React , { Component } from " react" ;
1
+ import React , { Component } from ' react' ;
2
2
3
- import { Ticket , Sphere , Input , Status } from " ./components" ;
3
+ import { Ticket , Sphere , Input , Status } from ' ./components' ;
4
4
5
- const STORAGE_KEY = " appState" ;
5
+ const STORAGE_KEY = ' appState' ;
6
6
7
7
const tickets = [
8
8
{
@@ -11,20 +11,20 @@ const tickets = [
11
11
[ 7 , 23 , 44 , 46 , 72 ] ,
12
12
[ 11 , 26 , 43 , 50 , 64 ] ,
13
13
[ 14 , 29 , 35 , 48 , 66 ] ,
14
- [ 6 , 24 , 41 , 60 , 69 ]
14
+ [ 6 , 24 , 41 , 60 , 69 ] ,
15
15
] ,
16
- number : " 0642953"
16
+ number : ' 0642953' ,
17
17
} ,
18
18
{
19
19
values : [
20
20
[ 7 , 27 , 39 , 51 , 66 ] ,
21
21
[ 11 , 20 , 33 , 49 , 68 ] ,
22
22
[ 8 , 18 , 45 , 57 , 75 ] ,
23
23
[ 13 , 21 , 36 , 53 , 65 ] ,
24
- [ 10 , 30 , 37 , 52 , 72 ]
24
+ [ 10 , 30 , 37 , 52 , 72 ] ,
25
25
] ,
26
- number : " 0657387"
27
- }
26
+ number : ' 0657387' ,
27
+ } ,
28
28
] ;
29
29
30
30
class App extends Component {
@@ -36,15 +36,15 @@ class App extends Component {
36
36
getInitialState = ( ) => {
37
37
const initialState = {
38
38
rolledValues : [ ] ,
39
- value : "" ,
40
- removeValue : "" ,
39
+ value : '' ,
40
+ removeValue : '' ,
41
41
status : {
42
- color : " default" ,
43
- message : ""
42
+ color : ' default' ,
43
+ message : '' ,
44
44
} ,
45
45
options : {
46
- isTicketsClickable : false
47
- }
46
+ isTicketsClickable : false ,
47
+ } ,
48
48
} ;
49
49
50
50
return initialState ;
@@ -69,7 +69,7 @@ class App extends Component {
69
69
countOccurencies = number => {
70
70
let occurenciesCount = 0 ;
71
71
tickets . map ( ticket => {
72
- const arr = ticket . values . toString ( ) . split ( "," ) ;
72
+ const arr = ticket . values . toString ( ) . split ( ',' ) ;
73
73
occurenciesCount += arr . reduce ( ( a , v ) => ( v === number ? ++ a : a ) , 0 ) ;
74
74
} ) ;
75
75
return occurenciesCount ;
@@ -80,10 +80,10 @@ class App extends Component {
80
80
const count = this . countOccurencies ( number ) ;
81
81
if ( count > 0 ) {
82
82
count === 1
83
- ? this . setStatusMessage ( " green" , `Išbrauktas ${ count } langelis` )
84
- : this . setStatusMessage ( " green" , `Išbraukti ${ count } langeliai` ) ;
83
+ ? this . setStatusMessage ( ' green' , `Išbrauktas ${ count } langelis` )
84
+ : this . setStatusMessage ( ' green' , `Išbraukti ${ count } langeliai` ) ;
85
85
} else {
86
- this . setStatusMessage ( " default" , " Nerasta" ) ;
86
+ this . setStatusMessage ( ' default' , ' Nerasta' ) ;
87
87
}
88
88
89
89
this . pushStateToStorage ( ) ;
@@ -93,8 +93,8 @@ class App extends Component {
93
93
const regexDigits = / \D / ;
94
94
const regexTwoDigits = / ( ^ [ \d ] { 2 } ) [ \d ] / ;
95
95
const value = inputValue
96
- . replace ( regexDigits , "" )
97
- . replace ( regexTwoDigits , "$1" ) ;
96
+ . replace ( regexDigits , '' )
97
+ . replace ( regexTwoDigits , '$1' ) ;
98
98
return value ;
99
99
} ;
100
100
@@ -113,12 +113,12 @@ class App extends Component {
113
113
) {
114
114
this . crossOutNumber ( value ) ;
115
115
}
116
- this . setState ( { value : "" } ) ;
116
+ this . setState ( { value : '' } ) ;
117
117
} ;
118
118
119
119
invalidateCache = ( ) => {
120
120
if (
121
- window . confirm ( " Ar tikrai? Bus ištrinti bilietai ir kamuoliukų istorija." )
121
+ window . confirm ( ' Ar tikrai? Bus ištrinti bilietai ir kamuoliukų istorija.' )
122
122
) {
123
123
localStorage . removeItem ( STORAGE_KEY ) ;
124
124
this . resetState ( ) ;
@@ -127,7 +127,7 @@ class App extends Component {
127
127
128
128
removeLastRolledValue = ( ) => {
129
129
if (
130
- window . confirm ( " Ar tikrai norite pašalinti paskutinį ridentą kamuoliuką?" )
130
+ window . confirm ( ' Ar tikrai norite pašalinti paskutinį ridentą kamuoliuką?' )
131
131
) {
132
132
this . setState ( { rolledValues : this . state . rolledValues . slice ( 0 , - 1 ) } ) ;
133
133
this . resetStatusMessage ( ) ;
@@ -138,24 +138,24 @@ class App extends Component {
138
138
componentWillMount ( ) {
139
139
var cache = JSON . parse ( localStorage . getItem ( STORAGE_KEY ) ) ;
140
140
if ( cache != null ) {
141
- this . setState ( { ...cache , value : "" } ) ;
141
+ this . setState ( { ...cache , value : '' } ) ;
142
142
}
143
143
}
144
144
145
145
handleIsClickableChange = ( ) =>
146
146
this . setState ( {
147
147
options : {
148
148
...this . state . options ,
149
- isTicketsClickable : ! this . state . options . isTicketsClickable
150
- }
149
+ isTicketsClickable : ! this . state . options . isTicketsClickable ,
150
+ } ,
151
151
} ) ;
152
152
153
153
render ( ) {
154
154
const {
155
155
rolledValues,
156
156
value,
157
157
status,
158
- options : { isTicketsClickable }
158
+ options : { isTicketsClickable } ,
159
159
} = this . state ;
160
160
return (
161
161
< div className = "App" >
0 commit comments