@vixoniccom/footbal-score 1.0.1-beta.16 → 1.0.1-beta.17

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,8 @@
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.17](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.16...v1.0.1-beta.17) (2022-11-23)
6
+
5
7
  ### [1.0.1-beta.16](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.15...v1.0.1-beta.16) (2022-11-23)
6
8
 
7
9
  ### [1.0.1-beta.15](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.14...v1.0.1-beta.15) (2022-11-22)
package/build.zip 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.16",
4
+ "version": "1.0.1-beta.17",
5
5
  "description": "Muestra resultados en vivo de fútbol.",
6
6
  "main": "main.js",
7
7
  "author": "",
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react'
1
+ import React, { useContext, useEffect, useState } from 'react'
2
2
  // import { TeamItems } from './TeamItems'
3
3
  import { Time } from './Time';
4
4
  import { FormattedText } from '../FormattedText';
@@ -12,6 +12,8 @@ export const Row = (item: any) => {
12
12
  const { fixture, teams, goals } = item.item;
13
13
  const { configureState } = useContext(ConfigureContext)
14
14
  const { parameters } = configureState
15
+ const [homeTeam, setHomeTeam] = useState(false);
16
+ const [awayTeam, setAwayTeam] = useState(false);
15
17
 
16
18
  const {
17
19
  descriptionEnabled,
@@ -25,14 +27,44 @@ export const Row = (item: any) => {
25
27
  widthStatus,
26
28
  widthTime,
27
29
  } = parameters
28
-
30
+
29
31
  let gridColumns = descriptionEnabled ? `${widthTime || "200px"} ${widthStatus || "200px"} ${widthDescription || "200px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"} ${widthDescription || "200px"}` :
30
32
  ` ${widthTime || "100px"} ${widthStatus || "100px"} ${widthImage || "300px"} ${widthScore || "100px"} ${widthImage || "300px"}`
31
33
 
32
34
  let nameHome = translateTeams(teams.home.name)
33
35
  let nameAway = translateTeams(teams.away.name)
34
- let idHome = teams.home.id
35
- let idAway = teams.away.id
36
+
37
+
38
+ const requestFlagHome = async(id:any) =>{
39
+ try {
40
+ const resp1 = await fetch(`https://storage.googleapis.com/vixoniccom-emails/results_flags/${id}.png`)
41
+ if(resp1.status === 200){
42
+ setHomeTeam(true)
43
+ }
44
+ } catch (error) {
45
+ console.log(error)
46
+ setHomeTeam(false)
47
+ }
48
+ }
49
+
50
+ const requestFlagAway = async(id:any) =>{
51
+ try {
52
+ const resp1 = await fetch(`https://storage.googleapis.com/vixoniccom-emails/results_flags/${id}.png`)
53
+ if(resp1.status === 200){
54
+ setAwayTeam(true)
55
+ }
56
+ } catch (error) {
57
+ console.log(error)
58
+ setAwayTeam(false)
59
+
60
+ }
61
+ }
62
+
63
+ useEffect(() =>{
64
+ requestFlagHome(teams.home.id)
65
+ requestFlagAway(teams.away.id)
66
+ },[])
67
+
36
68
 
37
69
  return (
38
70
  <div
@@ -58,6 +90,8 @@ export const Row = (item: any) => {
58
90
  <div style={{
59
91
  display: 'flex',
60
92
  justifyContent: 'flex-end',
93
+ minWidth: '100px',
94
+ marginRight: '5px'
61
95
  }}>
62
96
  <FormattedText text={nameHome} format={descriptionFormat} />
63
97
  </div>
@@ -69,8 +103,8 @@ export const Row = (item: any) => {
69
103
  alignItems: 'center',
70
104
  }}>
71
105
  {
72
- idHome ?
73
- <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${idHome}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />:
106
+ homeTeam ?
107
+ <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${teams.home.id}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />:
74
108
  <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/0000.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
75
109
 
76
110
  }
@@ -81,20 +115,28 @@ export const Row = (item: any) => {
81
115
  <div
82
116
  style={{
83
117
  display: 'flex',
84
- justifyContent: 'center',
118
+ justifyContent: 'flex-start',
85
119
  width: '100%',
86
120
  alignItems: 'center'
87
121
  }}
88
122
  >
89
123
  {
90
- idAway ?
91
- <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${idAway}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
124
+ awayTeam ?
125
+ <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${teams.away.id}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
92
126
  : <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/0000.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
93
127
  }
94
128
  </div>
95
129
  {
96
130
  descriptionEnabled &&
97
- <FormattedText text={nameAway} format={descriptionFormat} />
131
+ <div
132
+ style={{
133
+ display: 'flex',
134
+ justifyContent: 'flex-start',
135
+ minWidth: '100px'
136
+ }}
137
+ >
138
+ <FormattedText text={nameAway} format={descriptionFormat} />
139
+ </div>
98
140
  }
99
141
  </div >
100
142
  )