@vixoniccom/footbal-score 1.0.1-beta.0 → 1.0.1-beta.10

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,4 +2,26 @@
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.0.1-beta.10](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.9...v1.0.1-beta.10) (2022-11-21)
6
+
7
+ ### [1.0.1-beta.9](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.8...v1.0.1-beta.9) (2022-11-21)
8
+
9
+ ### [1.0.1-beta.8](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.7...v1.0.1-beta.8) (2022-11-21)
10
+
11
+ ### [1.0.1-beta.6](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.7...v1.0.1-beta.6) (2022-11-21)
12
+
13
+ ### [1.0.1-beta.7](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.6...v1.0.1-beta.7) (2022-11-21)
14
+
15
+ ### [1.0.1-beta.6](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.5...v1.0.1-beta.6) (2022-11-21)
16
+
17
+ ### [1.0.1-beta.5](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.4...v1.0.1-beta.5) (2022-11-21)
18
+
19
+ ### [1.0.1-beta.4](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.3...v1.0.1-beta.4) (2022-11-16)
20
+
21
+ ### [1.0.1-beta.3](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.2...v1.0.1-beta.3) (2022-11-16)
22
+
23
+ ### [1.0.1-beta.2](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.1...v1.0.1-beta.2) (2022-11-16)
24
+
25
+ ### [1.0.1-beta.1](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.0...v1.0.1-beta.1) (2022-11-15)
26
+
5
27
  ### 1.0.1-beta.0 (2022-11-15)
package/build.zip CHANGED
Binary file
@@ -10,6 +10,43 @@
10
10
  "type": "label",
11
11
  "label": "Datos"
12
12
  },
13
+ {
14
+ "id": "updateTime",
15
+ "type": "select-input",
16
+ "required": true,
17
+ "label": "Actualización",
18
+ "defaultValue": 300000,
19
+ "items": [
20
+ {
21
+ "label": "5 minutos",
22
+ "value": 300000
23
+ },
24
+ {
25
+ "label": "10 minutos",
26
+ "value": 600000
27
+ },
28
+ {
29
+ "label": "30 minutos",
30
+ "value": 1800000
31
+ },
32
+ {
33
+ "label": "1 hora",
34
+ "value": 3600000
35
+ },
36
+ {
37
+ "label": "6 horas",
38
+ "value": 21600000
39
+ },
40
+ {
41
+ "label": "12 horas",
42
+ "value": 43200000
43
+ },
44
+ {
45
+ "label": "Diario",
46
+ "value": 86400000
47
+ }
48
+ ]
49
+ },
13
50
  {
14
51
  "type": "switch",
15
52
  "id": "titleEnabled",
@@ -59,6 +96,20 @@
59
96
  "required": false,
60
97
  "label": "Márgenes",
61
98
  "description": "CSS para dar espacio arriba/derecha/abajo/izquieda."
99
+ },
100
+ {
101
+ "id": "columnGap",
102
+ "type": "text-input",
103
+ "required": false,
104
+ "label": "Separación entre columnas",
105
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 10px)"
106
+ },
107
+ {
108
+ "id": "rowGap",
109
+ "type": "text-input",
110
+ "required": false,
111
+ "label": "Separación entre filas",
112
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 30px)"
62
113
  }
63
114
  ]
64
115
  },
@@ -77,20 +128,60 @@
77
128
  "id": "timeFormat",
78
129
  "label": "Formato Tiempo"
79
130
  },
131
+ {
132
+ "id": "widthTime",
133
+ "type": "text-input",
134
+ "required": false,
135
+ "label": "Ancho columna fecha partido",
136
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 200px)",
137
+ "defaultValue":"200px"
138
+ },
80
139
  {
81
140
  "type": "text-format",
82
141
  "id": "statusFormat",
83
- "label": "Formato Status Partido"
142
+ "label": "Formato Status"
143
+ },
144
+ {
145
+ "id": "widthStatus",
146
+ "type": "text-input",
147
+ "required": false,
148
+ "label": "Ancho columna Status Partido",
149
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 200px)",
150
+ "defaultValue":"200px"
84
151
  },
85
152
  {
86
153
  "type": "text-format",
87
154
  "id": "goalsFormat",
88
155
  "label": "Formato Goles"
89
156
  },
