@vixoniccom/footbal-score 1.2.0 → 1.2.1-beta.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 +7 -0
- package/build.zip +0 -0
- package/configuration.json +12 -0
- package/package.json +1 -1
- package/src/App.tsx +12 -18
- package/src/components/FontLoader/index.tsx +41 -0
- package/src/components/{FormattedText.tsx → FormattedText/index.tsx} +12 -14
- package/src/components/{table-fixture → Table/components}/Results.tsx +3 -7
- package/src/components/{table-fixture → Table/components}/Row.tsx +16 -22
- package/src/components/{table-fixture → Table/components}/Status.tsx +3 -10
- package/src/components/{table-fixture → Table/components}/Time.tsx +3 -7
- package/src/components/Table/components/index.ts +11 -0
- package/src/components/Table/index.tsx +26 -0
- package/src/components/index.ts +9 -0
- package/src/helpers/getFixture.ts +6 -3
- package/src/helpers/translateTeams.ts +0 -1
- package/src/main.tsx +4 -8
- package/src/parameters.d.ts +28 -28
- package/src/test/parameters.json +3 -94
- package/src/components/FontLoader.tsx +0 -54
- package/src/components/table-fixture/Table.tsx +0 -27
- package/src/components/table-fixture/TeamItems.tsx +0 -32
- package/src/contex/configureContext/ConfigureContext.tsx +0 -8
- package/src/contex/configureContext/ConfigureProvider.tsx +0 -87
- package/src/contex/configureContext/configureReducer.ts +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.0...v1.2.1-beta.0) (2024-06-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
|
|
5
12
|
## [1.2.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.0-beta.0...v1.2.0) (2024-06-24)
|
|
6
13
|
|
|
7
14
|
## [1.2.0-beta.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.0.3...v1.2.0-beta.0) (2024-06-24)
|
package/build.zip
CHANGED
|
Binary file
|
package/configuration.json
CHANGED
|
@@ -31,6 +31,18 @@
|
|
|
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
|
+
},
|
|
34
46
|
{
|
|
35
47
|
"id": "timeStart",
|
|
36
48
|
"type": "select-input",
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import 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'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
7
2
|
import localforage from 'localforage'
|
|
8
3
|
import moment from 'moment'
|
|
4
|
+
import { FontLoader, FormattedText, Table } from './components'
|
|
5
|
+
import { getFixture } from './helpers/getFixture'
|
|
9
6
|
|
|
10
|
-
type Props = {
|
|
11
|
-
data: VixonicData
|
|
7
|
+
export type Props = {
|
|
8
|
+
data: VixonicData
|
|
12
9
|
start: boolean
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
export const App = ({ data, start }: Props) => {
|
|
16
|
-
const [dataFixture, setDataFixture] = useState([])
|
|
17
|
-
const [league, setLeague] = useState('')
|
|
18
|
-
const {
|
|
19
|
-
const { parameters, downloadsPath } = configureState
|
|
13
|
+
const [dataFixture, setDataFixture] = useState<any[]>([])
|
|
14
|
+
const [league, setLeague] = useState<string>('')
|
|
15
|
+
const { parameters, downloadsPath } = data
|
|
20
16
|
const { backgroundImage, padding, msj0 = '', updateTime } = parameters
|
|
21
17
|
const backgroundImageState = backgroundImage && backgroundImage.filename
|
|
22
18
|
? `url("${downloadsPath}/${backgroundImage.filename}")`
|
|
@@ -27,12 +23,11 @@ export const App = ({ data, start }: Props) => {
|
|
|
27
23
|
const momentLocalStorage: any = dataLocal ? moment().diff(dataLocal.date, 'millisecond') : undefined
|
|
28
24
|
const timeNowFormat = moment().format('h:mma')
|
|
29
25
|
const timeNow = moment(timeNowFormat, 'h:mma')
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const horaFin = moment(data.parameters.timeEnd, 'h:mma')
|
|
26
|
+
const horaInicio = moment(parameters.timeStart, 'h:mma')
|
|
27
|
+
const horaFin = moment(parameters.timeEnd, 'h:mma')
|
|
33
28
|
|
|
34
29
|
if (momentLocalStorage == undefined || (timeNow.isBetween(horaInicio, horaFin) && momentLocalStorage > updateTime!)) {
|
|
35
|
-
const dataRequest = await getFixture(
|
|
30
|
+
const dataRequest = await getFixture(parameters.league!, parameters.matchesYesterday, parameters.matchesTomorrow)
|
|
36
31
|
setDataLocal(dataRequest)
|
|
37
32
|
setDataFixture(dataRequest)
|
|
38
33
|
} else {
|
|
@@ -45,7 +40,6 @@ export const App = ({ data, start }: Props) => {
|
|
|
45
40
|
setLeague(data.parameters.league!)
|
|
46
41
|
getData()
|
|
47
42
|
}
|
|
48
|
-
addConfiguration(data)
|
|
49
43
|
}, [data])
|
|
50
44
|
|
|
51
45
|
useEffect(() => {
|
|
@@ -103,7 +97,7 @@ export const App = ({ data, start }: Props) => {
|
|
|
103
97
|
<FormattedText text={parameters.title0 || 'Partidos Mundial'} format={parameters.titleFormat} />
|
|
104
98
|
</div>
|
|
105
99
|
}
|
|
106
|
-
<Table dataFixture={dataFixture} />
|
|
100
|
+
<Table dataFixture={dataFixture} parameters={parameters} />
|
|
107
101
|
</div> :
|
|
108
102
|
<div
|
|
109
103
|
style={{
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
}
|
|
@@ -58,20 +58,18 @@ export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit,
|
|
|
58
58
|
justifyContent: getHorizontalAlignment(format.alignment)
|
|
59
59
|
}, style)
|
|
60
60
|
|
|
61
|
-
return
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</div>
|
|
74
|
-
)
|
|
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>
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
FormattedText.defaultProps = {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { FormattedText } from '../FormattedText'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { FormattedText } from '../../FormattedText'
|
|
4
3
|
import { isNumber } from 'lodash'
|
|
5
4
|
|
|
6
|
-
export const Results = ({ goals, score }: any) => {
|
|
7
|
-
const { configureState } = useContext(ConfigureContext)
|
|
8
|
-
const { parameters } = configureState
|
|
9
|
-
|
|
5
|
+
export const Results = ({ parameters, goals, score }: any) => {
|
|
10
6
|
return (
|
|
11
7
|
<div style={{
|
|
12
8
|
display: 'flex',
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Time
|
|
3
|
-
import { FormattedText } from '
|
|
4
|
-
import {
|
|
5
|
-
import { Status } from './Status'
|
|
6
|
-
import { translateTeams } from '../../helpers/translateTeams'
|
|
7
|
-
import { Results } from './Results'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Results, Status, Time } from './'
|
|
3
|
+
import { FormattedText } from '../../'
|
|
4
|
+
import { translateTeams } from '../../../helpers/translateTeams'
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
type Props = {
|
|
7
|
+
item: any,
|
|
8
|
+
parameters: VixonicParameters
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
const { parameters } = configureState
|
|
11
|
+
export const Row = ({ item, parameters }: Props) => {
|
|
12
|
+
const { fixture, teams, goals, score } = item
|
|
14
13
|
const [homeTeam, setHomeTeam] = useState(false)
|
|
15
14
|
const [awayTeam, setAwayTeam] = useState(false)
|
|
16
|
-
|
|
17
15
|
const {
|
|
18
16
|
descriptionEnabled,
|
|
19
17
|
widthDescription,
|
|
@@ -27,11 +25,10 @@ export const Row = (item: any) => {
|
|
|
27
25
|
widthTime,
|
|
28
26
|
} = parameters
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
const gridColumns = descriptionEnabled ? `${widthTime || '200px'} ${widthStatus || '200px'} ${widthDescription || '200px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'} ${widthDescription || '200px'}` :
|
|
31
29
|
` ${widthTime || '100px'} ${widthStatus || '100px'} ${widthImage || '300px'} ${widthScore || '100px'} ${widthImage || '300px'}`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let nameAway = translateTeams(teams.away.name)
|
|
30
|
+
const nameHome = translateTeams(teams.home.name)
|
|
31
|
+
const nameAway = translateTeams(teams.away.name)
|
|
35
32
|
|
|
36
33
|
const requestFlagHome = async (urlLogo: string) => {
|
|
37
34
|
try {
|
|
@@ -59,7 +56,6 @@ export const Row = (item: any) => {
|
|
|
59
56
|
requestFlagAway(teams.away.logo)
|
|
60
57
|
}, [])
|
|
61
58
|
|
|
62
|
-
|
|
63
59
|
return (
|
|
64
60
|
<div
|
|
65
61
|
style={{
|
|
@@ -80,7 +76,7 @@ export const Row = (item: any) => {
|
|
|
80
76
|
justifyContent: 'flex-end',
|
|
81
77
|
}}
|
|
82
78
|
>
|
|
83
|
-
<Time time={Number(fixture.timestamp)} />
|
|
79
|
+
<Time time={Number(fixture.timestamp)} parameters={parameters} />
|
|
84
80
|
</div>
|
|
85
81
|
<div
|
|
86
82
|
style={{
|
|
@@ -88,7 +84,7 @@ export const Row = (item: any) => {
|
|
|
88
84
|
justifyContent: 'flex-end',
|
|
89
85
|
}}
|
|
90
86
|
>
|
|
91
|
-
<Status status={fixture.status.short} />
|
|
87
|
+
<Status status={fixture.status.short} parameters={parameters} />
|
|
92
88
|
</div>
|
|
93
89
|
{
|
|
94
90
|
descriptionEnabled &&
|
|
@@ -114,9 +110,7 @@ export const Row = (item: any) => {
|
|
|
114
110
|
|
|
115
111
|
}
|
|
116
112
|
</div>
|
|
117
|
-
|
|
118
|
-
<Results goals={goals} score={score} />
|
|
119
|
-
|
|
113
|
+
<Results goals={goals} score={score} parameters={parameters} />
|
|
120
114
|
<div
|
|
121
115
|
style={{
|
|
122
116
|
display: 'flex',
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { FormattedText } from '../FormattedText'
|
|
4
|
-
|
|
5
|
-
export const Status = ({
|
|
6
|
-
status
|
|
7
|
-
}: any) => {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { FormattedText } from '../../'
|
|
8
3
|
|
|
4
|
+
export const Status = ({ status, parameters }: { status: string, parameters: VixonicParameters }) => {
|
|
9
5
|
let translateStatus: string = ''
|
|
10
|
-
const { configureState } = useContext(ConfigureContext)
|
|
11
|
-
const { parameters } = configureState
|
|
12
|
-
|
|
13
6
|
switch (status) {
|
|
14
7
|
case 'NS':
|
|
15
8
|
translateStatus = 'Por iniciar'
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import moment from 'moment'
|
|
2
|
-
import React
|
|
3
|
-
import {
|
|
4
|
-
import { FormattedText } from '../FormattedText'
|
|
5
|
-
|
|
6
|
-
export const Time = ({ time }: any) => {
|
|
7
|
-
const { configureState } = useContext(ConfigureContext)
|
|
8
|
-
const { parameters } = configureState
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { FormattedText } from '../../'
|
|
9
4
|
|
|
5
|
+
export const Time = ({ time, parameters }: { time: number, parameters: VixonicParameters }) => {
|
|
10
6
|
return (
|
|
11
7
|
<div style={{
|
|
12
8
|
display: 'flex',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React 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
|
+
return <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} parameters={parameters} />
|
|
23
|
+
))
|
|
24
|
+
}
|
|
25
|
+
</div>
|
|
26
|
+
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import moment from 'moment'
|
|
2
|
-
|
|
2
|
+
import axios from 'axios'
|
|
3
3
|
|
|
4
|
-
export const getFixture = async (league: string) => {
|
|
4
|
+
export const getFixture = async (league: string, yesterday?: boolean, tomorrow?: boolean) => {
|
|
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
|
+
|
|
7
10
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
8
11
|
const options = {
|
|
9
12
|
method: 'GET',
|
|
10
13
|
url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
|
|
11
|
-
params: {
|
|
14
|
+
params: { from, to, league: league, season: `${year}`, timezone: `${timezone}` },
|
|
12
15
|
headers: {
|
|
13
16
|
'X-RapidAPI-Key': 'a7e693d4c5msh72a2ff2020fd601p12dd08jsn0f168421d7bb',
|
|
14
17
|
'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com'
|
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 } from './App'
|
|
4
|
-
import { ParameterProvider } from './contex/configureContext/ConfigureProvider'
|
|
5
|
-
const { ipcRenderer } = require('electron')
|
|
3
|
+
import { App, Props } from './App'
|
|
6
4
|
|
|
5
|
+
const { ipcRenderer } = require('electron')
|
|
7
6
|
let start: boolean = false
|
|
7
|
+
|
|
8
8
|
ipcRenderer.on('preload', (_event: any, data: VixonicData) => {
|
|
9
9
|
render(data)
|
|
10
10
|
})
|
|
@@ -23,9 +23,5 @@ ipcRenderer.on('finish', (_event: any) => {
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
function render(data: VixonicData) {
|
|
26
|
-
ReactDOM.render(
|
|
27
|
-
<ParameterProvider>
|
|
28
|
-
<App data={data} start={start} />
|
|
29
|
-
</ParameterProvider>
|
|
30
|
-
, document.getElementById('root'))
|
|
26
|
+
ReactDOM.render(React.createElement<Props>(App, {data, start}), document.getElementById('root'))
|
|
31
27
|
}
|
package/src/parameters.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare type VixonicData = {
|
|
|
6
6
|
downloadsPath: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
declare type VixonicParameters = Partial<{
|
|
11
10
|
abbreviatedMonths: boolean
|
|
12
11
|
animationMode: string
|
|
@@ -53,42 +52,43 @@ declare type VixonicParameters = Partial<{
|
|
|
53
52
|
textAlignment: keyof typeof alignment
|
|
54
53
|
textPosition: number
|
|
55
54
|
updateTime: number
|
|
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
|
|
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
|
|
72
71
|
widthStatus: string
|
|
73
|
-
timeStart: string
|
|
74
|
-
timeEnd: string
|
|
75
|
-
formatMjs: DateFormat
|
|
76
|
-
alignVerticalMsj: string
|
|
72
|
+
timeStart: string
|
|
73
|
+
timeEnd: string
|
|
74
|
+
formatMjs: DateFormat
|
|
75
|
+
alignVerticalMsj: string
|
|
77
76
|
league: string
|
|
77
|
+
matchesTomorrow: boolean
|
|
78
|
+
matchesYesterday: boolean
|
|
78
79
|
}>
|
|
79
80
|
|
|
80
|
-
|
|
81
81
|
type GeneralData = {
|
|
82
82
|
filename?: string
|
|
83
|
-
id?: string
|
|
84
|
-
extension?: string
|
|
83
|
+
id?: string
|
|
84
|
+
extension?: string
|
|
85
85
|
_isAsset: boolean
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
type DateFormat = {
|
|
89
|
-
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
90
|
-
font?: GeneralData
|
|
91
|
-
fontColor?: string
|
|
89
|
+
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
90
|
+
font?: GeneralData
|
|
91
|
+
fontColor?: string
|
|
92
92
|
fontSize?: number
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -111,4 +111,4 @@ const styles = {
|
|
|
111
111
|
calendarText: 'calendarText',
|
|
112
112
|
circle: 'circle',
|
|
113
113
|
outlines: 'outlines'
|
|
114
|
-
}
|
|
114
|
+
}
|
package/src/test/parameters.json
CHANGED
|
@@ -1,98 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"parameters": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
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
|
|
3
|
+
"league": 9,
|
|
4
|
+
"matchesYesterday": false,
|
|
5
|
+
"matchesTomorrow": true
|
|
97
6
|
}
|
|
98
7
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
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,87 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
}
|