@vixoniccom/footbal-score 1.0.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 +5 -0
- package/README.md +92 -0
- package/build.zip +0 -0
- package/configuration.json +110 -0
- package/icon.png +0 -0
- package/package.json +39 -0
- package/src/App.tsx +94 -0
- package/src/components/FontLoader.tsx +58 -0
- package/src/components/FormattedText.tsx +86 -0
- package/src/components/table-fixture/Results.tsx +21 -0
- package/src/components/table-fixture/Row.tsx +58 -0
- package/src/components/table-fixture/Table.tsx +27 -0
- package/src/components/table-fixture/TeamItems.tsx +34 -0
- package/src/components/table-fixture/Time.tsx +24 -0
- package/src/contex/configureContext/ConfigureContext.tsx +9 -0
- package/src/contex/configureContext/ConfigureProvider.tsx +81 -0
- package/src/contex/configureContext/configureReducer.ts +53 -0
- package/src/helpers/getEmployees.ts +21 -0
- package/src/helpers/getFixture.ts +20 -0
- package/src/helpers/parseMonthAndDay.ts +38 -0
- package/src/helpers/setToken.ts +71 -0
- package/src/helpers/utils.ts +52 -0
- package/src/hooks/useFetch.ts +47 -0
- package/src/index.html +11 -0
- package/src/main.tsx +40 -0
- package/src/model/income.ts +129 -0
- package/src/parameters.d.ts +101 -0
- package/src/soccer_field.png +0 -0
- package/src/sprite.svg +1 -0
- package/src/style.css +677 -0
- package/src/test/downloads/4a9bcc4e-f398-4317-9f0f-afa8bcef1a4f.png +0 -0
- package/src/test/downloads/7953953c-7029-4730-ae4d-cff4abd5288f.ttf +0 -0
- package/src/test/downloads/Roboto-Bold.ttf +0 -0
- package/src/test/downloads/Spring in May.ttf +0 -0
- package/src/test/downloads/c705a739-312e-4334-9231-e73a05e9d382.ttf +0 -0
- package/src/test/downloads/cumples.png +0 -0
- package/src/test/downloads/d1093778-f3c9-42c8-9b07-9f8736390aeb/Foto prueba.jpg +0 -0
- package/src/test/downloads/d1093778-f3c9-42c8-9b07-9f8736390aeb/foto1.jpg +0 -0
- package/src/test/downloads/d1093778-f3c9-42c8-9b07-9f8736390aeb.zip +0 -0
- package/src/test/downloads/fondopasto.jpg +0 -0
- package/src/test/parameters.json +93 -0
- package/tsconfig.json +38 -0
- package/tslint.json +6 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useReducer } from "react";
|
|
2
|
+
import { ConfigureContext } from './ConfigureContext';
|
|
3
|
+
import { parameterReducer } from "./configureReducer";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const INITIAL_STATE: VixonicData = {
|
|
8
|
+
downloadsPath: '',
|
|
9
|
+
parameters: {
|
|
10
|
+
abbreviatedMonths: false,
|
|
11
|
+
animationMode: "",
|
|
12
|
+
animationOrder: false,
|
|
13
|
+
animationSpeed: 1.5,
|
|
14
|
+
animationTime: "",
|
|
15
|
+
backgroundImage: { id: "", filename: "", _isAsset: true },
|
|
16
|
+
apiDomain: "",
|
|
17
|
+
containerColumns: "",
|
|
18
|
+
statusFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
19
|
+
containerColumnsGap: "",
|
|
20
|
+
containerRows: "",
|
|
21
|
+
containerRowsGap: "",
|
|
22
|
+
dataMode: "",
|
|
23
|
+
title0: 'App Mundial',
|
|
24
|
+
titleEnabled: false,
|
|
25
|
+
titleFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
|
|
26
|
+
goalsFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
|
|
27
|
+
timeFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
|
|
28
|
+
dateAlignment: "center",
|
|
29
|
+
dateDayFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
|
|
30
|
+
dateEnabled: true,
|
|
31
|
+
dateMonthFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 20, alignment: { horizontal: "center" }, fontColor: "" },
|
|
32
|
+
datePosition: 1,
|
|
33
|
+
datePrimaryColor: "",
|
|
34
|
+
dateStyle: "circle",
|
|
35
|
+
descriptionEnabled: true,
|
|
36
|
+
descriptionFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
37
|
+
excludePast: false,
|
|
38
|
+
imageAlignment: "center",
|
|
39
|
+
imageEnabled: true,
|
|
40
|
+
imagePosition: 0,
|
|
41
|
+
imageStyle: "normal",
|
|
42
|
+
imageSize: 50,
|
|
43
|
+
itemMargins: "",
|
|
44
|
+
msj0: "No hay partidos hoy",
|
|
45
|
+
nameFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
46
|
+
orientation: "",
|
|
47
|
+
padding: "",
|
|
48
|
+
photosMode: "",
|
|
49
|
+
photosZip: { id: "0fb559ec-5da3-4b2d-95c4-d9623754c841", filename: "0fb559ec-5da3-4b2d-95c4-d9623754c841.zip", extension: "zip", _isAsset: true },
|
|
50
|
+
template: "",
|
|
51
|
+
textAlignment: "center",
|
|
52
|
+
textPosition: 0,
|
|
53
|
+
updateTime: 0,
|
|
54
|
+
urlBaseApi: "",
|
|
55
|
+
imageMargin: "",
|
|
56
|
+
textMargin: "",
|
|
57
|
+
dateMargin: "",
|
|
58
|
+
separator: false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface props {
|
|
63
|
+
children: JSX.Element | JSX.Element[]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const ParameterProvider = ({ children }: props) => {
|
|
67
|
+
|
|
68
|
+
const [configureState, dispatch] = useReducer(parameterReducer, INITIAL_STATE)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const addConfiguration = (configure: VixonicData) => {
|
|
72
|
+
dispatch({ type: "addConfigure", payload: configure })
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<ConfigureContext.Provider value={{ configureState, addConfiguration }}>
|
|
77
|
+
{children}
|
|
78
|
+
</ConfigureContext.Provider>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
type ConfigureAction =
|
|
3
|
+
| { type: 'addConfigure', payload: VixonicData }
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const parameterReducer = (state: VixonicData, action: ConfigureAction) => {
|
|
7
|
+
|
|
8
|
+
const { downloadsPath, parameters } = action.payload
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case 'addConfigure':
|
|
11
|
+
console.log(parameters)
|
|
12
|
+
return {
|
|
13
|
+
downloadsPath: downloadsPath,
|
|
14
|
+
parameters: {
|
|
15
|
+
backgroundImage: parameters.backgroundImage,
|
|
16
|
+
descriptionEnabled: parameters.descriptionEnabled,
|
|
17
|
+
descriptionFormat: parameters.descriptionFormat,
|
|
18
|
+
imageAlignment: parameters.imageAlignment,
|
|
19
|
+
imageEnabled: parameters.imageEnabled,
|
|
20
|
+
imagePosition: parameters.imagePosition,
|
|
21
|
+
imageSize: parameters.imageSize,
|
|
22
|
+
imageStyle: parameters.imageStyle,
|
|
23
|
+
itemMargins: parameters.itemMargins,
|
|
24
|
+
msj0: parameters.msj0,
|
|
25
|
+
nameFormat: parameters.nameFormat,
|
|
26
|
+
orientation: parameters.orientation,
|
|
27
|
+
padding: parameters.padding,
|
|
28
|
+
photosMode: parameters.photosMode,
|
|
29
|
+
photosZip: parameters.photosZip,
|
|
30
|
+
template: parameters.template,
|
|
31
|
+
textAlignment: parameters.textAlignment,
|
|
32
|
+
textPosition: parameters.textPosition,
|
|
33
|
+
updateTime: parameters.updateTime,
|
|
34
|
+
urlBaseApi: parameters.urlBaseApi,
|
|
35
|
+
imageMargin: parameters.imageMargin,
|
|
36
|
+
textMargin: parameters.textMargin,
|
|
37
|
+
dateMargin: parameters.dateMargin,
|
|
38
|
+
separator: parameters.separator,
|
|
39
|
+
descriptionMaxChar: parameters.descriptionMaxChar,
|
|
40
|
+
nameMaxChar: parameters.nameMaxChar,
|
|
41
|
+
timeFormat: parameters.timeFormat,
|
|
42
|
+
goalsFormat: parameters.goalsFormat,
|
|
43
|
+
title0: parameters.title0,
|
|
44
|
+
titleEnabled: parameters.titleEnabled,
|
|
45
|
+
titleFormat: parameters.titleFormat,
|
|
46
|
+
statusFormat: parameters.statusFormat,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
return state;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
const API_KEY = 'AIzaSyDQcTlxfd5IyjbeSJooRtNt6OF04DLykqc'
|
|
3
|
+
import { getMonth } from "./utils";
|
|
4
|
+
|
|
5
|
+
export default function getEmployees(apiDomain: string) {
|
|
6
|
+
let idGoogle = apiDomain.split("/")[5]
|
|
7
|
+
console.log(idGoogle)
|
|
8
|
+
let URL = `https://sheets.googleapis.com/v4/spreadsheets/${idGoogle}/values`
|
|
9
|
+
const monthTab = getMonth()
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const response = axios({
|
|
13
|
+
url: `${URL}/${monthTab}?key=${API_KEY}`
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error(error);
|
|
18
|
+
return error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// import moment from 'moment';
|
|
2
|
+
const axios = require("axios");
|
|
3
|
+
|
|
4
|
+
export const getFixture = async () => {
|
|
5
|
+
|
|
6
|
+
// const today = moment().format('YYYY-MM-DD')
|
|
7
|
+
// console.log("🚀 ~ file: getFixture.ts ~ line 6 ~ getFixture ~ today", today)
|
|
8
|
+
|
|
9
|
+
const options = {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
|
|
12
|
+
params: { date: '2022-11-21', league: '1', season: '2022' },
|
|
13
|
+
headers: {
|
|
14
|
+
'X-RapidAPI-Key': 'a7e693d4c5msh72a2ff2020fd601p12dd08jsn0f168421d7bb',
|
|
15
|
+
'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const response = await axios.request(options)
|
|
19
|
+
return response.data.response
|
|
20
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import moment from "moment"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const getAnniversaryFromMonth = (apiData: any, month: any) => {
|
|
5
|
+
let monthArray = []
|
|
6
|
+
for (let i = 0; i < apiData.length; i++) {
|
|
7
|
+
let monthA = Number(moment(apiData[i].fechaInic, 'YYYY-MM-DD').format('M')) - 1
|
|
8
|
+
if (monthA === month) {
|
|
9
|
+
let dayA = Number(moment(apiData[i].fechaInic, 'YYYY-MM-DD').format('D'))
|
|
10
|
+
apiData[i].day = dayA
|
|
11
|
+
apiData[i].month = month
|
|
12
|
+
apiData[i].name = `${apiData[i].nombre} ${apiData[i].apellidoPate}`
|
|
13
|
+
apiData[i].position = apiData[i].nombreCargo
|
|
14
|
+
apiData[i].image = apiData[i].foto
|
|
15
|
+
monthArray.push(apiData[i])
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
monthArray.sort((a, b) => {
|
|
19
|
+
if (a.day < b.day) return -1
|
|
20
|
+
else if (a.day === b.day) return 0
|
|
21
|
+
else return 1
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
return monthArray
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const parseFromApi = (apiData: any) => {
|
|
29
|
+
let monthsArray = []
|
|
30
|
+
for (let month = 0; month < 12; month++) {
|
|
31
|
+
let monthArray = getAnniversaryFromMonth(apiData, month)
|
|
32
|
+
if (monthArray.length > 0) monthsArray.push(...monthArray)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
return monthsArray
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import localforage from 'localforage'
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
|
|
4
|
+
const urlCF = 'https://us-central1-vixoniccloudcom.cloudfunctions.net/rexTokenCentralizer'
|
|
5
|
+
const tokenCF = 'd2dca806-4f70-41a3-ab70-0fe9bf051d2e'
|
|
6
|
+
let updateTimer: any
|
|
7
|
+
|
|
8
|
+
function setUpdateTime(milliseconds: any, requestData: any) {
|
|
9
|
+
clearTimeout(updateTimer)
|
|
10
|
+
if (milliseconds === null) return
|
|
11
|
+
updateTimer = setTimeout(requestData, milliseconds)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getToken(apiDomain: any) {
|
|
15
|
+
try {
|
|
16
|
+
const config = { 'Authorization': tokenCF }
|
|
17
|
+
const response = axios({
|
|
18
|
+
method: 'post',
|
|
19
|
+
url: urlCF,
|
|
20
|
+
headers: config,
|
|
21
|
+
data: {
|
|
22
|
+
orgDomain: apiDomain // This is the body part
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
console.log(response)
|
|
27
|
+
return response
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error(error);
|
|
30
|
+
return error
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function setTokenLocal(token: any, apiDomain: any) {
|
|
35
|
+
localforage.config({ name: `request_${apiDomain}` })
|
|
36
|
+
localforage.setItem('rexmas', {
|
|
37
|
+
token: token,
|
|
38
|
+
apiDomain: apiDomain,
|
|
39
|
+
date: Date.now()
|
|
40
|
+
}, (err) => { if (err) console.log(err) })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export default function setToken(apiDomain: any, requestData: any) {
|
|
47
|
+
let pt: any = getToken(apiDomain)
|
|
48
|
+
pt.then(function (response: any) {
|
|
49
|
+
console.log('rr...', response)
|
|
50
|
+
let token = response.data.token
|
|
51
|
+
if (token === '') {
|
|
52
|
+
console.log(response.data.msg)
|
|
53
|
+
// renderLog(response.data.msg)
|
|
54
|
+
setUpdateTime(null, requestData)
|
|
55
|
+
} else {
|
|
56
|
+
console.log('Access granted to Rex+ API')
|
|
57
|
+
setTokenLocal(token, apiDomain)
|
|
58
|
+
setUpdateTime(2000, requestData)
|
|
59
|
+
}
|
|
60
|
+
return
|
|
61
|
+
})
|
|
62
|
+
.catch(function (error: any) {
|
|
63
|
+
console.log(error);
|
|
64
|
+
console.log(`Error getting token ${error.response.data && error.response.data.detalle}`)
|
|
65
|
+
// setUpdateTime(null)
|
|
66
|
+
return
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import moment from "moment";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const getMonth = () => {
|
|
6
|
+
const date = moment()
|
|
7
|
+
let numberMonth: number = Number(date.format('M'))
|
|
8
|
+
let month
|
|
9
|
+
switch (numberMonth) {
|
|
10
|
+
case 1:
|
|
11
|
+
month = 'Enero'
|
|
12
|
+
break
|
|
13
|
+
case 2:
|
|
14
|
+
month = 'Febrero'
|
|
15
|
+
break
|
|
16
|
+
case 3:
|
|
17
|
+
month = 'Marzo'
|
|
18
|
+
break
|
|
19
|
+
case 4:
|
|
20
|
+
month = 'Abril'
|
|
21
|
+
break
|
|
22
|
+
case 5:
|
|
23
|
+
month = 'Mayo'
|
|
24
|
+
break
|
|
25
|
+
case 6:
|
|
26
|
+
month = 'Junio'
|
|
27
|
+
break
|
|
28
|
+
case 7:
|
|
29
|
+
month = 'Julio'
|
|
30
|
+
break
|
|
31
|
+
case 8:
|
|
32
|
+
month = 'Agosto'
|
|
33
|
+
break
|
|
34
|
+
case 9:
|
|
35
|
+
month = 'Septiembre'
|
|
36
|
+
break
|
|
37
|
+
case 10:
|
|
38
|
+
month = 'Octubre'
|
|
39
|
+
break
|
|
40
|
+
case 11:
|
|
41
|
+
month = 'Noviembre'
|
|
42
|
+
break
|
|
43
|
+
case 12:
|
|
44
|
+
month = 'Diciembre'
|
|
45
|
+
break
|
|
46
|
+
default:
|
|
47
|
+
month = 'ENERO'
|
|
48
|
+
break
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return month
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react"
|
|
2
|
+
|
|
3
|
+
type State = {
|
|
4
|
+
data: string | null
|
|
5
|
+
loading: boolean,
|
|
6
|
+
error: boolean | null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const useFetch = (url: string): State => {
|
|
11
|
+
|
|
12
|
+
const isMounted = useRef(true);
|
|
13
|
+
const [state, setState] = useState<State>({ data: null, loading: true, error: null })
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
return () => {
|
|
17
|
+
isMounted.current = false;
|
|
18
|
+
}
|
|
19
|
+
}, [])
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
|
|
24
|
+
setState({ data: null, loading: true, error: null });
|
|
25
|
+
|
|
26
|
+
fetch(url, {
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Token`
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
.then(resp => resp.json())
|
|
32
|
+
.then(data => {
|
|
33
|
+
|
|
34
|
+
if (isMounted.current) {
|
|
35
|
+
setState({
|
|
36
|
+
loading: false,
|
|
37
|
+
error: null,
|
|
38
|
+
data
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
}, [url])
|
|
45
|
+
|
|
46
|
+
return state;
|
|
47
|
+
}
|
package/src/index.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html style="position: absolute; height:100%; width: 100%; overflow: hidden;">
|
|
3
|
+
<head>
|
|
4
|
+
<title></title>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
</head>
|
|
7
|
+
<body style="margin:0; overflow: hidden;">
|
|
8
|
+
<div id="root" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden;">
|
|
9
|
+
</div>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import ReactDOM from 'react-dom'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
const { ipcRenderer } = require('electron')
|
|
4
|
+
import { App } from './App';
|
|
5
|
+
import { ParameterProvider } from './contex/configureContext/ConfigureProvider';
|
|
6
|
+
let start: boolean = false
|
|
7
|
+
|
|
8
|
+
ipcRenderer.on('preload', (_event: any, data: VixonicData) => {
|
|
9
|
+
render(data)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
ipcRenderer.on('start', (_event: any, data: VixonicData) => {
|
|
13
|
+
start = true
|
|
14
|
+
// initialize(data)
|
|
15
|
+
render(data)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
ipcRenderer.on('update', (_event: any, data: VixonicData) => {
|
|
19
|
+
render(data)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
ipcRenderer.on('finish', (_event: any) => {
|
|
23
|
+
console.log('finish')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
function render(data: VixonicData) {
|
|
28
|
+
ReactDOM.render(
|
|
29
|
+
<ParameterProvider>
|
|
30
|
+
<App data={data} start={start} />
|
|
31
|
+
</ParameterProvider>
|
|
32
|
+
, document.getElementById('root'))
|
|
33
|
+
// ReactDOM.render(React.createElement(App,{data, start}), document.getElementById('root'))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// import moment from "moment"
|
|
2
|
+
// import _ from 'lodash'
|
|
3
|
+
|
|
4
|
+
// /**
|
|
5
|
+
// * @class Birthdays
|
|
6
|
+
// */
|
|
7
|
+
// class Income {
|
|
8
|
+
|
|
9
|
+
// public _data: any
|
|
10
|
+
// public day: any
|
|
11
|
+
|
|
12
|
+
// constructor() {
|
|
13
|
+
// /** @type {Birthday[][] | undefined} */
|
|
14
|
+
// this._data = undefined
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// /**
|
|
18
|
+
// * @type {Birthday[][]}
|
|
19
|
+
// */
|
|
20
|
+
// get data() {
|
|
21
|
+
// return this._data
|
|
22
|
+
// }
|
|
23
|
+
|
|
24
|
+
// /**
|
|
25
|
+
// * @typedef BirthdaysUpdateOptions
|
|
26
|
+
// * @property {Birthday[][]} data
|
|
27
|
+
// * @property {Birthday[][]} api
|
|
28
|
+
// */
|
|
29
|
+
// /**
|
|
30
|
+
// * @param {BirthdaysUpdateOptions} options
|
|
31
|
+
// * @param {*} callback
|
|
32
|
+
// */
|
|
33
|
+
|
|
34
|
+
// update(options : any) {
|
|
35
|
+
|
|
36
|
+
// if (options.data) {
|
|
37
|
+
// this._data = options.data
|
|
38
|
+
// } else if (options.api) {
|
|
39
|
+
// this._data = this.parseFromApi(options.api)
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
|
|
43
|
+
// getAnniversaryFromMonth(apiData:any, month:any) {
|
|
44
|
+
// let monthArray = []
|
|
45
|
+
// for (let i = 0; i < apiData.length; i++) {
|
|
46
|
+
// let monthA = Number(moment(apiData[i].fechaInic, 'YYYY-MM-DD').format('M')) - 1
|
|
47
|
+
// if (monthA === month) {
|
|
48
|
+
// let dayA = Number(moment(apiData[i].fechaInic, 'YYYY-MM-DD').format('D'))
|
|
49
|
+
// let income = new Ingress({
|
|
50
|
+
// day: dayA,
|
|
51
|
+
// month: month,
|
|
52
|
+
// name: `${apiData[i].nombre} ${apiData[i].apellidoPate}`,
|
|
53
|
+
// description: undefined,
|
|
54
|
+
// image: apiData[i].foto
|
|
55
|
+
// })
|
|
56
|
+
// monthArray.push(income)
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// monthArray.sort((a, b) => {
|
|
61
|
+
// if (a.day < b.day) return -1
|
|
62
|
+
// else if (a.day === b.day) return 0
|
|
63
|
+
// else return 1
|
|
64
|
+
// })
|
|
65
|
+
// return monthArray
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
// parseFromApi(apiData:any) {
|
|
69
|
+
// let monthsArray = []
|
|
70
|
+
// for (let month = 0; month < 12; month++) {
|
|
71
|
+
// let monthArray = this.getAnniversaryFromMonth(apiData, month)
|
|
72
|
+
// monthsArray.push(monthArray)
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
// return monthsArray
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
// /**
|
|
79
|
+
// * @param {string} mode
|
|
80
|
+
// * @param {boolean} excludePast
|
|
81
|
+
// */
|
|
82
|
+
// getList(mode :any, excludePast:any) {
|
|
83
|
+
|
|
84
|
+
// if (!mode) mode = 'monthly'
|
|
85
|
+
// let dd = moment()
|
|
86
|
+
// let month = Number(dd.format('M'))
|
|
87
|
+
// let today = Number(dd.format('D'))
|
|
88
|
+
|
|
89
|
+
// /**
|
|
90
|
+
// * Filter method
|
|
91
|
+
// * @param {Anniversary[]} data
|
|
92
|
+
// * @inner
|
|
93
|
+
// */
|
|
94
|
+
// let filter = (data:any) => {
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// const filterMonthDay = excludePast ? data.filter((da:any )=> da.month >= (month - 1)).filter((da:any) => da.day >= today) : data
|
|
98
|
+
|
|
99
|
+
// return filterMonthDay
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
// return filter(_.flatten(this._data))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// }
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
// class Ingress {
|
|
111
|
+
|
|
112
|
+
// public day
|
|
113
|
+
// public month
|
|
114
|
+
// public name
|
|
115
|
+
// public description
|
|
116
|
+
// public image
|
|
117
|
+
|
|
118
|
+
// constructor(options:any) {
|
|
119
|
+
|
|
120
|
+
// this.day = options.day
|
|
121
|
+
// this.month = options.month
|
|
122
|
+
// this.name = options.name
|
|
123
|
+
// this.description = options.description
|
|
124
|
+
// this.image = options.image
|
|
125
|
+
// }
|
|
126
|
+
|
|
127
|
+
// }
|
|
128
|
+
|
|
129
|
+
// module.exports = exports = Animation
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
declare type VixonicData = {
|
|
4
|
+
parameters: VixonicParameters,
|
|
5
|
+
services?: { [key: string]: { data?: any, updatedAt?: number } }
|
|
6
|
+
downloadsPath: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
declare type VixonicParameters = Partial<{
|
|
11
|
+
abbreviatedMonths: boolean
|
|
12
|
+
animationMode: string
|
|
13
|
+
animationOrder: boolean
|
|
14
|
+
animationSpeed: number
|
|
15
|
+
animationTime: string
|
|
16
|
+
animationStagger:number
|
|
17
|
+
apiDomain: string
|
|
18
|
+
backgroundImage: GeneralData
|
|
19
|
+
containerColumns: string
|
|
20
|
+
containerRows: string
|
|
21
|
+
containerRowsGap: string
|
|
22
|
+
containerColumnsGap: string
|
|
23
|
+
dataMode: string
|
|
24
|
+
dateAlignment: keyof typeof alignment
|
|
25
|
+
dateDayFormat: DateFormat
|
|
26
|
+
timeFormat: DateFormat
|
|
27
|
+
goalsFormat: DateFormat
|
|
28
|
+
dateEnabled: boolean
|
|
29
|
+
title0: string
|
|
30
|
+
titleEnabled: boolean
|
|
31
|
+
titleFormat: DateFormat
|
|
32
|
+
dateMonthFormat: DateFormat
|
|
33
|
+
datePosition: number
|
|
34
|
+
datePrimaryColor: string
|
|
35
|
+
dateStyle: keyof typeof styles
|
|
36
|
+
descriptionEnabled: boolean
|
|
37
|
+
descriptionFormat: DateFormat
|
|
38
|
+
excludePast: boolean
|
|
39
|
+
imageAlignment: keyof typeof alignment
|
|
40
|
+
imageEnabled: boolean
|
|
41
|
+
imagePosition: number
|
|
42
|
+
imageStyle: keyof typeof borderStyles,
|
|
43
|
+
imageSize: number
|
|
44
|
+
itemMargins: string
|
|
45
|
+
msj0: string
|
|
46
|
+
nameFormat: DateFormat
|
|
47
|
+
orientation: string
|
|
48
|
+
padding: string
|
|
49
|
+
photosMode: string
|
|
50
|
+
photosZip: GeneralData
|
|
51
|
+
template: string
|
|
52
|
+
textAlignment: keyof typeof alignment
|
|
53
|
+
textPosition: number
|
|
54
|
+
updateTime: number
|
|
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
|
+
}>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
type GeneralData = {
|
|
69
|
+
filename?: string
|
|
70
|
+
id?: string,
|
|
71
|
+
extension?: string,
|
|
72
|
+
_isAsset: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type DateFormat = {
|
|
76
|
+
alignment?: { horizontal?: 'left' | 'right' | 'center' },
|
|
77
|
+
font?: GeneralData,
|
|
78
|
+
fontColor?: string,
|
|
79
|
+
fontSize?: number
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const alignment = {
|
|
83
|
+
start: 'flex-start',
|
|
84
|
+
center: 'center',
|
|
85
|
+
end: 'flex-end'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const borderStyles = {
|
|
90
|
+
normal: '0',
|
|
91
|
+
rounded: '10',
|
|
92
|
+
circle: '100'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const styles = {
|
|
96
|
+
text: 'text',
|
|
97
|
+
calendarFlat: 'calendarFlat',
|
|
98
|
+
calendarText: 'calendarText',
|
|
99
|
+
circle: 'circle',
|
|
100
|
+
outlines: 'outlines'
|
|
101
|
+
}
|
|
Binary file
|