@vixoniccom/footbal-score 1.0.1-beta.7 → 1.0.1-beta.8

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,10 @@
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.8](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.7...v1.0.1-beta.8) (2022-11-21)
6
+
7
+ ### [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)
8
+
5
9
  ### [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)
6
10
 
7
11
  ### [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)
package/build.zip CHANGED
Binary file
@@ -11,14 +11,42 @@
11
11
  "label": "Datos"
12
12
  },
13
13
  {
14
- "id": "timeRequest",
15
- "type": "number-input",
16
- "range": "[60000:12000000]",
17
- "required": false,
18
- "label": "Tiempo de actualización app",
19
- "description": "Por defecto son 60000 ms (1 minutos)",
20
- "defaultValue":"60000"
21
- },
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
+ },
22
50
  {
23
51
  "type": "switch",
24
52
  "id": "titleEnabled",
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.7",
4
+ "version": "1.0.1-beta.8",
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,34 +19,33 @@ export const App = ({ data, start }: Props) => {
19
19
  const { backgroundImage,
20
20
  padding,
21
21
  msj0 = '',
22
- timeRequest
22
+ updateTime
23
23
  } = parameters
24
- console.log("🚀 ~ file: App.tsx ~ line 24 ~ App ~ timeRequest", timeRequest)
25
-
24
+ console.log("🚀 ~ file: App.tsx ~ line 24 ~ App ~ updateTime", updateTime)
25
+
26
26
  let backgroundImageState = backgroundImage && backgroundImage.filename
27
27
  ? `url("${downloadsPath}/${backgroundImage.filename}")`
28
28
  : ''
29
29
 
30
30
  const getData = async () => {
31
31
  const data = await getFixture();
32
- console.log("🚀 ~ file: App.tsx ~ line 32 ~ getData ~ data", data)
33
32
  setDataFixture(data);
34
33
  }
35
34
 
36
- //Request data every 5 minutes
37
- useEffect(() => {
38
- const interval = setInterval(() => {
39
- console.log('start', start)
40
- if (start) getData()
41
- }, timeRequest || 60000)
42
- return () => clearInterval(interval)
43
- }, [timeRequest])
44
35
 
45
36
  useEffect(() => {
37
+ console.log('entro aquí')
46
38
  if (start) getData()
47
39
  addConfiguration(data)
48
40
  }, [data])
49
41
 
42
+ //Request data every 5 minutes
43
+ useEffect(() => {
44
+ const interval = setInterval(() => {
45
+ getData()
46
+ }, updateTime || 300000)
47
+ return () => clearInterval(interval)
48
+ }, [updateTime])
50
49
 
51
50
 
52
51
 
@@ -6,8 +6,7 @@ export const Results = (goals: any) => {
6
6
 
7
7
  const { configureState } = useContext(ConfigureContext)
8
8
  const { parameters } = configureState
9
- console.log("🚀 ~ file: Results.tsx ~ line 9 ~ Results ~ parameters", parameters.goalsFormat)
10
-
9
+
11
10
 
12
11
  return (
13
12
  <div style={{
@@ -4,6 +4,7 @@ import { Time } from './Time';
4
4
  import { FormattedText } from '../FormattedText';
5
5
  import { ConfigureContext } from '../../contex/configureContext/ConfigureContext';
6
6
  import { Status } from './Status';
7
+ import { translateTeams } from '../../helpers/translateTeams';
7
8
 
8
9
  export const Row = (item: any) => {
9
10
 
@@ -21,13 +22,14 @@ export const Row = (item: any) => {
21
22
  columnGap,
22
23
  rowGap,
23
24
  widthStatus,
24
- widthTime,
25
- goalsFormat
25
+ widthTime
26
26
  } = parameters
27
27
 
28
28
  let gridColumns = descriptionEnabled ? `${widthTime || "200px"} ${widthStatus || "200px"} ${widthDescription || "200px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"} ${widthDescription || "200px"}` :
29
29
  ` ${widthTime || "100px"} ${widthStatus || "100px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"}`
30
30
 
31
+ let nameHome = translateTeams(teams.home.name)
32
+ let nameAway = translateTeams(teams.away.name)
31
33
 
32
34
  return (
33
35
  <div
@@ -53,7 +55,7 @@ export const Row = (item: any) => {
53
55
  display: 'flex',
54
56
  justifyContent: 'flex-end',
55
57
  }}>
56
- <FormattedText text={teams.home.name} format={descriptionFormat} />
58
+ <FormattedText text={nameHome} format={descriptionFormat} />
57
59
  </div>
58
60
  }
59
61
  <div style={{
@@ -67,9 +69,9 @@ export const Row = (item: any) => {
67
69
  display: 'flex',
68
70
  justifyContent: 'center',
69
71
  }}>
70
- <FormattedText text={goals.home ? goals.home : 0} format={goalsFormat} />
71
- <FormattedText text={"-"} format={goalsFormat} />
72
- <FormattedText text={goals.away ? goals.away : 0} format={goalsFormat} />
72
+ <FormattedText text={goals.home ? goals.home : 0} format={descriptionFormat} />
73
+ <FormattedText text={"-"} format={descriptionFormat} />
74
+ <FormattedText text={goals.away ? goals.away : 0} format={descriptionFormat} />
73
75
  </div>
74
76
 
75
77
  <div
@@ -82,7 +84,7 @@ export const Row = (item: any) => {
82
84
  </div>
83
85
  {
84
86
  descriptionEnabled &&
85
- <FormattedText text={teams.away.name} format={descriptionFormat} />
87
+ <FormattedText text={nameAway} format={descriptionFormat} />
86
88
  }
87
89
  </div >
88
90
  )
@@ -50,7 +50,7 @@ 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: "",
@@ -63,8 +63,7 @@ const INITIAL_STATE: VixonicData = {
63
63
  rowGap: "30px",
64
64
  widthStatus: "200px",
65
65
  widthTime: "200px",
66
- timeRequest: 60000
67
- }
66
+ }
68
67
  }
69
68
 
70
69
  interface props {
@@ -51,8 +51,7 @@ export const parameterReducer = (state: VixonicData, action: ConfigureAction) =>
51
51
  rowGap: parameters.rowGap,
52
52
  widthTime: parameters.widthTime,
53
53
  widthStatus: parameters.widthStatus,
54
- timeRequest: parameters.timeRequest,
55
- }
54
+ }
56
55
  }
57
56
  default:
58
57
  return state;
@@ -15,6 +15,12 @@ export const getFixture = async () => {
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
+ }
@@ -25,7 +25,7 @@ declare type VixonicParameters = Partial<{
25
25
  dateDayFormat: DateFormat
26
26
  timeFormat: DateFormat
27
27
  goalsFormat: DateFormat
28
- timeRequest: number
28
+ updateTime: number
29
29
  dateEnabled: boolean
30
30
  title0: string
31
31
  titleEnabled: boolean