157
+ {
158
+ "id": "widthScore",
159
+ "type": "text-input",
160
+ "required": false,
161
+ "label": "Ancho columna Goles",
162
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 100px)",
163
+ "defaultValue":"200px"
164
+ },
165
+ {
166
+ "type": "switch",
167
+ "id": "descriptionEnabled",
168
+ "label": "Nombre Equipos",
169
+ "defaultValue": true
170
+ },
90
171
  {
91
172
  "type": "text-format",
92
173
  "id": "descriptionFormat",
93
- "label": "Formato Nombre Equipo"
174
+ "label": "Formato Nombre Equipo",
175
+ "show": "{{descriptionEnabled}} === true"
176
+ },
177
+ {
178
+ "id": "widthDescription",
179
+ "type": "text-input",
180
+ "required": false,
181
+ "label": "Ancho columna Nombre Equipo",
182
+ "show": "{{descriptionEnabled}} === true",
183
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 200px)",
184
+ "defaultValue":"200px"
94
185
  },
95
186
  {
96
187
  "type": "label",
@@ -101,8 +192,15 @@
101
192
  "id": "imageSize",
102
193
  "range": "[1:100]",
103
194
  "label": "Tamaño",
104
- "description": "Tamaño de la imagen en porcentaje.",
105
- "show": "{{imageEnabled}} === true"
195
+ "description": "Tamaño de la imagen en porcentaje."
196
+ },
197
+ {
198
+ "id": "widthImage",
199
+ "type": "text-input",
200
+ "required": false,
201
+ "label": "Ancho columna Bandera",
202
+ "description": "Agregar en px, ejemplo 100px. (Por defecto son 300px)",
203
+ "defaultValue":"300px"
106
204
  }
107
205
  ]
108
206
  }
package/icon.png CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixoniccom/footbal-score",
3
3
  "alias": "Resultados Deportivos",
4
- "version": "1.0.1-beta.0",
4
+ "version": "1.0.1-beta.10",
5
5
  "description": "Muestra resultados en vivo de fútbol.",
6
6
  "main": "main.js",
7
7
  "author": "",
package/src/App.tsx CHANGED
@@ -10,7 +10,7 @@ type Props = {
10
10
  }
11
11
 
