@vixoniccom/footbal-score 1.2.1-beta.1 → 1.2.1-hotfix.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,19 +2,12 @@
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.1-beta.1](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.1-beta.0...v1.2.1-beta.1) (2024-06-25)
5
+ ### [1.2.1-hotfix.0](https://github.com/Vixonic/store-football-score/compare/v1.2.0...v1.2.1-hotfix.0) (2026-06-17)
6
6
 
7
7
 
8
8
  ### Bug Fixes
9
9
 
10
- * pagination was added to the app ([b847626](https://bitbucket.org/vixonic_dev/football-score/commit/b847626d7982b74c5e479fcc5878b65968349cc0))
11
-
12
- ### [1.2.1-beta.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.0...v1.2.1-beta.0) (2024-06-24)
13
-
14
-
15
- ### Bug Fixes
16
-
17
- * app was refactored and also new properties were added to show matches from previous and next days ([0a7be0c](https://bitbucket.org/vixonic_dev/football-score/commit/0a7be0ca60fe7ce2dce23d2287a965e5c636ce1e))
10
+ * **getFixture:** use API-Sports endpoint and rotate API key ([a45b513](https://github.com/Vixonic/store-football-score/commit/a45b5137be863d3fac048c8a21b92e816109c3bd))
18
11
 
19
12
  ## [1.2.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.0-beta.0...v1.2.0) (2024-06-24)
20
13
 
package/build.zip CHANGED
Binary file
@@ -31,18 +31,6 @@
31
31
  }
32
32
  ]
33
33
  },
34
- {
35
- "type": "switch",
36
- "id": "matchesYesterday",
37
- "label": "Mostrar partidos día anterior",
38
- "defaultValue": false
39
- },
40
- {
41
- "type": "switch",
42
- "id": "matchesTomorrow",
43
- "label": "Mostrar partidos día posterior",
44
- "defaultValue": false
45
- },
46
34
  {
47
35
  "id": "timeStart",
48
36
  "type": "select-input",
@@ -299,7 +287,7 @@
299
287
  {
300
288
  "type": "text-input",
301
289
  "id": "title0",
302
- "description": "Título",
290
+ "description": "Texto.",
303
291
  "show": "{{titleEnabled}} === true"
304
292
  },
305
293
  {
@@ -317,21 +305,7 @@
317
305
  {
318
306
  "type": "text-format",
319
307
  "id": "formatMjs",
320
- "label": "Formato Mensaje"
321
- },
322
- {
323
- "type": "number-input",
324
- "id": "itemsPerPage",
325
- "range": "[1:100]",
326
- "label": "Elementos por página",
327
- "defaultValue": 4
328
- },
329
- {
330
- "type": "number-input",
331
- "id": "durationPerPage",
332
- "range": "[1:100]",
333
- "label": "Duración por página (segundos)",
334
- "defaultValue": 5
308
+ "label": "Formato Status"
335
309
  },
336
310
  {
337
311
  "id": "alignVerticalMsj",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixoniccom/footbal-score",
3
3
  "alias": "Resultados Deportivos",
4
- "version": "1.2.1-beta.1",
4
+ "version": "1.2.1-hotfix.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,18 +1,22 @@
1
- import React, { useEffect, useState } from 'react'
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'
2
7
  import localforage from 'localforage'
3
8
  import moment from 'moment'
4
- import { FontLoader, FormattedText, Table } from './components'
5
- import { getFixture } from './helpers/getFixture'
6
9
 
7
- export type Props = {
8
- data: VixonicData
10
+ type Props = {
11
+ data: VixonicData,
9
12
  start: boolean
10
13
  }
11
14
 
12
15
  export const App = ({ data, start }: Props) => {
13
- const [dataFixture, setDataFixture] = useState<any[]>([])
14
- const [league, setLeague] = useState<string>('')
15
- const { parameters, downloadsPath } = data
16
+ const [dataFixture, setDataFixture] = useState([])
17
+ const [league, setLeague] = useState('')
18
+ const { configureState, addConfiguration } = useContext(ConfigureContext)
19
+ const { parameters, downloadsPath } = configureState
16
20
  const { backgroundImage, padding, msj0 = '', updateTime } = parameters
17
21
  const backgroundImageState = backgroundImage && backgroundImage.filename
18
22
  ? `url("${downloadsPath}/${backgroundImage.filename}")`
@@ -23,11 +27,12 @@ export const App = ({ data, start }: Props) => {
23
27
  const momentLocalStorage: any = dataLocal ? moment().diff(dataLocal.date, 'millisecond') : undefined
24
28
  const timeNowFormat = moment().format('h:mma')
25
29
  const timeNow = moment(timeNowFormat, 'h:mma')
26
- const horaInicio = moment(parameters.timeStart, 'h:mma')
27
- const horaFin = moment(parameters.timeEnd, 'h:mma')
30
+
31
+ const horaInicio = moment(data.parameters.timeStart, 'h:mma')
32
+ const horaFin = moment(data.parameters.timeEnd, 'h:mma')
28
33
 
29
34
  if (momentLocalStorage == undefined || (timeNow.isBetween(horaInicio, horaFin) && momentLocalStorage > updateTime!)) {
30
- const dataRequest = await getFixture(parameters.league!, parameters.matchesYesterday, parameters.matchesTomorrow)
35
+ const dataRequest = await getFixture(data.parameters.league!)
31
36
  setDataLocal(dataRequest)
32
37
  setDataFixture(dataRequest)
33
38
  } else {
@@ -40,6 +45,7 @@ export const App = ({ data, start }: Props) => {
40
45
  setLeague(data.parameters.league!)
41
46
  getData()
42
47
  }
48
+ addConfiguration(data)
43
49
  }, [data])
44
50
 
45
51
  useEffect(() => {
@@ -97,7 +103,7 @@ export const App = ({ data, start }: Props) => {
97
103
  <FormattedText text={parameters.title0 || 'Partidos Mundial'} format={parameters.titleFormat} />
98
104
  </div>
99
105
  }
100
- <Table dataFixture={dataFixture} parameters={parameters} />
106
+ <Table dataFixture={dataFixture} />
101
107
  </div> :
102
108
  <div
103
109
  style={{
@@ -0,0 +1,54 @@
1
+ import React, { useContext } from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import { ConfigureContext } from '../contex/configureContext/ConfigureContext'
4
+
5
+ interface Props {
6
+ paths: Array<string>
7
+ }
8
+
9
+ export const FontLoader = ({ paths }: Props) => {
10
+ const { configureState } = useContext(ConfigureContext)
11
+ const { parameters, downloadsPath } = configureState
12
+ const _getValueByPath = (path: any, obj: any): any => {
13
+ let pathsArray = path.split('.')
14
+ let propertyName = pathsArray[0]
15
+ if (pathsArray.length === 1) return obj[propertyName]
16
+ else {
17
+ pathsArray.splice(0, 1)
18
+ return _getValueByPath(pathsArray.join('.'), obj[propertyName])
19
+ }
20
+ }
21
+ let fonts = paths.map((path: any) => {
22
+ try {
23
+ let fontParam = _getValueByPath(path, parameters)
24
+ let font = {
25
+ family: fontParam.filename.replace('.', '-'),
26
+ src: `${downloadsPath}/${fontParam.filename}`
27
+ }
28
+ return `
29
+ @font-face {
30
+ font-family: "${font.family}";
31
+ src: url("${font.src}");
32
+ }
33
+ `
34
+ } catch (err) {
35
+ return ''
36
+ }
37
+ })
38
+
39
+ return (
40
+ <style>{fonts}</style>
41
+ )
42
+ }
43
+
44
+ FontLoader.defaultProps = {
45
+ paths: [],
46
+ parameters: {},
47
+ downloadsPath: ''
48
+ }
49
+
50
+ FontLoader.propTypes = {
51
+ paths: PropTypes.arrayOf(PropTypes.string).isRequired,
52
+ parameters: PropTypes.object,
53
+ downloadsPath: PropTypes.string
54
+ }
@@ -58,18 +58,20 @@ export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit,
58
58
  justifyContent: getHorizontalAlignment(format.alignment)
59
59
  }, style)
60
60
 
61
- return <div style={containerStyle}>
62
- <span style={{
63
- color: format?.fontColor,
64
- fontFamily: checkNested(format, 'font.filename') ? `"${format?.font?.filename?.replace('.', '-')}"` : '',
65
- fontSize: `${format?.fontSize}${unit}`,
66
- textAlign: checkNested(format, 'alignment.horizontal') ? format?.alignment?.horizontal : 'left',
67
- lineHeight: lineHeight,
68
- paddingBottom: paddingBottom,
69
- paddingTop: paddingTop,
70
- display: 'inline-flex'
71
- }}>{renderText}</span>
72
- </div>
61
+ return (
62
+ <div style={containerStyle}>
63
+ <span style={{
64
+ color: format?.fontColor,
65
+ fontFamily: checkNested(format, 'font.filename') ? `"${format?.font?.filename?.replace('.', '-')}"` : '',
66
+ fontSize: `${format?.fontSize}${unit}`,
67
+ textAlign: checkNested(format, 'alignment.horizontal') ? format?.alignment?.horizontal : 'left',
68
+ lineHeight: lineHeight,
69
+ paddingBottom: paddingBottom,
70
+ paddingTop: paddingTop,
71
+ display: 'inline-flex'
72
+ }}>{renderText}</span>
73
+ </div>
74
+ )
73
75
  }
74
76
 
75
77
  FormattedText.defaultProps = {
@@ -1,8 +1,12 @@
1
- import React from 'react'
2
- import { FormattedText } from '../../FormattedText'
1
+ import React, { useContext } from 'react'
2
+ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
3
+ import { FormattedText } from '../FormattedText'
3
4
  import { isNumber } from 'lodash'
4
5
 
5
- export const Results = ({ parameters, goals, score }: any) => {
6
+ export const Results = ({ goals, score }: any) => {
7
+ const { configureState } = useContext(ConfigureContext)
8
+ const { parameters } = configureState
9
+
6
10
  return (
7
11
  <div style={{
8
12
  display: 'flex',
@@ -1,17 +1,19 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { Results, Status, Time } from './'
3
- import { FormattedText } from '../../'
4
- import { translateTeams } from '../../../helpers/translateTeams'
1
+ import React, { useContext, useEffect, useState } from 'react'
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'
5
8
 
6
- type Props = {
7
- item: any,
8
- parameters: VixonicParameters
9
- }
9
+ export const Row = (item: any) => {
10
10
 
11
- export const Row = ({ item, parameters }: Props) => {
12
- const { fixture, teams, goals, score } = item
11
+ const { fixture, teams, goals, score } = item.item;
12
+ const { configureState } = useContext(ConfigureContext)
13
+ const { parameters } = configureState
13
14
  const [homeTeam, setHomeTeam] = useState(false)
14
15
  const [awayTeam, setAwayTeam] = useState(false)
16
+
15
17
  const {
16
18
  descriptionEnabled,
17
19
  widthDescription,
@@ -25,10 +27,11 @@ export const Row = ({ item, parameters }: Props) => {
25
27
  widthTime,
26
28
  } = parameters
27
29
 
28
- const gridColumns = descriptionEnabled ? `${widthTime || '200px'} ${widthStatus || '200px'} ${widthDescription || '200px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'} ${widthDescription || '200px'}` :
30
+ let gridColumns = descriptionEnabled ? `${widthTime || '200px'} ${widthStatus || '200px'} ${widthDescription || '200px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'} ${widthDescription || '200px'}` :
29
31
  ` ${widthTime || '100px'} ${widthStatus || '100px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'}`
30
- const nameHome = translateTeams(teams.home.name)
31
- const nameAway = translateTeams(teams.away.name)
32
+
33
+ let nameHome = translateTeams(teams.home.name)
34
+ let nameAway = translateTeams(teams.away.name)
32
35
 
33
36
  const requestFlagHome = async (urlLogo: string) => {
34
37
  try {
@@ -56,6 +59,7 @@ export const Row = ({ item, parameters }: Props) => {
56
59
  requestFlagAway(teams.away.logo)
57
60
  }, [])
58
61
 
62
+
59
63
  return (
60
64
  <div
61
65
  style={{
@@ -76,7 +80,7 @@ export const Row = ({ item, parameters }: Props) => {
76
80
  justifyContent: 'flex-end',
77
81
  }}
78
82
  >
79
- <Time time={Number(fixture.timestamp)} parameters={parameters} />
83
+ <Time time={Number(fixture.timestamp)} />
80
84
  </div>
81
85
  <div
82
86
  style={{
@@ -84,7 +88,7 @@ export const Row = ({ item, parameters }: Props) => {
84
88
  justifyContent: 'flex-end',
85
89
  }}
86
90
  >
87
- <Status status={fixture.status.short} parameters={parameters} />
91
+ <Status status={fixture.status.short} />
88
92
  </div>
89
93
  {
90
94
  descriptionEnabled &&
@@ -110,7 +114,9 @@ export const Row = ({ item, parameters }: Props) => {
110
114
 
111
115
  }
112
116
  </div>
113
- <Results goals={goals} score={score} parameters={parameters} />
117
+
118
+ <Results goals={goals} score={score} />
119
+
114
120
  <div
115
121
  style={{
116
122
  display: 'flex',
@@ -1,8 +1,15 @@
1
- import React from 'react'
2
- import { FormattedText } from '../../'
1
+ import React, { useContext } from 'react'
2
+ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
3
+ import { FormattedText } from '../FormattedText'
4
+
5
+ export const Status = ({
6
+ status
7
+ }: any) => {
3
8
 
4
- export const Status = ({ status, parameters }: { status: string, parameters: VixonicParameters }) => {
5
9
  let translateStatus: string = ''
10
+ const { configureState } = useContext(ConfigureContext)
11
+ const { parameters } = configureState
12
+
6
13
  switch (status) {
7
14
  case 'NS':
8
15
  translateStatus = 'Por iniciar'
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import { Row } from './Row'
3
+
4
+ type Props = {
5
+ dataFixture: any
6
+ }
7
+
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
+ )
27
+ }
@@ -0,0 +1,32 @@
1
+ import React, { useContext } from 'react'
2
+ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
3
+ import { FormattedText } from '../FormattedText'
4
+
5
+ export const TeamItems = ({ team, home }: any) => {
6
+ const { configureState } = useContext(ConfigureContext)
7
+ const { parameters } = configureState
8
+
9
+ return (
10
+ home ? (
11
+ <div style={{
12
+ display: 'flex',
13
+ justifyContent: 'space-around',
14
+ alignItems: 'center',
15
+ width: '450px',
16
+ padding: '10px',
17
+ }}>
18
+ <FormattedText text={team.name} format={parameters.nameFormat || parameters.descriptionFormat} />
19
+ <img src={team.logo} style={{ width: '100%' }} />
20
+ </div>) :
21
+ (<div style={{
22
+ display: 'flex',
23
+ justifyContent: 'space-around',
24
+ alignItems: 'center',
25
+ width: '450px',
26
+ padding: '10px',
27
+ }}>
28
+ <img src={team.logo} style={{ width: '100%' }} />
29
+ <FormattedText text={team.name} format={parameters.nameFormat || parameters.descriptionFormat} />
30
+ </div>)
31
+ )
32
+ }
@@ -1,8 +1,12 @@
1
1
  import moment from 'moment'
2
- import React from 'react'
3
- import { FormattedText } from '../../'
2
+ import React, { useContext } from 'react'
3
+ import { ConfigureContext } from '../../contex/configureContext/ConfigureContext'
4
+ import { FormattedText } from '../FormattedText'
5
+
6
+ export const Time = ({ time }: any) => {
7
+ const { configureState } = useContext(ConfigureContext)
8
+ const { parameters } = configureState
4
9
 
5
- export const Time = ({ time, parameters }: { time: number, parameters: VixonicParameters }) => {
6
10
  return (
7
11
  <div style={{
8
12
  display: 'flex',
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react'
2
+
3
+ type ConfigureContext = {
4
+ configureState: VixonicData
5
+ addConfiguration: (configure: VixonicData) => void
6
+ }
7
+
8
+ export const ConfigureContext = createContext<ConfigureContext>({} as ConfigureContext)
@@ -0,0 +1,87 @@
1
+ import React, { useReducer } from 'react'
2
+ import { ConfigureContext } from './ConfigureContext'
3
+ import { parameterReducer } from './configureReducer'
4
+
5
+ const INITIAL_STATE: VixonicData = {
6
+ downloadsPath: '',
7
+ parameters: {
8
+ abbreviatedMonths: false,
9
+ animationMode: '',
10
+ animationOrder: false,
11
+ animationSpeed: 1.5,
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: '',
21
+ title0: 'App Mundial',
22
+ titleEnabled: false,
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: '', },
28
+ dateEnabled: true,
29
+ dateMonthFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 20, alignment: { horizontal: 'center' }, fontColor: '' },
30
+ datePosition: 1,
31
+ datePrimaryColor: '',
32
+ dateStyle: 'circle',
33
+ descriptionEnabled: true,
34
+ descriptionFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: 'center' }, fontColor: '' },
35
+ excludePast: false,
36
+ imageAlignment: 'center',
37
+ imageEnabled: true,
38
+ imagePosition: 0,
39
+ imageStyle: 'normal',
40
+ imageSize: 50,
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',
50
+ textPosition: 0,
51
+ updateTime: 300000,
52
+ urlBaseApi: '',
53
+ imageMargin: '',
54
+ textMargin: '',
55
+ dateMargin: '',
56
+ separator: false,
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'
69
+ }
70
+ }
71
+
72
+ interface props {
73
+ children: JSX.Element | JSX.Element[]
74
+ }
75
+
76
+ export const ParameterProvider = ({ children }: props) => {
77
+ const [configureState, dispatch] = useReducer(parameterReducer, INITIAL_STATE)
78
+ const addConfiguration = (configure: VixonicData) => {
79
+ dispatch({ type: 'addConfigure', payload: configure })
80
+ }
81
+
82
+ return (
83
+ <ConfigureContext.Provider value={{ configureState, addConfiguration }}>
84
+ {children}
85
+ </ConfigureContext.Provider>
86
+ )
87
+ }
@@ -0,0 +1,62 @@
1
+
2
+ type ConfigureAction =
3
+ | { type: 'addConfigure', payload: VixonicData }
4
+
5
+ export const parameterReducer = (state: VixonicData, action: ConfigureAction) => {
6
+ const { downloadsPath, parameters } = action.payload
7
+
8
+ switch (action.type) {
9
+ case 'addConfigure':
10
+ return {
11
+ downloadsPath: downloadsPath,
12
+ parameters: {
13
+ backgroundImage: parameters.backgroundImage,
14
+ descriptionEnabled: parameters.descriptionEnabled,
15
+ descriptionFormat: parameters.descriptionFormat,
16
+ imageAlignment: parameters.imageAlignment,
17
+ imageEnabled: parameters.imageEnabled,
18
+ imagePosition: parameters.imagePosition,
19
+ imageSize: parameters.imageSize,
20
+ imageStyle: parameters.imageStyle,
21
+ itemMargins: parameters.itemMargins,
22
+ msj0: parameters.msj0,
23
+ nameFormat: parameters.nameFormat,
24
+ orientation: parameters.orientation,
25
+ padding: parameters.padding,
26
+ photosMode: parameters.photosMode,
27
+ photosZip: parameters.photosZip,
28
+ template: parameters.template,
29
+ textAlignment: parameters.textAlignment,
30
+ textPosition: parameters.textPosition,
31
+ updateTime: parameters.updateTime,
32
+ urlBaseApi: parameters.urlBaseApi,
33
+ imageMargin: parameters.imageMargin,
34
+ textMargin: parameters.textMargin,
35
+ dateMargin: parameters.dateMargin,
36
+ separator: parameters.separator,
37
+ descriptionMaxChar: parameters.descriptionMaxChar,
38
+ nameMaxChar: parameters.nameMaxChar,
39
+ timeFormat: parameters.timeFormat,
40
+ goalsFormat: parameters.goalsFormat,
41
+ title0: parameters.title0,
42
+ titleEnabled: parameters.titleEnabled,
43
+ titleFormat: parameters.titleFormat,
44
+ statusFormat: parameters.statusFormat,
45
+ widthDescription: parameters.widthDescription,
46
+ widthImage: parameters.widthImage,
47
+ widthScore: parameters.widthScore,
48
+ columnGap: parameters.columnGap,
49
+ rowGap: parameters.rowGap,
50
+ widthTime: parameters.widthTime,
51
+ widthStatus: parameters.widthStatus,
52
+ timeStart: parameters.timeStart,
53
+ timeEnd: parameters.timeEnd,
54
+ formatMjs: parameters.formatMjs,
55
+ alignVerticalMsj: parameters.alignVerticalMsj,
56
+ league: parameters.league
57
+ }
58
+ }
59
+ default:
60
+ return state;
61
+ }
62
+ }
@@ -1,20 +1,16 @@
1
1
  import moment from 'moment'
2
- import axios from 'axios'
2
+ const axios = require('axios')
3
3
 
4
- export const getFixture = async (league: string, yesterday?: boolean, tomorrow?: boolean) => {
4
+ export const getFixture = async (league: string) => {
5
5
  const today = moment().format('YYYY-MM-DD')
6
6
  const year = moment().format('YYYY')
7
- const from = yesterday ? moment(Date.now() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') : today
8
- const to = tomorrow ? moment(Date.now() + 24 * 60 * 60 * 1000).format('YYYY-MM-DD') : today
9
-
10
7
  const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
11
8
  const options = {
12
9
  method: 'GET',
13
- url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
14
- params: { from, to, league: league, season: `${year}`, timezone: `${timezone}` },
10
+ url: 'https://v3.football.api-sports.io/fixtures',
11
+ params: { date: `${today}`, league: league, season: `${year}`, timezone: `${timezone}` },
15
12
  headers: {
16
- 'X-RapidAPI-Key': 'a7e693d4c5msh72a2ff2020fd601p12dd08jsn0f168421d7bb',
17
- 'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com'
13
+ 'x-apisports-key': '932ef9439de2eb39756b44e7ff8338d8'
18
14
  }
19
15
  }
20
16
 
@@ -1,3 +1,4 @@
1
+
1
2
  export const translateTeams = (team: string) => {
2
3
  switch (team) {
3
4
  case 'England':
package/src/main.tsx CHANGED
@@ -1,10 +1,10 @@
1
1
  import ReactDOM from 'react-dom'
2
2
  import React from 'react'
3
- import { App, Props } from './App'
4
-
3
+ import { App } from './App'
4
+ import { ParameterProvider } from './contex/configureContext/ConfigureProvider'
5
5
  const { ipcRenderer } = require('electron')
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
  })
@@ -23,5 +23,9 @@ ipcRenderer.on('finish', (_event: any) => {
23
23
  })
24
24
 
25
25
  function render(data: VixonicData) {
26
- ReactDOM.render(React.createElement<Props>(App, {data, start}), document.getElementById('root'))
26
+ ReactDOM.render(
27
+ <ParameterProvider>
28
+ <App data={data} start={start} />
29
+ </ParameterProvider>
30
+ , document.getElementById('root'))
27
31
  }
@@ -6,6 +6,7 @@ declare type VixonicData = {
6
6
  downloadsPath: string
7
7
  }
8
8
 
9
+
9
10
  declare type VixonicParameters = Partial<{
10
11
  abbreviatedMonths: boolean
11
12
  animationMode: string
@@ -52,45 +53,42 @@ declare type VixonicParameters = Partial<{
52
53
  textAlignment: keyof typeof alignment
53
54
  textPosition: number
54
55
  updateTime: number
55
- urlBaseApi: string
56
- imageMargin: string
57
- textMargin: string
58
- dateMargin: string
59
- separator: boolean
60
- separatorWidth: number
61
- separatorColor: string
62
- nameMaxChar: number
63
- descriptionMaxChar: number
64
- statusFormat: DateFormat
65
- widthDescription: string
66
- widthImage: string
67
- widthScore: string
68
- columnGap: string
69
- rowGap: string
70
- widthTime: string
56
+ urlBaseApi: string,
57
+ imageMargin: string,
58
+ textMargin: string,
59
+ dateMargin: string,
60
+ separator: boolean,
61
+ separatorWidth: number,
62
+ separatorColor: string,
63
+ nameMaxChar: number,
64
+ descriptionMaxChar: number,
65
+ statusFormat: DateFormat,
66
+ widthDescription: string,
67
+ widthImage: string,
68
+ widthScore: string,
69
+ columnGap: string,
70
+ rowGap: string,
71
+ widthTime: string,
71
72
  widthStatus: string
72
- timeStart: string
73
- timeEnd: string
74
- formatMjs: DateFormat
75
- alignVerticalMsj: string
73
+ timeStart: string,
74
+ timeEnd: string,
75
+ formatMjs: DateFormat,
76
+ alignVerticalMsj: string,
76
77
  league: string
77
- matchesTomorrow: boolean
78
- matchesYesterday: boolean
79
- itemsPerPage: number
80
- durationPerPage: number
81
78
  }>
82
79
 
80
+
83
81
  type GeneralData = {
84
82
  filename?: string
85
- id?: string
86
- extension?: string
83
+ id?: string,
84
+ extension?: string,
87
85
  _isAsset: boolean
88
86
  }
89
87
 
90
88
  type DateFormat = {
91
- alignment?: { horizontal?: 'left' | 'right' | 'center' }
92
- font?: GeneralData
93
- fontColor?: string
89
+ alignment?: { horizontal?: 'left' | 'right' | 'center' },
90
+ font?: GeneralData,
91
+ fontColor?: string,
94
92
  fontSize?: number
95
93
  }
96
94
 
@@ -113,4 +111,4 @@ const styles = {
113
111
  calendarText: 'calendarText',
114
112
  circle: 'circle',
115
113
  outlines: 'outlines'
116
- }
114
+ }
@@ -1,7 +1,98 @@
1
1
  {
2
2
  "parameters": {
3
- "league": 9,
4
- "matchesYesterday": false,
5
- "matchesTomorrow": true
3
+ "urlBaseApi": "mandomedio",
4
+ "msj0": "No hay partidos",
5
+ "statusEnabled": true,
6
+ "timeRequest": 60000,
7
+ "rowGap": "30px",
8
+ "columnGap": "10px",
9
+ "padding": "30px 25px 80px 40px",
10
+ "dataMode": "monthly",
11
+ "template": "standard",
12
+ "league": "9",
13
+ "dateStyle": "circle",
14
+ "photosZip": {
15
+ "id": "d1093778-f3c9-42c8-9b07-9f8736390aeb",
16
+ "filename": "d1093778-f3c9-42c8-9b07-9f8736390aeb.zip",
17
+ "__isAsset": true,
18
+ "extension": "zip"
19
+ },
20
+ "imageStyle": "circle",
21
+ "nameFormat": {
22
+ "font": {
23
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
24
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
25
+ "__isAsset": true
26
+ },
27
+ "fontSize": 3.8,
28
+ "alignment": {
29
+ "horizontal": "left"
30
+ },
31
+ "fontColor": "#585858"
32
+ },
33
+ "photosMode": "zip",
34
+ "updateTime": 300000,
35
+ "dateEnabled": true,
36
+ "excludePast": false,
37
+ "itemMargins": "5px",
38
+ "orientation": "h",
39
+ "datePosition": 1,
40
+ "imageEnabled": true,
41
+ "textPosition": 3,
42
+ "animationMode": "fade",
43
+ "animationTime": "5",
44
+ "containerRows": "3",
45
+ "dateAlignment": "center",
46
+ "dateDayFormat": {
47
+ "font": {
48
+ "id": "c705a739-312e-4334-9231-e73a05e9d382",
49
+ "filename": "c705a739-312e-4334-9231-e73a05e9d382.ttf",
50
+ "__isAsset": true
51
+ },
52
+ "fontSize": 55,
53
+ "alignment": {
54
+ "horizontal": "center"
55
+ },
56
+ "fontColor": "#ffffff"
57
+ },
58
+ "imagePosition": 2,
59
+ "textAlignment": "center",
60
+ "animationOrder": false,
61
+ "animationSpeed": 1.5,
62
+ "imageAlignment": "center",
63
+ "backgroundImage": {
64
+ "id": "",
65
+ "filename": "",
66
+ "__isAsset": true
67
+ },
68
+ "dateMonthFormat": {
69
+ "font": {
70
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
71
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
72
+ "__isAsset": true
73
+ },
74
+ "fontSize": 20,
75
+ "alignment": {
76
+ "horizontal": "center"
77
+ },
78
+ "fontColor": "#ffffff"
79
+ },
80
+ "containerColumns": "1",
81
+ "containerRowsGap": "5",
82
+ "datePrimaryColor": "#d13139",
83
+ "abbreviatedMonths": false,
84
+ "descriptionFormat": {
85
+ "font": {
86
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
87
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
88
+ "__isAsset": true
89
+ },
90
+ "fontSize": 3.8,
91
+ "alignment": {
92
+ "horizontal": "left"
93
+ },
94
+ "fontColor": "#585858"
95
+ },
96
+ "descriptionEnabled": true
6
97
  }
7
98
  }
@@ -1,41 +0,0 @@
1
- import React from 'react'
2
-
3
- type Props = {
4
- parameters: VixonicParameters
5
- downloadsPath: string
6
- paths: string[]
7
- }
8
-
9
- export const FontLoader = ({ parameters, downloadsPath, paths }: Props) => {
10
- const _getValueByPath = (path: any, obj: any): any => {
11
- const pathsArray = path.split('.')
12
- const propertyName = pathsArray[0]
13
- if (pathsArray.length === 1) return obj[propertyName]
14
- else {
15
- pathsArray.splice(0, 1)
16
- return _getValueByPath(pathsArray.join('.'), obj[propertyName])
17
- }
18
- }
19
-
20
- const fonts = paths.map((path: any) => {
21
- try {
22
- const fontParam = _getValueByPath(path, parameters)
23
- const font = {
24
- family: fontParam.filename.replace('.', '-'),
25
- src: `${downloadsPath}/${fontParam.filename}`
26
- }
27
- return `
28
- @font-face {
29
- font-family: "${font.family}";
30
- src: url("${font.src}");
31
- }
32
- `
33
- } catch (err) {
34
- return ''
35
- }
36
- })
37
-
38
- return (
39
- <style>{fonts}</style>
40
- )
41
- }
@@ -1,11 +0,0 @@
1
- import { Results } from './Results'
2
- import { Row } from './Row'
3
- import { Status } from './Status'
4
- import { Time } from './Time'
5
-
6
- export {
7
- Results,
8
- Row,
9
- Status,
10
- Time
11
- }
@@ -1,50 +0,0 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { Row } from './components'
3
-
4
- type Props = {
5
- dataFixture: any[]
6
- parameters: VixonicParameters
7
- }
8
-
9
- export const Table = ({ dataFixture, parameters }: Props) => {
10
- const { itemsPerPage, durationPerPage } = parameters
11
- const rows = Number(itemsPerPage)
12
- const orderedData = dataFixture.sort((a, b) => a.fixture.timestamp - b.fixture.timestamp)
13
- const [page, setPage] = useState<number>(1)
14
- const [items, setItems] = useState<string[][]>(orderedData.slice(0, rows))
15
- const total = orderedData.length
16
-
17
- useEffect(() => {
18
- const timer = setTimeout(() => {
19
- handlePagination()
20
- }, Number(durationPerPage) * 1000)
21
-
22
- return () => clearTimeout(timer)
23
- }, [page, dataFixture])
24
-
25
- const handlePagination = () => {
26
- const newPage = page < (total / rows) ? page + 1 : 1
27
- const startIndex = rows * (newPage - 1)
28
- const endIndex = (startIndex + rows) < total ? startIndex + rows : total
29
- const filterData = orderedData.slice(startIndex, endIndex)
30
- setItems(filterData)
31
- setPage(newPage)
32
- }
33
-
34
- return <div
35
- style={{
36
- display: 'flex',
37
- width: '100%',
38
- height: '100%',
39
- justifyContent: 'center',
40
- alignItems: 'center',
41
- flexDirection: 'column'
42
- }}
43
- >
44
- {
45
- items.map((item: any) => (
46
- <Row item={item} parameters={parameters} />
47
- ))
48
- }
49
- </div>
50
- }
@@ -1,9 +0,0 @@
1
- import { FontLoader } from './FontLoader'
2
- import { FormattedText } from './FormattedText'
3
- import { Table } from './Table'
4
-
5
- export {
6
- FontLoader,
7
- FormattedText,
8
- Table
9
- }