@vixoniccom/footbal-score 1.1.0-beta.0 → 1.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.2.0-beta.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.0.3...v1.2.0-beta.0) (2024-06-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * ISC license was added to the project ([bb3a175](https://bitbucket.org/vixonic_dev/football-score/commit/bb3a17548c7d057efdd909690ddd6a78e58c4e02))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * lint fixes ([051a434](https://bitbucket.org/vixonic_dev/football-score/commit/051a4344bd5fbc6ad3ec2be0341adaee7d2c8138))
16
+
17
+ ### [1.1.1](https://bitbucket.org/vixonic_dev/football-score/compare/v1.1.0-beta.0...v1.1.1) (2024-06-21)
18
+
5
19
  ## [1.1.0-beta.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.0.3...v1.1.0-beta.0) (2024-06-21)
6
20
 
7
21
 
package/build.zip CHANGED
Binary file
@@ -38,6 +38,30 @@
38
38
  "label": "Hora Inicio",
39
39
  "defaultValue": "6am",
40
40
  "items": [
41
+ {
42
+ "label": "12 am",
43
+ "value": "12am"
44
+ },
45
+ {
46
+ "label": "1 am",
47
+ "value": "1am"
48
+ },
49
+ {
50
+ "label": "2 am",
51
+ "value": "2am"
52
+ },
53
+ {
54
+ "label": "3 am",
55
+ "value": "3am"
56
+ },
57
+ {
58
+ "label": "4 am",
59
+ "value": "4am"
60
+ },
61
+ {
62
+ "label": "5 am",
63
+ "value": "5am"
64
+ },
41
65
  {
42
66
  "label": "6 am",
43
67
  "value": "6am"
@@ -61,6 +85,54 @@
61
85
  {
62
86
  "label": "11 am",
63
87
  "value": "11am"
88
+ },
89
+ {
90
+ "label": "12 pm",
91
+ "value": "12pm"
92
+ },
93
+ {
94
+ "label": "1 pm",
95
+ "value": "1pm"
96
+ },
97
+ {
98
+ "label": "2 pm",
99
+ "value": "2pm"
100
+ },
101
+ {
102
+ "label": "3 pm",
103
+ "value": "3pm"
104
+ },
105
+ {
106
+ "label": "4 pm",
107
+ "value": "4pm"
108
+ },
109
+ {
110
+ "label": "5 pm",
111
+ "value": "5pm"
112
+ },
113
+ {
114
+ "label": "6 pm",
115
+ "value": "6pm"
116
+ },
117
+ {
118
+ "label": "7 pm",
119
+ "value": "7pm"
120
+ },
121
+ {
122
+ "label": "8 pm",
123
+ "value": "8pm"
124
+ },
125
+ {
126
+ "label": "9 pm",
127
+ "value": "9pm"
128
+ },
129
+ {
130
+ "label": "10 pm",
131
+ "value": "10pm"
132
+ },
133
+ {
134
+ "label": "11 pm",
135
+ "value": "11pm"
64
136
  }
65
137
  ]
66
138
  },
@@ -71,6 +143,74 @@
71
143
  "label": "Hora Fin",
72
144
  "defaultValue": "7pm",
73
145
  "items": [
146
+ {
147
+ "label": "12 am",
148
+ "value": "12am"
149
+ },
150
+ {
151
+ "label": "1 am",
152
+ "value": "1am"
153
+ },
154
+ {
155
+ "label": "2 am",
156
+ "value": "2am"
157
+ },
158
+ {
159
+ "label": "3 am",
160
+ "value": "3am"
161
+ },
162
+ {
163
+ "label": "4 am",
164
+ "value": "4am"
165
+ },
166
+ {
167
+ "label": "5 am",
168
+ "value": "5am"
169
+ },
170
+ {
171
+ "label": "6 am",
172
+ "value": "6am"
173
+ },
174
+ {
175
+ "label": "7 am",
176
+ "value": "7am"
177
+ },
178
+ {
179
+ "label": "8 am",
180
+ "value": "8am"
181
+ },
182
+ {
183
+ "label": "9 am",
184
+ "value": "9am"
185
+ },
186
+ {
187
+ "label": "10 am",
188
+ "value": "10am"
189
+ },
190
+ {
191
+ "label": "11 am",
192
+ "value": "11am"
193
+ },
194
+ {
195
+ "label": "12 pm",
196
+ "value": "12pm"
197
+ },
198
+ {
199
+ "label": "1 pm",
200
+ "value": "1pm"
201
+ },
202
+ {
203
+ "label": "2 pm",
204
+ "value": "2pm"
205
+ },
206
+ {
207
+ "label": "3 pm",
208
+ "value": "3pm"
209
+ },
210
+ {
211
+ "label": "4 pm",
212
+ "value": "4pm"
213
+ },
74
214
  {
75
215
  "label": "5 pm",
76
216
  "value": "5pm"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixoniccom/footbal-score",
3
3
  "alias": "Resultados Deportivos",
4
- "version": "1.1.0-beta.0",
4
+ "version": "1.2.0-beta.0",
5
5
  "description": "Muestra resultados en vivo de fútbol.",
6
6
  "main": "main.js",
7
7
  "author": "",
package/src/App.tsx CHANGED
@@ -1,11 +1,11 @@
1
- import React, { useContext, useEffect, useState } from 'react';
2
- import { FontLoader } from './components/FontLoader';
3
- import { FormattedText } from './components/FormattedText';
4
- import { Table } from './components/table-fixture/Table';
5
- import { ConfigureContext } from './contex/configureContext/ConfigureContext';
6
- import { getFixture } from './helpers/getFixture';
7
- import localforage from 'localforage';
8
- import moment from 'moment';
1
+ import React, { useContext, useEffect, useState } from 'react'
2
+ import { FontLoader } from './components/FontLoader'
3
+ import { FormattedText } from './components/FormattedText'
4
+ import { Table } from './components/table-fixture/Table'
5
+ import { ConfigureContext } from './contex/configureContext/ConfigureContext'
6
+ import { getFixture } from './helpers/getFixture'
7
+ import localforage from 'localforage'
8
+ import moment from 'moment'
9
9
 
10
10
  type Props = {
11
11
  data: VixonicData,
@@ -13,37 +13,28 @@ type Props = {
13
13
  }
14
14
 
15
15
  export const App = ({ data, start }: Props) => {
16
-
17
-
18
- const [dataFixture, setDataFixture] = useState([]);
19
- const [league, setLeague] = useState('');
20
-
21
-
16
+ const [dataFixture, setDataFixture] = useState([])
17
+ const [league, setLeague] = useState('')
22
18
  const { configureState, addConfiguration } = useContext(ConfigureContext)
23
-
24
19
  const { parameters, downloadsPath } = configureState
25
-
26
- const { backgroundImage,
27
- padding,
28
- msj0 = '',
29
- updateTime
30
- } = parameters
31
-
32
- let backgroundImageState = backgroundImage && backgroundImage.filename
20
+ const { backgroundImage, padding, msj0 = '', updateTime } = parameters
21
+ const backgroundImageState = backgroundImage && backgroundImage.filename
33
22
  ? `url("${downloadsPath}/${backgroundImage.filename}")`
34
23
  : ''
35
24
 
36
25
  const getData = async () => {
37
- let dataLocal: any = await getLocalData()
38
- let momentLocalStorage: any = dataLocal ? moment().diff(dataLocal.date, 'millisecond') : undefined
39
- let timeNowFormat = moment().format('h:mma')
40
- let timeNow = moment(timeNowFormat, 'h:mma');
41
- let horaInicio = moment(data.parameters.timeStart, 'h:mma');
42
- let horaFin = moment(data.parameters.timeEnd, 'h:mma');
26
+ const dataLocal: any = await getLocalData()
27
+ const momentLocalStorage: any = dataLocal ? moment().diff(dataLocal.date, 'millisecond') : undefined
28
+ const timeNowFormat = moment().format('h:mma')
29
+ const timeNow = moment(timeNowFormat, 'h:mma')
30
+
31
+ const horaInicio = moment(data.parameters.timeStart, 'h:mma')
32
+ const horaFin = moment(data.parameters.timeEnd, 'h:mma')
33
+
43
34
  if (momentLocalStorage == undefined || (timeNow.isBetween(horaInicio, horaFin) && momentLocalStorage > updateTime!)) {
44
- const dataRequest = await getFixture(data.parameters.league!);
35
+ const dataRequest = await getFixture(data.parameters.league!)
45
36
  setDataLocal(dataRequest)
46
- setDataFixture(dataRequest);
37
+ setDataFixture(dataRequest)
47
38
  } else {
48
39
  setDataFixture(dataLocal.data)
49
40
  }
@@ -57,7 +48,7 @@ export const App = ({ data, start }: Props) => {
57
48
  addConfiguration(data)
58
49
  }, [data])
59
50
 
60
- useEffect(() =>{
51
+ useEffect(() => {
61
52
  if (league !== data.parameters.league) {
62
53
  setLeague(data.parameters.league!)
63
54
  localforage.clear()
@@ -86,7 +77,6 @@ export const App = ({ data, start }: Props) => {
86
77
  return dataLocal
87
78
  }
88
79
 
89
-
90
80
  return (
91
81
  dataFixture.length > 0 ?
92
82
  <div
@@ -110,7 +100,7 @@ export const App = ({ data, start }: Props) => {
110
100
  flex: '1 1 0%',
111
101
  flexDirection: 'column',
112
102
  }}>
113
- <FormattedText text={parameters.title0 || "Partidos Mundial"} format={parameters.titleFormat} />
103
+ <FormattedText text={parameters.title0 || 'Partidos Mundial'} format={parameters.titleFormat} />
114
104
  </div>
115
105
  }
116
106
  <Table dataFixture={dataFixture} />
@@ -136,9 +126,8 @@ export const App = ({ data, start }: Props) => {
136
126
  flex: '1 1 0%',
137
127
  flexDirection: 'column',
138
128
  }}>
139
- <FormattedText text={msj0 || "Sin partidos"} format={parameters.formatMjs} />
129
+ <FormattedText text={msj0 || 'Sin partidos'} format={parameters.formatMjs} />
140
130
  </div>
141
131
  </div>
142
-
143
132
  )
144
133
  }
@@ -6,11 +6,10 @@ interface Props {
6
6
  paths: Array<string>
7
7
  }
8
8
 
9
- export const FontLoader = ({paths}: Props) => {
10
-
11
- const {configureState} = useContext(ConfigureContext)
12
- const {parameters, downloadsPath} = configureState
13
- const _getValueByPath =(path:any, obj:any) : any => {
9
+ export const FontLoader = ({ paths }: Props) => {
10
+ const { configureState } = useContext(ConfigureContext)
11
+ const { parameters, downloadsPath } = configureState
12
+ const _getValueByPath = (path: any, obj: any): any => {
14
13
  let pathsArray = path.split('.')
15
14
  let propertyName = pathsArray[0]
16
15
  if (pathsArray.length === 1) return obj[propertyName]
@@ -19,9 +18,9 @@ export const FontLoader = ({paths}: Props) => {
19
18
  return _getValueByPath(pathsArray.join('.'), obj[propertyName])
20
19
  }
21
20
  }
22
- let fonts = paths.map((path:any) => {
21
+ let fonts = paths.map((path: any) => {
23
22
  try {
24
- let fontParam = _getValueByPath(path,parameters)
23
+ let fontParam = _getValueByPath(path, parameters)
25
24
  let font = {
26
25
  family: fontParam.filename.replace('.', '-'),
27
26
  src: `${downloadsPath}/${fontParam.filename}`
@@ -42,7 +41,6 @@ export const FontLoader = ({paths}: Props) => {
42
41
  )
43
42
  }
44
43
 
45
-
46
44
  FontLoader.defaultProps = {
47
45
  paths: [],
48
46
  parameters: {},
@@ -54,5 +52,3 @@ FontLoader.propTypes = {
54
52
  parameters: PropTypes.object,
55
53
  downloadsPath: PropTypes.string
56
54
  }
57
-
58
-
@@ -13,7 +13,7 @@ type aligment = {
13
13
  }
14
14
 
15
15
  interface Props {
16
- format?: any
16
+ format?: any
17
17
  lineHeight: number
18
18
  maxChar?: number
19
19
  style?: number
@@ -23,10 +23,7 @@ interface Props {
23
23
  paddingTop?: string
24
24
  }
25
25
 
26
-
27
- export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit, paddingBottom, paddingTop}: Props) => {
28
-
29
-
26
+ export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit, paddingBottom, paddingTop }: Props) => {
30
27
  const trimText = (text: any, maxChar: any) => {
31
28
  const isValid = maxChar && isNumber(maxChar) && maxChar >= 3
32
29
  if (isValid && (text && text.length > maxChar) || false) {
@@ -68,7 +65,7 @@ export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit,
68
65
  fontFamily: checkNested(format, 'font.filename') ? `"${format?.font?.filename?.replace('.', '-')}"` : '',
69
66
  fontSize: `${format?.fontSize}${unit}`,
70
67
  textAlign: checkNested(format, 'alignment.horizontal') ? format?.alignment?.horizontal : 'left',
71
- lineHeight: lineHeight ,
68
+ lineHeight: lineHeight,
72
69
  paddingBottom: paddingBottom,
73
70
  paddingTop: paddingTop,
74
71
  display: 'inline-flex'
@@ -77,7 +74,6 @@ export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit,
77
74
  )
78
75
  }
79
76
 
80
-
81
77
  FormattedText.defaultProps = {
82
78
  format: {},
83
79
  lineHeight: 1,
@@ -4,19 +4,19 @@ import { FormattedText } from '../FormattedText'
4
4
  import { isNumber } from 'lodash'
5
5
 
6
6
  export const Results = ({ goals, score }: any) => {
7
-
8
7
  const { configureState } = useContext(ConfigureContext)
9
8
  const { parameters } = configureState
9
+
10
10
  return (
11
11
  <div style={{
12
12
  display: 'flex',
13
13
  justifyContent: 'center',
14
14
  }}>
15
15
  {
16
- isNumber(score.penalty.home) ? <FormattedText text={`(${score.penalty.home})`} format={parameters.goalsFormat} /> : ''
16
+ isNumber(score.penalty.home) ? <FormattedText text={`(${score.penalty.home})`} format={parameters.goalsFormat} /> : ''
17
17
  }
18
18
  <FormattedText text={goals.home ? goals.home : 0} format={parameters.goalsFormat} />
19
- <FormattedText text={"-"} format={parameters.goalsFormat} />
19
+ <FormattedText text={'-'} format={parameters.goalsFormat} />
20
20
  <FormattedText text={goals.away ? goals.away : 0} format={parameters.goalsFormat} />
21
21
  {
22
22
  isNumber(score.penalty.away) ? <FormattedText text={`(${score.penalty.away})`} format={parameters.goalsFormat} /> : ''
@@ -1,19 +1,18 @@
1
1
  import React, { useContext, useEffect, useState } from 'react'
2
- // import { TeamItems } from './TeamItems'
3
- import { Time } from './Time';
4
- import { FormattedText } from '../FormattedText';
5
- import { ConfigureContext } from '../../contex/configureContext/ConfigureContext';
6
- import { Status } from './Status';
7
- import { translateTeams } from '../../helpers/translateTeams';
8
- import { Results } from './Results';
2
+ import { Time } from './Time'
3
+ import { FormattedText } from '../FormattedText'
4
+ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
5
+ import { Status } from './Status'
6
+ import { translateTeams } from '../../helpers/translateTeams'
7
+ import { Results } from './Results'
9
8
 
10
9
  export const Row = (item: any) => {
11
10
 
12
11
  const { fixture, teams, goals, score } = item.item;
13
12
  const { configureState } = useContext(ConfigureContext)
14
13
  const { parameters } = configureState
15
- const [homeTeam, setHomeTeam] = useState(false);
16
- const [awayTeam, setAwayTeam] = useState(false);
14
+ const [homeTeam, setHomeTeam] = useState(false)
15
+ const [awayTeam, setAwayTeam] = useState(false)
17
16
 
18
17
  const {
19
18
  descriptionEnabled,
@@ -28,19 +27,16 @@ export const Row = (item: any) => {
28
27
  widthTime,
29
28
  } = parameters
30
29
 
31
- let gridColumns = descriptionEnabled ? `${widthTime || "200px"} ${widthStatus || "200px"} ${widthDescription || "200px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"} ${widthDescription || "200px"}` :
32
- ` ${widthTime || "100px"} ${widthStatus || "100px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"}`
30
+ let gridColumns = descriptionEnabled ? `${widthTime || '200px'} ${widthStatus || '200px'} ${widthDescription || '200px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'} ${widthDescription || '200px'}` :
31
+ ` ${widthTime || '100px'} ${widthStatus || '100px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'}`
33
32
 
34
33
  let nameHome = translateTeams(teams.home.name)
35
34
  let nameAway = translateTeams(teams.away.name)
36
35
 
37
-
38
36
  const requestFlagHome = async (urlLogo: string) => {
39
37
  try {
40
38
  const resp1 = await fetch(urlLogo)
41
- if (resp1.status === 200) {
42
- setHomeTeam(true)
43
- }
39
+ if (resp1.status === 200) setHomeTeam(true)
44
40
  } catch (error) {
45
41
  console.log(error)
46
42
  setHomeTeam(false)
@@ -50,9 +46,7 @@ export const Row = (item: any) => {
50
46
  const requestFlagAway = async (urlLogo: any) => {
51
47
  try {
52
48
  const resp1 = await fetch(urlLogo)
53
- if (resp1.status === 200) {
54
- setAwayTeam(true)
55
- }
49
+ if (resp1.status === 200) setAwayTeam(true)
56
50
  } catch (error) {
57
51
  console.log(error)
58
52
  setAwayTeam(false)
@@ -71,12 +65,12 @@ export const Row = (item: any) => {
71
65
  style={{
72
66
  display: 'grid',
73
67
  gridTemplateColumns: `${gridColumns}`,
74
- columnGap: `${columnGap || "10px"}`,
68
+ columnGap: `${columnGap || '10px'}`,
75
69
  width: '100%',
76
70
  height: '100%',
77
71
  alignItems: 'center',
78
72
  placeContent: 'center',
79
- padding: `${rowGap || "30px"} 0px`,
73
+ padding: `${rowGap || '30px'} 0px`,
80
74
  justifyContent: 'center'
81
75
  }}
82
76
  >
@@ -87,9 +81,7 @@ export const Row = (item: any) => {
87
81
  }}
88
82
  >
89
83
  <Time time={Number(fixture.timestamp)} />
90
-
91
84
  </div>
92
-
93
85
  <div
94
86
  style={{
95
87
  display: 'flex',
@@ -97,9 +89,7 @@ export const Row = (item: any) => {
97
89
  }}
98
90
  >
99
91
  <Status status={fixture.status.short} />
100
-
101
92
  </div>
102
-
103
93
  {
104
94
  descriptionEnabled &&
105
95
  <div style={{
@@ -3,47 +3,47 @@ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext
3
3
  import { FormattedText } from '../FormattedText'
4
4
 
5
5
  export const Status = ({
6
- status
6
+ status
7
7
  }: any) => {
8
8
 
9
- let translateStatus: string = ''
10
- const { configureState } = useContext(ConfigureContext)
11
- const { parameters } = configureState
9
+ let translateStatus: string = ''
10
+ const { configureState } = useContext(ConfigureContext)
11
+ const { parameters } = configureState
12
12
 
13
- switch (status) {
14
- case 'NS':
15
- translateStatus = 'Por iniciar'
16
- break
17
- case '1H':
18
- translateStatus = 'Primer tiempo'
19
- break
20
- case 'HT':
21
- translateStatus = 'Medio tiempo '
22
- break
23
- case '2H':
24
- translateStatus = 'Segundo tiempo'
25
- break
26
- case 'FT':
27
- translateStatus = 'Finalizado'
28
- break
29
- case 'P':
30
- translateStatus = 'Penales'
31
- break
32
- case 'LIVE':
33
- translateStatus = 'En vivo'
34
- break
35
- default:
36
- translateStatus = 'Finalizado'
37
- break
38
- }
13
+ switch (status) {
14
+ case 'NS':
15
+ translateStatus = 'Por iniciar'
16
+ break
17
+ case '1H':
18
+ translateStatus = 'Primer tiempo'
19
+ break
20
+ case 'HT':
21
+ translateStatus = 'Medio tiempo '
22
+ break
23
+ case '2H':
24
+ translateStatus = 'Segundo tiempo'
25
+ break
26
+ case 'FT':
27
+ translateStatus = 'Finalizado'
28
+ break
29
+ case 'P':
30
+ translateStatus = 'Penales'
31
+ break
32
+ case 'LIVE':
33
+ translateStatus = 'En vivo'
34
+ break
35
+ default:
36
+ translateStatus = 'Finalizado'
37
+ break
38
+ }
39
39
 
40
- return (
41
- <div style={{
42
- display: 'flex',
43
- justifyContent: 'center',
44
- alignItems: 'center',
45
- }}>
46
- <FormattedText text={translateStatus} format={parameters.statusFormat} />
47
- </div>
48
- )
40
+ return (
41
+ <div style={{
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ alignItems: 'center',
45
+ }}>
46
+ <FormattedText text={translateStatus} format={parameters.statusFormat} />
47
+ </div>
48
+ )
49
49
  }
@@ -1,27 +1,27 @@
1
1
  import React from 'react'
2
- import { Row } from './Row';
2
+ import { Row } from './Row'
3
3
 
4
4
  type Props = {
5
- dataFixture: any
6
- }
5
+ dataFixture: any
6
+ }
7
7
 
8
8
  export const Table = ({ dataFixture }: Props) => {
9
- return (
10
- <div
11
- style={{
12
- display: 'flex',
13
- width: '100%',
14
- height: '100%',
15
- justifyContent: 'center',
16
- alignItems: 'center',
17
- flexDirection: 'column'
18
- }}
19
- >
20
- {
21
- dataFixture.map((item: any) => (
22
- <Row item={item}/>
23
- ))
24
- }
25
- </div>
26
- )
9
+ return (
10
+ <div
11
+ style={{
12
+ display: 'flex',
13
+ width: '100%',
14
+ height: '100%',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ flexDirection: 'column'
18
+ }}
19
+ >
20
+ {
21
+ dataFixture.map((item: any) => (
22
+ <Row item={item} />
23
+ ))
24
+ }
25
+ </div>
26
+ )
27
27
  }
@@ -27,8 +27,6 @@ export const TeamItems = ({ team, home }: any) => {
27
27
  }}>
28
28
  <img src={team.logo} style={{ width: '100%' }} />
29
29
  <FormattedText text={team.name} format={parameters.nameFormat || parameters.descriptionFormat} />
30
-
31
30
  </div>)
32
31
  )
33
32
  }
34
-
@@ -3,22 +3,20 @@ import React, { useContext } from 'react'
3
3
  import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
4
4
  import { FormattedText } from '../FormattedText'
5
5
 
6
- export const Time = ({time}:any) => {
6
+ export const Time = ({ time }: any) => {
7
+ const { configureState } = useContext(ConfigureContext)
8
+ const { parameters } = configureState
7
9
 
8
- const { configureState } = useContext(ConfigureContext)
9
- const { parameters } = configureState
10
-
11
- return (
12
- <div style={{
13
- display: 'flex',
14
- flexDirection: 'column',
15
- alignItems: 'center',
16
- justifyContent: 'center',
10
+ return (
11
+ <div style={{
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
17
16
 
18
- }}>
19
- <FormattedText text={moment.unix(time).format('DD-MM')} format={parameters.timeFormat} />
20
- <FormattedText text={moment.unix(time).format('h:mm a')} format={parameters.timeFormat} />
21
-
22
- </div>
23
- )
17
+ }}>
18
+ <FormattedText text={moment.unix(time).format('DD-MM')} format={parameters.timeFormat} />
19
+ <FormattedText text={moment.unix(time).format('h:mm a')} format={parameters.timeFormat} />
20
+ </div>
21
+ )
24
22
  }
@@ -1,9 +1,8 @@
1
- import { createContext } from "react";
2
-
1
+ import { createContext } from 'react'
3
2
 
4
3
  type ConfigureContext = {
5
- configureState: VixonicData
6
- addConfiguration: (configure:VixonicData)=>void
4
+ configureState: VixonicData
5
+ addConfiguration: (configure: VixonicData) => void
7
6
  }
8
-
9
- export const ConfigureContext = createContext<ConfigureContext>({} as ConfigureContext);
7
+
8
+ export const ConfigureContext = createContext<ConfigureContext>({} as ConfigureContext)
@@ -1,73 +1,71 @@
1
- import React, { useReducer } from "react";
2
- import { ConfigureContext } from './ConfigureContext';
3
- import { parameterReducer } from "./configureReducer";
4
-
5
-
1
+ import React, { useReducer } from 'react'
2
+ import { ConfigureContext } from './ConfigureContext'
3
+ import { parameterReducer } from './configureReducer'
6
4
 
7
5
  const INITIAL_STATE: VixonicData = {
8
6
  downloadsPath: '',
9
7
  parameters: {
10
8
  abbreviatedMonths: false,
11
- animationMode: "",
9
+ animationMode: '',
12
10
  animationOrder: false,
13
11
  animationSpeed: 1.5,
14
- animationTime: "",
15
- backgroundImage: { id: "", filename: "", _isAsset: true },
16
- apiDomain: "",
17
- containerColumns: "",
18
- statusFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
19
- containerColumnsGap: "",
20
- containerRows: "",
21
- containerRowsGap: "",
22
- dataMode: "",
12
+ animationTime: '',
13
+ backgroundImage: { id: '', filename: '', _isAsset: true },
14
+ apiDomain: '',
15
+ containerColumns: '',
16
+ statusFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: 'center' }, fontColor: '' },
17
+ containerColumnsGap: '',
18
+ containerRows: '',
19
+ containerRowsGap: '',
20
+ dataMode: '',
23
21
  title0: 'App Mundial',
24
22
  titleEnabled: false,
25
- titleFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
26
- goalsFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
27
- timeFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
28
- dateAlignment: "center",
29
- dateDayFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
23
+ titleFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: 'center' }, fontColor: '', },
24
+ goalsFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: 'center' }, fontColor: '', },
25
+ timeFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: 'center' }, fontColor: '', },
26
+ dateAlignment: 'center',
27
+ dateDayFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: 'center' }, fontColor: '', },
30
28
  dateEnabled: true,
31
- dateMonthFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 20, alignment: { horizontal: "center" }, fontColor: "" },
29
+ dateMonthFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 20, alignment: { horizontal: 'center' }, fontColor: '' },
32
30
  datePosition: 1,
33
- datePrimaryColor: "",
34
- dateStyle: "circle",
31
+ datePrimaryColor: '',
32
+ dateStyle: 'circle',
35
33
  descriptionEnabled: true,
36
- descriptionFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
34
+ descriptionFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: 'center' }, fontColor: '' },
37
35
  excludePast: false,
38
- imageAlignment: "center",
36
+ imageAlignment: 'center',
39
37
  imageEnabled: true,
40
38
  imagePosition: 0,
41
- imageStyle: "normal",
39
+ imageStyle: 'normal',
42
40
  imageSize: 50,
43
- itemMargins: "",
44
- msj0: "No hay partidos hoy",
45
- nameFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
46
- orientation: "",
47
- padding: "",
48
- photosMode: "",
49
- photosZip: { id: "0fb559ec-5da3-4b2d-95c4-d9623754c841", filename: "0fb559ec-5da3-4b2d-95c4-d9623754c841.zip", extension: "zip", _isAsset: true },
50
- template: "",
51
- textAlignment: "center",
41
+ itemMargins: '',
42
+ msj0: 'No hay partidos hoy',
43
+ nameFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: 'center' }, fontColor: '' },
44
+ orientation: '',
45
+ padding: '',
46
+ photosMode: '',
47
+ photosZip: { id: '0fb559ec-5da3-4b2d-95c4-d9623754c841', filename: '0fb559ec-5da3-4b2d-95c4-d9623754c841.zip', extension: 'zip', _isAsset: true },
48
+ template: '',
49
+ textAlignment: 'center',
52
50
  textPosition: 0,
53
51
  updateTime: 300000,
54
- urlBaseApi: "",
55
- imageMargin: "",
56
- textMargin: "",
57
- dateMargin: "",
52
+ urlBaseApi: '',
53
+ imageMargin: '',
54
+ textMargin: '',
55
+ dateMargin: '',
58
56
  separator: false,
59
- widthDescription: "200px",
60
- widthImage: "300px",
61
- widthScore: "100px",
62
- columnGap: "10px",
63
- rowGap: "30px",
64
- widthStatus: "200px",
65
- widthTime: "200px",
66
- timeEnd: "7pm",
67
- timeStart: "6am",
68
- formatMjs: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
69
- alignVerticalMsj: "center",
70
- league: "9"
57
+ widthDescription: '200px',
58
+ widthImage: '300px',
59
+ widthScore: '100px',
60
+ columnGap: '10px',
61
+ rowGap: '30px',
62
+ widthStatus: '200px',
63
+ widthTime: '200px',
64
+ timeEnd: '7pm',
65
+ timeStart: '6am',
66
+ formatMjs: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: 'center' }, fontColor: '' },
67
+ alignVerticalMsj: 'center',
68
+ league: '9'
71
69
  }
72
70
  }
73
71
 
@@ -76,12 +74,9 @@ interface props {
76
74
  }
77
75
 
78
76
  export const ParameterProvider = ({ children }: props) => {
79
-
80
77
  const [configureState, dispatch] = useReducer(parameterReducer, INITIAL_STATE)
81
-
82
-
83
78
  const addConfiguration = (configure: VixonicData) => {
84
- dispatch({ type: "addConfigure", payload: configure })
79
+ dispatch({ type: 'addConfigure', payload: configure })
85
80
  }
86
81
 
87
82
  return (
@@ -90,4 +85,3 @@ export const ParameterProvider = ({ children }: props) => {
90
85
  </ConfigureContext.Provider>
91
86
  )
92
87
  }
93
-
@@ -2,10 +2,9 @@
2
2
  type ConfigureAction =
3
3
  | { type: 'addConfigure', payload: VixonicData }
4
4
 
5
-
6
5
  export const parameterReducer = (state: VixonicData, action: ConfigureAction) => {
7
-
8
6
  const { downloadsPath, parameters } = action.payload
7
+
9
8
  switch (action.type) {
10
9
  case 'addConfigure':
11
10
  return {
@@ -60,5 +59,4 @@ export const parameterReducer = (state: VixonicData, action: ConfigureAction) =>
60
59
  default:
61
60
  return state;
62
61
  }
63
-
64
- }
62
+ }
@@ -1,5 +1,5 @@
1
- import moment from 'moment';
2
- const axios = require("axios");
1
+ import moment from 'moment'
2
+ const axios = require('axios')
3
3
 
4
4
  export const getFixture = async (league: string) => {
5
5
  const today = moment().format('YYYY-MM-DD')
@@ -13,12 +13,13 @@ export const getFixture = async (league: string) => {
13
13
  'X-RapidAPI-Key': 'a7e693d4c5msh72a2ff2020fd601p12dd08jsn0f168421d7bb',
14
14
  'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com'
15
15
  }
16
- };
16
+ }
17
+
17
18
  try {
18
19
  const response = await axios.request(options)
19
20
  return response.data.response
20
21
  } catch (error) {
21
- console.error(error);
22
+ console.error(error)
22
23
  return []
23
24
  }
24
25
  }
@@ -1,91 +1,91 @@
1
1
 
2
2
  export const translateTeams = (team: string) => {
3
- switch (team) {
4
- case 'England':
5
- return 'Inglaterra'
6
- case 'Spain':
7
- return 'España'
8
- case 'Italy':
9
- return 'Italia'
10
- case 'Germany':
11
- return 'Alemania'
12
- case 'France':
13
- return 'Francia'
14
- case 'Portugal':
15
- return 'Portugal'
16
- case 'Netherlands':
17
- return 'Holanda'
18
- case 'Belgium':
19
- return 'Bélgica'
20
- case 'Russia':
21
- return 'Rusia'
22
- case 'Turkey':
23
- return 'Turquía'
24
- case 'Ukraine':
25
- return 'Ucrania'
26
- case 'Czech Republic':
27
- return 'República Checa'
28
- case 'Sweden':
29
- return 'Suecia'
30
- case 'Poland':
31
- return 'Polonia'
32
- case 'Austria':
33
- return 'Austria'
34
- case 'Switzerland':
35
- return 'Suiza'
36
- case 'Denmark':
37
- return 'Dinamarca'
38
- case 'Hungary':
39
- return 'Hungría'
40
- case 'Romania':
41
- return 'Rumanía'
42
- case 'Croatia':
43
- return 'Croacia'
44
- case 'Scotland':
45
- return 'Escocia'
46
- case 'Wales':
47
- return 'Gales'
48
- case 'Northern Ireland':
49
- return 'Irlanda del Norte'
50
- case 'Slovakia':
51
- return 'Eslovaquia'
52
- case 'Norway':
53
- return 'Noruega'
54
- case 'Finland':
55
- return 'Finlandia'
56
- case 'Bulgaria':
57
- return 'Bulgaria'
58
- case 'North Macedonia':
59
- return 'Macedonia del Norte'
60
- case 'Iceland':
61
- return 'Islandia'
62
- case 'Iran':
63
- return 'Irán'
64
- case 'United States':
65
- return 'Estados Unidos'
66
- case 'Mexico':
67
- return 'México'
68
- case 'Tunisia':
69
- return 'Túnez'
70
- case 'Japan':
71
- return 'Japón'
72
- case 'Argentina':
73
- return 'Argentina'
74
- case 'Canada':
75
- return 'Canadá'
76
- case 'Morocco':
77
- return 'Marruecos'
78
- case 'Brazil':
79
- return 'Brasil'
80
- case 'Cameroon':
81
- return 'Camerún'
82
- case 'Ghana':
83
- return 'Ghana'
84
- case 'South Korea':
85
- return 'Corea del Sur'
86
- case 'Saudi Arabia':
87
- return 'Arabia Saudita'
88
- default:
89
- return team
90
- }
91
- }
3
+ switch (team) {
4
+ case 'England':
5
+ return 'Inglaterra'
6
+ case 'Spain':
7
+ return 'España'
8
+ case 'Italy':
9
+ return 'Italia'
10
+ case 'Germany':
11
+ return 'Alemania'
12
+ case 'France':
13
+ return 'Francia'
14
+ case 'Portugal':
15
+ return 'Portugal'
16
+ case 'Netherlands':
17
+ return 'Holanda'
18
+ case 'Belgium':
19
+ return 'Bélgica'
20
+ case 'Russia':
21
+ return 'Rusia'
22
+ case 'Turkey':
23
+ return 'Turquía'
24
+ case 'Ukraine':
25
+ return 'Ucrania'
26
+ case 'Czech Republic':
27
+ return 'República Checa'
28
+ case 'Sweden':
29
+ return 'Suecia'
30
+ case 'Poland':
31
+ return 'Polonia'
32
+ case 'Austria':
33
+ return 'Austria'
34
+ case 'Switzerland':
35
+ return 'Suiza'
36
+ case 'Denmark':
37
+ return 'Dinamarca'
38
+ case 'Hungary':
39
+ return 'Hungría'
40
+ case 'Romania':
41
+ return 'Rumanía'
42
+ case 'Croatia':
43
+ return 'Croacia'
44
+ case 'Scotland':
45
+ return 'Escocia'
46
+ case 'Wales':
47
+ return 'Gales'
48
+ case 'Northern Ireland':
49
+ return 'Irlanda del Norte'
50
+ case 'Slovakia':
51
+ return 'Eslovaquia'
52
+ case 'Norway':
53
+ return 'Noruega'
54
+ case 'Finland':
55
+ return 'Finlandia'
56
+ case 'Bulgaria':
57
+ return 'Bulgaria'
58
+ case 'North Macedonia':
59
+ return 'Macedonia del Norte'
60
+ case 'Iceland':
61
+ return 'Islandia'
62
+ case 'Iran':
63
+ return 'Irán'
64
+ case 'United States':
65
+ return 'Estados Unidos'
66
+ case 'Mexico':
67
+ return 'México'
68
+ case 'Tunisia':
69
+ return 'Túnez'
70
+ case 'Japan':
71
+ return 'Japón'
72
+ case 'Argentina':
73
+ return 'Argentina'
74
+ case 'Canada':
75
+ return 'Canadá'
76
+ case 'Morocco':
77
+ return 'Marruecos'
78
+ case 'Brazil':
79
+ return 'Brasil'
80
+ case 'Cameroon':
81
+ return 'Camerún'
82
+ case 'Ghana':
83
+ return 'Ghana'
84
+ case 'South Korea':
85
+ return 'Corea del Sur'
86
+ case 'Saudi Arabia':
87
+ return 'Arabia Saudita'
88
+ default:
89
+ return team
90
+ }
91
+ }
package/src/main.tsx CHANGED
@@ -1,17 +1,16 @@
1
1
  import ReactDOM from 'react-dom'
2
2
  import React from 'react'
3
+ import { App } from './App'
4
+ import { ParameterProvider } from './contex/configureContext/ConfigureProvider'
3
5
  const { ipcRenderer } = require('electron')
4
- import { App } from './App';
5
- import { ParameterProvider } from './contex/configureContext/ConfigureProvider';
6
- let start: boolean = false
7
6
 
7
+ let start: boolean = false
8
8
  ipcRenderer.on('preload', (_event: any, data: VixonicData) => {
9
9
  render(data)
10
10
  })
11
11
 
12
12
  ipcRenderer.on('start', (_event: any, data: VixonicData) => {
13
13
  start = true
14
- // initialize(data)
15
14
  render(data)
16
15
  })
17
16
 
@@ -23,18 +22,10 @@ ipcRenderer.on('finish', (_event: any) => {
23
22
  console.log('finish')
24
23
  })
25
24
 
26
-
27
25
  function render(data: VixonicData) {
28
26
  ReactDOM.render(
29
27
  <ParameterProvider>
30
28
  <App data={data} start={start} />
31
29
  </ParameterProvider>
32
30
  , document.getElementById('root'))
33
- // ReactDOM.render(React.createElement(App,{data, start}), document.getElementById('root'))
34
31
  }
35
-
36
-
37
-
38
-
39
-
40
-