12
12
  export const App = ({ data, start }: Props) => {
13
- const [dataFixture, setDataFixture] = useState([]);
13
+ const [dataFixture, setDataFixture] = useState([]);
14
14
 
15
15
  const { configureState, addConfiguration } = useContext(ConfigureContext)
16
16
 
@@ -19,8 +19,10 @@ export const App = ({ data, start }: Props) => {
19
19
  const { backgroundImage,
20
20
  padding,
21
21
  msj0 = '',
22
+ updateTime
22
23
  } = parameters
23
-
24
+ console.log("🚀 ~ file: App.tsx ~ line 24 ~ App ~ updateTime", updateTime)
25
+
24
26
  let backgroundImageState = backgroundImage && backgroundImage.filename
25
27
  ? `url("${downloadsPath}/${backgroundImage.filename}")`
26
28
  : ''
@@ -30,19 +32,20 @@ export const App = ({ data, start }: Props) => {
30
32
  setDataFixture(data);
31
33
  }
32
34
 
33
- //Request data every 5 minutes
34
- // useEffect(() => {
35
- // const interval = setInterval(() => {
36
- // if (start) getData()
37
- // }, 300000)
38
- // return () => clearInterval(interval)
39
- // }, [])
40
35
 
41
36
  useEffect(() => {
37
+ console.log('entro aquí')
42
38
  if (start) getData()
43
39
  addConfiguration(data)
44
40
  }, [data])
45
41
 
42
+ //Request data every 5 minutes
43
+ useEffect(() => {
44
+ const interval = setInterval(() => {
45
+ getData()
46
+ }, updateTime || 300000)
47
+ return () => clearInterval(interval)
48
+ }, [updateTime])
46
49
 
47
50
 
48
51
 
@@ -60,7 +63,7 @@ export const App = ({ data, start }: Props) => {
60
63
  padding: padding
61
64
  }}
62
65
  >
63
- <FontLoader paths={['nameFormat.font', 'descriptionFormat.font', 'dateDayFormat.font', 'dateMonthFormat.font']} parameters={parameters} downloadsPath={downloadsPath} />
66
+ <FontLoader paths={['nameFormat.font','statusFormat.font', 'timeFormat.font','titleFormat.font', 'descriptionFormat.font', 'dateDayFormat.font', 'dateMonthFormat.font', 'goalsFormat.font']} parameters={parameters} downloadsPath={downloadsPath} />
64
67
  {
65
68
  parameters.titleEnabled &&
66
69
  <div style={{
@@ -6,7 +6,7 @@ export const Results = (goals: any) => {
6
6
 
7
7
  const { configureState } = useContext(ConfigureContext)
8
8
  const { parameters } = configureState
9
-
9
+
10
10
 
11
11
  return (
12
12
  <div style={{
@@ -1,58 +1,94 @@
1
1
  import React, { useContext } from 'react'
2
2
  // import { TeamItems } from './TeamItems'
3
- import { Results } from './Results';
4
3
  import { Time } from './Time';
5
4
  import { FormattedText } from '../FormattedText';
6
5
  import { ConfigureContext } from '../../contex/configureContext/ConfigureContext';
6
+ import { Status } from './Status';
7
+ import { translateTeams } from '../../helpers/translateTeams';
7
8
 
8
9
  export const Row = (item: any) => {
9
10
 
10
11
  const { fixture, teams, goals } = item.item;
11
12
  const { configureState } = useContext(ConfigureContext)
12
13
  const { parameters } = configureState
14
+
15
+ const {
16
+ descriptionEnabled,
17
+ widthDescription,
18
+ descriptionFormat,
19
+ imageSize,
20
+ widthImage,
21
+ widthScore,
22
+ columnGap,
23
+ rowGap,
24
+ widthStatus,
25
+ widthTime,
26
+ goalsFormat
27
+ } = parameters
28
+ console.log("🚀 ~ file: Row.tsx ~ line 28 ~ Row ~ descriptionFormat", descriptionFormat)
29
+ console.log("🚀 ~ file: Row.tsx ~ line 28 ~ Row ~ goalsFormat", goalsFormat)
30
+
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"}`
33
+
34
+ let nameHome = translateTeams(teams.home.name)
35
+ let nameAway = translateTeams(teams.away.name)
36
+
13
37
  return (
14
38
  <div
15
39
  style={{
16
40
  display: 'grid',
17
- gridTemplateColumns: '1fr 1fr 8fr',
41
+ gridTemplateColumns: `${gridColumns}`,
42
+ columnGap: `${columnGap || "10px"}`,
18
43
  width: '100%',
19
- gap: '100px',
20
44
  alignItems: 'center',
45
+ placeContent: 'center',
46
+ padding: `${rowGap || "30px"} 0px`,
47
+ justifyContent: 'center'
21
48
  }}
22
49
  >
23
50
  <Time time={Number(fixture.timestamp)} />
24
- <FormattedText text={fixture.status.long} format={parameters.timeFormat} />
25
- <div
26
- style={{
27
- display: 'grid',
28
- gridTemplateColumns: '1fr 2fr 1fr 2fr 2fr',
29
- columnGap: '10px',
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- width: '100%',
33
- padding: '30px',
34
- placeContent: 'center',
35
- }}
36
- >
37
- <FormattedText text={teams.home.name} format={parameters.descriptionFormat} />
51
+
52
+ <Status status={fixture.status.short} />
53
+
54
+
55
+ {
56
+ descriptionEnabled &&
38
57
  <div style={{
39
58
  display: 'flex',
40
- justifyContent: 'center',
59
+ justifyContent: 'flex-end',
41
60
  }}>
42
- <img src={teams.home.logo} style={{ width: `${parameters.imageSize}%` }} />
61
+ <FormattedText text={nameHome} format={descriptionFormat} />
43
62
  </div>
63
+ }
64
+ <div style={{
65
+ display: 'flex',
66
+ justifyContent: 'center',
67
+ }}>
68
+ <img src={teams.home.logo} style={{ width: `${imageSize}%` }} />
69
+ </div>
44
70
 
45
- <Results goals={goals} />
46
- <div
47
- style={{
48
- display: 'flex',
49
- justifyContent: 'center',
50
- }}
51
- >
52
- <img src={teams.away.logo} style={{ width: `${parameters.imageSize}%` }} />
53
- </div>
54
- <FormattedText text={teams.away.name} format={parameters.descriptionFormat} />
71
+ <div style={{
72
+ display: 'flex',
73
+ justifyContent: 'center',
74
+ }}>
75
+ <FormattedText text={goals.home ? goals.home : 0} format={goalsFormat} />
76
+ <FormattedText text={"-"} format={goalsFormat} />
77
+ <FormattedText text={goals.away ? goals.away : 0} format={goalsFormat} />
78
+ </div>
79
+
80
+ <div
81
+ style={{
82
+ display: 'flex',
83
+ justifyContent: 'center',
84
+ }}
85
+ >
86
+ <img src={teams.away.logo} style={{ width: `${imageSize}%` }} />
55
87
  </div>
56
- </div>
88
+ {
89
+ descriptionEnabled &&
90
+ <FormattedText text={nameAway} format={descriptionFormat} />
91
+ }
92
+ </div >
57
93
  )
58
94
  }
@@ -0,0 +1,49 @@
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) => {
8
+
9
+ let translateStatus: string = ''
10
+ const { configureState } = useContext(ConfigureContext)
11
+ const { parameters } = configureState
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
+ }
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
+ )
49
+ }
@@ -50,13 +50,20 @@ const INITIAL_STATE: VixonicData = {
50
50
  template: "",
51
51
  textAlignment: "center",
52
52
  textPosition: 0,
53
- updateTime: 0,
53
+ updateTime: 300000,
54
54
  urlBaseApi: "",
55
55
  imageMargin: "",
56
56
  textMargin: "",
57
57
  dateMargin: "",
58
- separator: false
59
- }
58
+ separator: false,
59
+ widthDescription: "200px",
60
+ widthImage: "300px",
61
+ widthScore: "100px",
62
+ columnGap: "10px",
63
+ rowGap: "30px",
64
+ widthStatus: "200px",
65
+ widthTime: "200px",
66
+ }
60
67
  }
61
68
 
62
69
  interface props {
@@ -44,7 +44,14 @@ export const parameterReducer = (state: VixonicData, action: ConfigureAction) =>
44
44
  titleEnabled: parameters.titleEnabled,
45
45
  titleFormat: parameters.titleFormat,
46
46
  statusFormat: parameters.statusFormat,
47
- }
47
+ widthDescription: parameters.widthDescription,
48
+ widthImage: parameters.widthImage,
49
+ widthScore: parameters.widthScore,
50
+ columnGap: parameters.columnGap,
51
+ rowGap: parameters.rowGap,
52
+ widthTime: parameters.widthTime,
53
+ widthStatus: parameters.widthStatus,
54
+ }
48
55
  }
49
56
  default:
50
57
  return state;
@@ -1,20 +1,26 @@
1
- // import moment from 'moment';
1
+ import moment from 'moment';
2
2
  const axios = require("axios");
3
3
 
4
4
  export const getFixture = async () => {
5
5
 
6
- // const today = moment().format('YYYY-MM-DD')
6
+ const today = moment().format('YYYY-MM-DD')
7
7
  // console.log("🚀 ~ file: getFixture.ts ~ line 6 ~ getFixture ~ today", today)
8
8
 
9
9
  const options = {
10
10
  method: 'GET',
11
11
  url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
12
- params: { date: '2022-11-21', league: '1', season: '2022' },
12
+ params: { date: `${today}`, league: '1', season: '2022' },
13
13
  headers: {
14
14
  'X-RapidAPI-Key': 'a7e693d4c5msh72a2ff2020fd601p12dd08jsn0f168421d7bb',
15
15
  'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com'
16
16
  }
17
17
  };
18
- const response = await axios.request(options)
19
- return response.data.response
18
+ try {
19
+ const response = await axios.request(options)
20
+ return response.data.response
21
+ } catch (error) {
22
+ console.error(error);
23
+ return []
24
+ }
25
+
20
26
  }
@@ -0,0 +1,89 @@
1
+
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
+ default:
87
+ return team
88
+ }
89
+ }
@@ -13,7 +13,7 @@ declare type VixonicParameters = Partial<{
13
13
  animationOrder: boolean
14
14
  animationSpeed: number
15
15
  animationTime: string
16
- animationStagger:number
16
+ animationStagger: number
17
17
  apiDomain: string
18
18
  backgroundImage: GeneralData
19
19
  containerColumns: string
@@ -25,6 +25,7 @@ declare type VixonicParameters = Partial<{
25
25
  dateDayFormat: DateFormat
26
26
  timeFormat: DateFormat
27
27
  goalsFormat: DateFormat
28
+ updateTime: number
28
29
  dateEnabled: boolean
29
30
  title0: string
30
31
  titleEnabled: boolean
@@ -62,6 +63,13 @@ declare type VixonicParameters = Partial<{
62
63
  nameMaxChar: number,
63
64
  descriptionMaxChar: number,
64
65
  statusFormat: DateFormat,
66
+ widthDescription: string,
67
+ widthImage: string,
68
+ widthScore: string,
69
+ columnGap: string,
70
+ rowGap: string,
71
+ widthTime: string,
72
+ widthStatus: string
65
73
  }>
66
74
 
67
75
 
@@ -2,6 +2,10 @@
2
2
  "parameters": {
3
3
  "urlBaseApi": "mandomedio",
4
4
  "msj0": "No hay partidos",
5
+ "statusEnabled": true,
6
+ "timeRequest":60000,
7
+ "rowGap":"30px",
8
+ "columnGap":"10px",
5
9
  "padding": "30px 25px 80px 40px",
6
10
  "dataMode": "monthly",
7
11
  "template": "standard",