@vixoniccom/footbal-score 1.0.1-beta.15 → 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,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.17](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.16...v1.0.1-beta.17) (2022-11-23)
6
+
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)
8
+
5
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)
6
10
 
7
11
  ### [1.0.1-beta.14](https://gitlab.com/mandomedio/vixonic/football-score/compare/v1.0.1-beta.13...v1.0.1-beta.14) (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.15",
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,13 +27,45 @@ 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
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
+
68
+
35
69
  return (
36
70
  <div
37
71
  style={{
@@ -56,6 +90,8 @@ export const Row = (item: any) => {
56
90
  <div style={{
57
91
  display: 'flex',
58
92
  justifyContent: 'flex-end',
93
+ minWidth: '100px',
94
+ marginRight: '5px'
59
95
  }}>
60
96
  <FormattedText text={nameHome} format={descriptionFormat} />
61
97
  </div>
@@ -66,7 +102,12 @@ export const Row = (item: any) => {
66
102
  width: '100%',
67
103
  alignItems: 'center',
68
104
  }}>
69
- <img src={teams.home.logo} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
105
+ {
106
+ homeTeam ?
107
+ <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${teams.home.id}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />:
108
+ <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/0000.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
109
+
110
+ }
70
111
  </div>
71
112
 
72
113
  <Results goals={goals} />
@@ -74,16 +115,28 @@ export const Row = (item: any) => {
74
115
  <div
75
116
  style={{
76
117
  display: 'flex',
77
- justifyContent: 'center',
118
+ justifyContent: 'flex-start',
78
119
  width: '100%',
79
120
  alignItems: 'center'
80
121
  }}
81
122
  >
82
- <img src={teams.away.logo} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
123
+ {
124
+ awayTeam ?
125
+ <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/${teams.away.id}.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
126
+ : <img src={`https://storage.googleapis.com/vixoniccom-emails/results_flags/0000.png`} style={{ width: `${imageSize ? imageSize : 100}%`, objectFit: 'contain' }} />
127
+ }
83
128
  </div>
84
129
  {
85
130
  descriptionEnabled &&
86
- <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>
87
140
  }
88
141
  </div >
89
142
  )
@@ -3,7 +3,7 @@ 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 = {