@vixoniccom/aniversarios 1.2.1 → 1.2.3-dev.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 +28 -8
- package/build.zip +0 -0
- package/configuration.json +35 -6
- package/package.json +7 -9
- package/src/App.tsx +59 -73
- package/src/components/AnniversaryItem/components/AnniversaryDate/CircleDate/index.tsx +31 -0
- package/src/components/AnniversaryItem/components/AnniversaryDate/FlatDate/index.tsx +47 -0
- package/src/components/{anniversary-item/shared/anniversary-date/outline/OutlineDate.tsx → AnniversaryItem/components/AnniversaryDate/OutlineDate/index.tsx} +7 -25
- package/src/components/{anniversary-item/shared/anniversary-date/text-calendar/TextCalendarDate.tsx → AnniversaryItem/components/AnniversaryDate/TextCalendarDate/index.tsx} +7 -16
- package/src/components/{anniversary-item/shared/anniversary-date/text/TextDate.tsx → AnniversaryItem/components/AnniversaryDate/TextDate/index.tsx} +2 -12
- package/src/components/{anniversary-item/shared/anniversary-date/AnniversaryDate.tsx → AnniversaryItem/components/AnniversaryDate/index.tsx} +7 -11
- package/src/components/AnniversaryItem/components/AnniversaryDate/utils.ts +18 -0
- package/src/components/{anniversary-item/shared/AnniversaryImage.tsx → AnniversaryItem/components/AnniversaryImage/index.tsx} +11 -19
- package/src/components/AnniversaryItem/components/ClassicItem/index.tsx +109 -0
- package/src/components/{anniversary-item/shared/separator → AnniversaryItem/components/Separator}/Separator.tsx +3 -6
- package/src/components/AnniversaryItem/components/index.ts +11 -0
- package/src/components/AnniversaryItem/components/utils.ts +75 -0
- package/src/components/AnniversaryItem/index.tsx +17 -0
- package/src/components/{FontLoader.tsx → FontLoader/index.tsx} +11 -12
- package/src/components/FormattedText/index.tsx +81 -0
- package/src/components/{items-container → ItemsContainer/components}/Item.tsx +2 -10
- package/src/components/ItemsContainer/components/animation.ts +130 -0
- package/src/components/{items-container/ItemsContainer.tsx → ItemsContainer/index.tsx} +54 -61
- package/src/components/{Render.tsx → Render/index.tsx} +9 -11
- package/src/components/index.ts +13 -0
- package/src/context/configureContext/ConfigureContext.tsx +8 -0
- package/src/context/configureContext/ConfigureProvider.tsx +72 -0
- package/src/context/configureContext/configureReducer.ts +62 -0
- package/src/context/dataContext/DataContex.tsx +8 -0
- package/src/context/dataContext/DataProvider.tsx +25 -0
- package/src/context/dataContext/dataReducer.ts +12 -0
- package/src/helpers/filterEmployees.ts +31 -37
- package/src/helpers/getEmployees.ts +18 -22
- package/src/helpers/utils.ts +44 -50
- package/src/main.ts +0 -0
- package/src/main.tsx +2 -2
- package/src/test/parameters.json +97 -97
- package/tsconfig.json +4 -4
- package/src/components/FormattedText.tsx +0 -81
- package/src/components/anniversary-item/AnniversaryItem.tsx +0 -22
- package/src/components/anniversary-item/clasic/ClasicItem.tsx +0 -220
- package/src/components/anniversary-item/shared/anniversary-date/DateUtils.ts +0 -33
- package/src/components/anniversary-item/shared/anniversary-date/circle/CircleDate.tsx +0 -39
- package/src/components/anniversary-item/shared/anniversary-date/flat/FlatDate.tsx +0 -79
- package/src/components/anniversary-item/shared/utils.ts +0 -10
- package/src/components/items-container/animation.ts +0 -125
- package/src/contex/configureContext/ConfigureContext.tsx +0 -8
- package/src/contex/configureContext/ConfigureProvider.tsx +0 -77
- package/src/contex/configureContext/configureReducer.ts +0 -67
- package/src/contex/dataContext/DataContex.tsx +0 -8
- package/src/contex/dataContext/DataProvider.tsx +0 -31
- package/src/contex/dataContext/dataReducer.ts +0 -19
- package/src/helpers/parseMonthAndDay.ts +0 -38
- package/src/helpers/setToken.ts +0 -69
- package/src/hooks/useFetch.ts +0 -47
- package/src/model/income.ts +0 -129
- /package/src/components/{anniversary-item/shared → AnniversaryItem/components}/default-profile.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,24 +2,45 @@
|
|
|
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.
|
|
5
|
+
### [1.2.3-dev.0](https://github.com/Vixonic/store-aniversarios/compare/v1.2.2...v1.2.3-dev.0) (2025-07-04)
|
|
6
|
+
|
|
7
|
+
### [1.2.2](https://github.com/Vixonic/store-aniversarios/compare/v1.2.1...v1.2.2) (2025-05-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* code refactored ([c2ea956](https://github.com/Vixonic/store-aniversarios/commit/c2ea956088a70c3dd2d7704ea1610dec74200d69))
|
|
13
|
+
* createItems now works properly ([33a4534](https://github.com/Vixonic/store-aniversarios/commit/33a45343b78f09f870ee36e746838fefb0552185))
|
|
14
|
+
* show partial pages re-enabled ([6a4e4c2](https://github.com/Vixonic/store-aniversarios/commit/6a4e4c2092e77678f5c82f780f713935de0eb43b))
|
|
15
|
+
|
|
16
|
+
### [1.2.1-dev.1](https://github.com/Vixonic/store-aniversarios/compare/v1.2.1-dev.0...v1.2.1-dev.1) (2025-05-05)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* show partial pages re-enabled ([2fa3e85](https://github.com/Vixonic/store-aniversarios/commit/2fa3e853200edad4b8a90da526497761fcb51fa1))
|
|
22
|
+
|
|
23
|
+
### [1.2.1-dev.0](https://github.com/Vixonic/store-aniversarios/compare/v1.2.0...v1.2.1-dev.0) (2025-05-02)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
- code refactored ([41cf858](https://github.com/Vixonic/store-aniversarios/commit/41cf85868e516175ee55640434247c5f70d5d579))
|
|
28
|
+
- createItems now works properly ([db2623a](https://github.com/Vixonic/store-aniversarios/commit/db2623ab1156ca93bd5386598dd1c1dc486a46ff))
|
|
6
29
|
|
|
7
30
|
## [1.2.0](https://github.com/Vixonic/store-aniversarios/compare/v1.2.0-dev.1...v1.2.0) (2025-02-27)
|
|
8
31
|
|
|
9
32
|
## [1.2.0-dev.1](https://bitbucket.org/vixonic_dev/aniversarios/compare/v1.2.0-dev.0...v1.2.0-dev.1) (2025-02-13)
|
|
10
33
|
|
|
11
|
-
|
|
12
34
|
### Bug Fixes
|
|
13
35
|
|
|
14
|
-
|
|
36
|
+
- change RedirectButton id ([b23c294](https://bitbucket.org/vixonic_dev/aniversarios/commit/b23c29432519b4f9c552cb3642257b3e57b99471))
|
|
15
37
|
|
|
16
38
|
## [1.2.0-dev.0](https://bitbucket.org/vixonic_dev/aniversarios/compare/v1.0.2...v1.2.0-dev.0) (2025-02-13)
|
|
17
39
|
|
|
18
|
-
|
|
19
40
|
### Features
|
|
20
41
|
|
|
21
|
-
|
|
22
|
-
|
|
42
|
+
- add RedirectButton ([7a63b6d](https://bitbucket.org/vixonic_dev/aniversarios/commit/7a63b6dc525643ce909b69c0e1dc3a1ca33cce57))
|
|
43
|
+
- ISC license was added to the project ([053ba36](https://bitbucket.org/vixonic_dev/aniversarios/commit/053ba36195a038099cf3ca2b62258ef80e5d6e97))
|
|
23
44
|
|
|
24
45
|
## [1.1.0](https://bitbucket.org/vixonic_dev/aniversarios/compare/v1.1.0-beta.1...v1.1.0) (2024-10-01)
|
|
25
46
|
|
|
@@ -27,10 +48,9 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
27
48
|
|
|
28
49
|
## [1.1.0-beta.0](https://bitbucket.org/vixonic_dev/aniversarios/compare/v1.0.2...v1.1.0-beta.0) (2024-09-04)
|
|
29
50
|
|
|
30
|
-
|
|
31
51
|
### Features
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
- ISC license was added to the project ([6996ea4](https://bitbucket.org/vixonic_dev/aniversarios/commit/6996ea4514daab0a1f70df791131e1e65e0f94ef))
|
|
34
54
|
|
|
35
55
|
### [1.0.2](https://bitbucket.org/rexmas_cl/aniversarios/compare/v1.0.2-beta.3...v1.0.2) (2023-08-30)
|
|
36
56
|
|
package/build.zip
CHANGED
|
Binary file
|
package/configuration.json
CHANGED
|
@@ -23,15 +23,40 @@
|
|
|
23
23
|
"label": "Configuración",
|
|
24
24
|
"description": "",
|
|
25
25
|
"items": [
|
|
26
|
-
{
|
|
27
|
-
"id": "apiDomain",
|
|
28
|
-
"type": "text-input",
|
|
29
|
-
"required": true,
|
|
30
|
-
"label": "Link google sheets"
|
|
31
|
-
},
|
|
32
26
|
{
|
|
33
27
|
"type": "label",
|
|
34
28
|
"label": "Datos"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "displayService",
|
|
32
|
+
"label": "Selecciona la fuente de los cumpleaños",
|
|
33
|
+
"type": "select-input",
|
|
34
|
+
"description": "Selecciona la fuente de los cumpleaños. Por defecto, Documento.",
|
|
35
|
+
"items": [
|
|
36
|
+
{
|
|
37
|
+
"label": "Documento",
|
|
38
|
+
"value": "AnniversaryAppService"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"label": "Rexmas",
|
|
42
|
+
"value": "RexmasAnniversarieService"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"defaultValue": "BirthdayAppService"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "documentService",
|
|
49
|
+
"label": "Documento",
|
|
50
|
+
"show": "{{displayService}} === \"BirthdayAppService\"",
|
|
51
|
+
"type": "service-input",
|
|
52
|
+
"serviceType": "BirthdayAppService"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "rexmasService",
|
|
56
|
+
"label": "Rexmas",
|
|
57
|
+
"show": "{{displayService}} === \"RexmasAnniversarieService\"",
|
|
58
|
+
"type": "service-input",
|
|
59
|
+
"serviceType": "RexmasAnniversarieService"
|
|
35
60
|
},
|
|
36
61
|
{
|
|
37
62
|
"type": "select-input",
|
|
@@ -63,6 +88,10 @@
|
|
|
63
88
|
"label": "Actualización",
|
|
64
89
|
"defaultValue": 600000,
|
|
65
90
|
"items": [
|
|
91
|
+
{
|
|
92
|
+
"label": "1 minuto",
|
|
93
|
+
"value": 60000
|
|
94
|
+
},
|
|
66
95
|
{
|
|
67
96
|
"label": "10 minutos",
|
|
68
97
|
"value": 600000
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixoniccom/aniversarios",
|
|
3
3
|
"alias": "Aniversarios",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.3-dev.0",
|
|
5
5
|
"description": "Muestra el día que el trabajador está de aniversario en la empresa.",
|
|
6
6
|
"main": "main.js",
|
|
7
7
|
"author": "",
|
|
@@ -19,22 +19,20 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"animejs": "^3.2.2",
|
|
21
21
|
"axios": "^1.6.0",
|
|
22
|
-
"jquery": "^3.6.0",
|
|
23
22
|
"localforage": "^1.10.0",
|
|
24
23
|
"moment": "^2.29.4",
|
|
25
24
|
"prop-types": "^15.8.1",
|
|
26
|
-
"react": "^
|
|
27
|
-
"react-dom": "^
|
|
25
|
+
"react": "^18.3.1",
|
|
26
|
+
"react-dom": "^18.3.1",
|
|
28
27
|
"use-state-with-callback": "^3.0.2"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/animejs": "^3.1.13",
|
|
32
31
|
"@types/lodash": "^4.17.0",
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/react": "^
|
|
35
|
-
"@
|
|
36
|
-
"@vixoniccom/
|
|
37
|
-
"@vixoniccom/modules": "^2.20.0-dev.1",
|
|
32
|
+
"@types/react": "^18.3.23",
|
|
33
|
+
"@types/react-dom": "^18.3.7",
|
|
34
|
+
"@vixoniccom/module-packager": "2.12.0-dev.10",
|
|
35
|
+
"@vixoniccom/modules": "^2.20.3-dev.0",
|
|
38
36
|
"standard-version": "^9.5.0"
|
|
39
37
|
}
|
|
40
38
|
}
|
package/src/App.tsx
CHANGED
|
@@ -1,97 +1,89 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useState } from "react"
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import localforage from "localforage";
|
|
1
|
+
import React, { useContext, useEffect, useState } from "react"
|
|
2
|
+
import { FormattedText, Render } from './components'
|
|
3
|
+
import { ConfigureContext } from "./context/configureContext/ConfigureContext"
|
|
4
|
+
import { DataContext } from "./context/dataContext/DataContex"
|
|
5
|
+
import { getEmployees, getEmployeesYearly } from "./helpers/getEmployees"
|
|
6
|
+
import { filterEmployees } from "./helpers/filterEmployees"
|
|
7
|
+
import moment from "moment"
|
|
8
|
+
import { getMonth } from "./helpers/utils"
|
|
9
|
+
import localforage from "localforage"
|
|
11
10
|
|
|
12
11
|
type Props = {
|
|
13
|
-
data: VixonicData
|
|
14
|
-
start: boolean
|
|
15
|
-
}
|
|
12
|
+
data: VixonicData
|
|
13
|
+
start: boolean
|
|
14
|
+
}
|
|
16
15
|
|
|
17
|
-
type Msj =
|
|
18
|
-
| 'Ningún ingreso que mostrar'
|
|
16
|
+
type Msj = 'Ningún ingreso que mostrar'
|
|
19
17
|
| 'Cargando Empleados...'
|
|
20
18
|
| 'Missing google sheets'
|
|
21
19
|
| ""
|
|
22
|
-
| 'Invalid URL'
|
|
20
|
+
| 'Invalid URL'
|
|
23
21
|
|
|
24
|
-
export const App = ({ data, start }
|
|
25
|
-
const { addConfiguration, configureState } = useContext(ConfigureContext)
|
|
26
|
-
const { addEmployee } = useContext(DataContext)
|
|
22
|
+
export const App: React.FunctionComponent<Props> = ({ data, start }) => {
|
|
23
|
+
const { addConfiguration, configureState } = useContext(ConfigureContext)
|
|
24
|
+
const { addEmployee } = useContext(DataContext)
|
|
27
25
|
const [dataState, setDataState] = useState(data)
|
|
28
|
-
const [msj, setMsj] = useState<Msj>("")
|
|
29
|
-
const { apiDomain, dataMode, excludePast } = configureState.parameters
|
|
30
|
-
let updateTimer
|
|
26
|
+
const [msj, setMsj] = useState<Msj>("")
|
|
27
|
+
const { apiDomain, dataMode, excludePast } = configureState.parameters
|
|
28
|
+
let updateTimer: any
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
useEffect(()=> {
|
|
34
|
-
if(apiDomain){
|
|
35
|
-
localforage.config({
|
|
36
|
-
name: `url_request_${apiDomain}`
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
},[apiDomain])
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
addConfiguration(data);
|
|
43
|
-
setDataState(configureState);
|
|
44
|
-
}, [data]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const setUpdateTime =(updatedTime: number) => {
|
|
30
|
+
const setUpdateTime = (updatedTime: number) => {
|
|
48
31
|
clearTimeout(updateTimer)
|
|
49
32
|
updateTimer = setTimeout(getData, updatedTime)
|
|
50
33
|
}
|
|
51
34
|
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (apiDomain) localforage.config({ name: `url_request_${apiDomain}` })
|
|
37
|
+
}, [apiDomain])
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
addConfiguration(data)
|
|
41
|
+
setDataState(configureState)
|
|
42
|
+
}, [data])
|
|
43
|
+
|
|
52
44
|
useEffect(() => {
|
|
53
45
|
const { updateTime } = configureState.parameters
|
|
54
46
|
|
|
55
47
|
if (apiDomain && dataMode) {
|
|
56
|
-
localforage.getItem<{ items: any[], date: number, mode: string }>('anniversary-docs').then((data) => {
|
|
57
|
-
if(!data || dataMode !== data.mode
|
|
48
|
+
localforage.getItem<{ items: any[], date: number, mode: string }>('anniversary-docs').then((data) => {
|
|
49
|
+
if (!data || dataMode !== data.mode) {
|
|
58
50
|
getData()
|
|
59
51
|
setUpdateTime(updateTime!)
|
|
60
|
-
return
|
|
52
|
+
return
|
|
61
53
|
}
|
|
62
|
-
|
|
54
|
+
|
|
63
55
|
const now = Date.now()
|
|
64
56
|
const targetDate = data?.date! + updateTime!
|
|
65
57
|
|
|
66
|
-
if(now >= targetDate){
|
|
58
|
+
if (now >= targetDate) {
|
|
67
59
|
getData()
|
|
68
60
|
setUpdateTime(updateTime!)
|
|
69
|
-
}else {
|
|
61
|
+
} else {
|
|
70
62
|
data && addEmployee(data.items)
|
|
71
|
-
setMsj("")
|
|
72
|
-
setUpdateTime(targetDate-now)
|
|
63
|
+
setMsj("")
|
|
64
|
+
setUpdateTime(targetDate - now)
|
|
73
65
|
}
|
|
74
66
|
})
|
|
75
67
|
}
|
|
76
|
-
if (!apiDomain) setMsj("Missing google sheets")
|
|
77
|
-
}, [dataState])
|
|
68
|
+
if (!apiDomain) setMsj("Missing google sheets")
|
|
69
|
+
}, [dataState])
|
|
78
70
|
|
|
79
71
|
const getData = async () => {
|
|
80
|
-
const urlValid = "https://docs.google.com/spreadsheets/d/"
|
|
72
|
+
const urlValid = "https://docs.google.com/spreadsheets/d/"
|
|
81
73
|
let contractEmployees: any
|
|
82
74
|
let employee: any = []
|
|
83
75
|
try {
|
|
84
|
-
if (apiDomain
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
if (apiDomain?.includes(urlValid)) {
|
|
77
|
+
const month = Number(moment().format("M")) - 1
|
|
78
|
+
const nextMonth = (month === 11) ? 0 : (month + 1)
|
|
79
|
+
const monthTab = getMonth(month)
|
|
80
|
+
const nextMonthTab = getMonth(nextMonth)
|
|
89
81
|
if (dataMode !== 'yearly') {
|
|
90
|
-
contractEmployees = await getEmployees(apiDomain,
|
|
82
|
+
contractEmployees = await getEmployees(apiDomain, monthTab)
|
|
91
83
|
const { values } = contractEmployees.data
|
|
92
84
|
employee.push(...filterEmployees(values, dataMode, excludePast, month))
|
|
93
|
-
if(
|
|
94
|
-
contractEmployees = await getEmployees(apiDomain,
|
|
85
|
+
if (dataMode === 'weekly') {
|
|
86
|
+
contractEmployees = await getEmployees(apiDomain, nextMonthTab)
|
|
95
87
|
const { values: valuesnextMonth } = contractEmployees.data
|
|
96
88
|
employee.push(...filterEmployees(valuesnextMonth, dataMode, excludePast, nextMonth))
|
|
97
89
|
}
|
|
@@ -100,40 +92,34 @@ export const App = ({ data, start }: Props) => {
|
|
|
100
92
|
if (dataMode === 'yearly') {
|
|
101
93
|
setMsj('Cargando Empleados...')
|
|
102
94
|
for (let numberMonth: number = 0; numberMonth <= 11; numberMonth++) {
|
|
103
|
-
contractEmployees = await getEmployeesYearly(apiDomain, numberMonth)
|
|
95
|
+
contractEmployees = await getEmployeesYearly(apiDomain, numberMonth)
|
|
104
96
|
const { values } = contractEmployees.data
|
|
105
97
|
employee.push(...filterEmployees(values, dataMode, excludePast, numberMonth))
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
100
|
|
|
109
101
|
if (contractEmployees) {
|
|
110
|
-
addEmployee(employee)
|
|
111
|
-
setMsj("")
|
|
102
|
+
addEmployee(employee)
|
|
103
|
+
setMsj("")
|
|
112
104
|
localforage.setItem('anniversary-docs', {
|
|
113
105
|
items: employee,
|
|
114
106
|
date: Date.now() + updateTimer,
|
|
115
107
|
mode: dataMode
|
|
116
108
|
})
|
|
117
109
|
} else {
|
|
118
|
-
setMsj("Ningún ingreso que mostrar")
|
|
110
|
+
setMsj("Ningún ingreso que mostrar")
|
|
119
111
|
}
|
|
120
112
|
} else {
|
|
121
|
-
setMsj("Invalid URL")
|
|
113
|
+
setMsj("Invalid URL")
|
|
122
114
|
}
|
|
123
115
|
} catch (error) {
|
|
124
|
-
console.log(error)
|
|
116
|
+
console.log(error)
|
|
125
117
|
}
|
|
126
|
-
}
|
|
118
|
+
}
|
|
127
119
|
|
|
128
120
|
return msj !== "" ? (
|
|
129
|
-
<FormattedText
|
|
130
|
-
text={msj}
|
|
131
|
-
format={
|
|
132
|
-
configureState.parameters.nameFormat ||
|
|
133
|
-
configureState.parameters.descriptionFormat
|
|
134
|
-
}
|
|
135
|
-
/>
|
|
121
|
+
<FormattedText text={msj} format={configureState.parameters.nameFormat || configureState.parameters.descriptionFormat} />
|
|
136
122
|
) : (
|
|
137
123
|
<Render start={start} />
|
|
138
|
-
)
|
|
139
|
-
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
import { AnniveraryDateUtils } from '../utils'
|
|
3
|
+
import { FormattedText } from '../../../../FormattedText'
|
|
4
|
+
import { ConfigureContext } from '../../../../../context/configureContext/ConfigureContext'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
day: number,
|
|
8
|
+
month: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const CircleDate: React.FunctionComponent<Props> = ({ day, month }) => {
|
|
12
|
+
const { configureState } = useContext(ConfigureContext)
|
|
13
|
+
const { orientation, dateMonthFormat, datePrimaryColor, dateDayFormat } = configureState.parameters
|
|
14
|
+
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
15
|
+
const daySize = (dateDayFormat?.fontSize || 100) * 400 / 100
|
|
16
|
+
const monthSize = (dateMonthFormat?.fontSize || 100) * 400 / 100
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<svg {...sizeProp} viewBox='0 0 400 400' xmlSpace='preserve'>
|
|
20
|
+
<g>
|
|
21
|
+
<circle fill={datePrimaryColor} cx='200' cy='200' r='200' />
|
|
22
|
+
<foreignObject width='400' height='400'>
|
|
23
|
+
<div style={{ height: 400, width: 400, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
24
|
+
<FormattedText text={AnniveraryDateUtils.getMonth(month, true)} format={Object.assign({}, dateMonthFormat, { fontSize: monthSize })} unit='px' />
|
|
25
|
+
<FormattedText text={AnniveraryDateUtils.getZeroLeadedText(day)} format={Object.assign({}, dateDayFormat, { fontSize: daySize })} unit='px' />
|
|
26
|
+
</div>
|
|
27
|
+
</foreignObject>
|
|
28
|
+
</g>
|
|
29
|
+
</svg>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useContext } from "react"
|
|
2
|
+
import { ConfigureContext } from "../../../../../context/configureContext/ConfigureContext"
|
|
3
|
+
import { AnniveraryDateUtils } from "../utils"
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
month: number
|
|
7
|
+
day: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const FlatDate: React.FunctionComponent<Props> = ({ month, day }: Props) => {
|
|
11
|
+
const { configureState } = useContext(ConfigureContext)
|
|
12
|
+
const { abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor } = configureState.parameters
|
|
13
|
+
|
|
14
|
+
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
15
|
+
const monthSize = ((dateMonthFormat?.fontSize || 18.5) * 400) / 100
|
|
16
|
+
const daySize = ((dateDayFormat?.fontSize || 57.5) * 400) / 100
|
|
17
|
+
|
|
18
|
+
const getFontFamily = (format: any) => {
|
|
19
|
+
if (format?.font?.filename) return format.font.filename.replace('.', '-')
|
|
20
|
+
return ''
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<svg {...sizeProp} viewBox='0 0 400 400' xmlSpace='preserve'>
|
|
25
|
+
<g>
|
|
26
|
+
<path fill={datePrimaryColor} d='M349.5,393.5h-299c-24.3,0-44-19.7-44-44v-299c0-24.3,19.7-44,44-44h299c24.3,0,44,19.7,44,44v299C393.5,373.8,373.8,393.5,349.5,393.5z' />
|
|
27
|
+
<path fill='#FFFFFF' d='M349.5,389.5h-299c-22,0-40-18-40-40v-299c0-22,18-40,40-40h299c22,0,40,18,40,40v299C389.5,371.5,371.5,389.5,349.5,389.5z' />
|
|
28
|
+
<path fill={datePrimaryColor} d='M9,99.9V50.5c0-22.2,18.1-40.3,40.3-40.3h301.4c22.2,0,40.3,18.1,40.3,40.3v49.4H9z' />
|
|
29
|
+
<text fontFamily={`"${getFontFamily(dateMonthFormat)}"`}
|
|
30
|
+
textAnchor='middle'
|
|
31
|
+
alignmentBaseline='central' x='200' y='55'
|
|
32
|
+
fontSize={monthSize} preserveAspectRatio='none'
|
|
33
|
+
fill={dateMonthFormat?.fontColor || '#fff'} fontSizeAdjust=''>
|
|
34
|
+
{AnniveraryDateUtils.getMonth(month, abbreviatedMonths)}
|
|
35
|
+
</text>
|
|
36
|
+
|
|
37
|
+
<text fontFamily={`"${getFontFamily(dateDayFormat)}"`}
|
|
38
|
+
textAnchor='middle'
|
|
39
|
+
alignmentBaseline='central' x='200' y='245'
|
|
40
|
+
fontSize={daySize} preserveAspectRatio='none'
|
|
41
|
+
fill={dateDayFormat?.fontColor || '#fff'} fontSizeAdjust=''>
|
|
42
|
+
{AnniveraryDateUtils.getZeroLeadedText(day)}
|
|
43
|
+
</text>
|
|
44
|
+
</g>
|
|
45
|
+
</svg>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useContext,
|
|
2
|
-
import { ConfigureContext } from '../../../../../
|
|
1
|
+
import React, { useContext, useState } from 'react'
|
|
2
|
+
import { ConfigureContext } from '../../../../../context/configureContext/ConfigureContext'
|
|
3
3
|
import { FormattedText } from '../../../../FormattedText'
|
|
4
|
-
import {
|
|
4
|
+
import { AnniveraryDateUtils } from '../utils'
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
@@ -9,15 +9,10 @@ interface Props {
|
|
|
9
9
|
month: number
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const OutlineDate = ({ day, month }: Props) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export const OutlineDate: React.FunctionComponent<Props> = ({ day, month }: Props) => {
|
|
16
13
|
const { configureState } = useContext(ConfigureContext)
|
|
17
14
|
const { abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor } = configureState.parameters
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const sizeProp = AnniveraryDateUtil.utils(orientation)
|
|
15
|
+
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
21
16
|
|
|
22
17
|
const parseFormat = (format: any, defaultSize: any) => {
|
|
23
18
|
return Object.assign(
|
|
@@ -27,21 +22,15 @@ export const OutlineDate = ({ day, month }: Props) => {
|
|
|
27
22
|
)
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [])
|
|
34
|
-
|
|
35
25
|
const [monthFormatState,] = useState(parseFormat(dateMonthFormat, 20))
|
|
36
26
|
const [dayFormatState,] = useState(parseFormat(dateDayFormat, 50))
|
|
37
27
|
|
|
38
|
-
|
|
39
28
|
return (
|
|
40
29
|
<svg {...sizeProp} viewBox='0 0 100 100'>
|
|
41
30
|
<foreignObject x='20' y='35' width='60' height='50'>
|
|
42
31
|
<div style={{ display: 'flex', alignItems: 'center', flexDirection: 'column', justifyContent: 'center', height: '100%' }}>
|
|
43
|
-
<FormattedText text={
|
|
44
|
-
<FormattedText text={
|
|
32
|
+
<FormattedText text={AnniveraryDateUtils.getMonth(month, abbreviatedMonths)} format={monthFormatState} unit='px' />
|
|
33
|
+
<FormattedText text={AnniveraryDateUtils.getZeroLeadedText(day)} format={dayFormatState} unit='px' />
|
|
45
34
|
</div>
|
|
46
35
|
</foreignObject>
|
|
47
36
|
<svg viewBox='0 0 300 300'>
|
|
@@ -51,10 +40,3 @@ export const OutlineDate = ({ day, month }: Props) => {
|
|
|
51
40
|
</svg>
|
|
52
41
|
)
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
OutlineDate.defaultProps = {
|
|
57
|
-
primaryColor: '#5B5959'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
OutlineDate.propTypes = AnniveraryDateUtil.commonPropTypes()
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import React, { useContext, useState } from 'react'
|
|
2
|
-
import { ConfigureContext } from '../../../../../
|
|
2
|
+
import { ConfigureContext } from '../../../../../context/configureContext/ConfigureContext'
|
|
3
3
|
import { FormattedText } from '../../../../FormattedText'
|
|
4
|
-
import {
|
|
4
|
+
import { AnniveraryDateUtils } from '../utils'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
day: number
|
|
8
8
|
month: number
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const TextCalendarDate = ({ day, month }: Props) => {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const TextCalendarDate: React.FunctionComponent<Props> = ({ day, month }: Props) => {
|
|
14
12
|
const { configureState } = useContext(ConfigureContext)
|
|
15
|
-
const { dateMonthFormat, dateDayFormat, abbreviatedMonths,orientation
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const sizeProp = AnniveraryDateUtil.utils(orientation, '100%')
|
|
19
|
-
|
|
13
|
+
const { dateMonthFormat, dateDayFormat, abbreviatedMonths, orientation } = configureState.parameters
|
|
14
|
+
const sizeProp = AnniveraryDateUtils.utils(orientation, '100%')
|
|
20
15
|
|
|
21
16
|
const parseFormat = (format: any, defaultSize: any) => {
|
|
22
17
|
return Object.assign(
|
|
@@ -33,14 +28,10 @@ export const TextCalendarDate = ({ day, month }: Props) => {
|
|
|
33
28
|
<svg {...sizeProp} viewBox='0 0 100 100'>
|
|
34
29
|
<foreignObject width='100' height='100'>
|
|
35
30
|
<div style={{ display: 'flex', alignItems: 'center', flexDirection: 'column', justifyContent: 'center', height: '100%' }}>
|
|
36
|
-
<FormattedText text={
|
|
37
|
-
<FormattedText text={
|
|
31
|
+
<FormattedText text={AnniveraryDateUtils.getMonth(month, abbreviatedMonths)} format={monthFormatState} unit='px' />
|
|
32
|
+
<FormattedText text={AnniveraryDateUtils.getZeroLeadedText(day)} format={dayFormatState} unit='px' />
|
|
38
33
|
</div>
|
|
39
34
|
</foreignObject>
|
|
40
35
|
</svg>
|
|
41
36
|
)
|
|
42
37
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
TextCalendarDate.propTypes = AnniveraryDateUtil.commonPropTypes()
|
|
46
|
-
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { useContext } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
2
|
import { FormattedText } from '../../../../FormattedText'
|
|
4
|
-
import { ConfigureContext } from '../../../../../
|
|
3
|
+
import { ConfigureContext } from '../../../../../context/configureContext/ConfigureContext'
|
|
5
4
|
|
|
6
5
|
interface Props {
|
|
7
6
|
day: number
|
|
8
7
|
month: number
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export const TextDate = ({ day, month }: Props) => {
|
|
12
|
-
|
|
10
|
+
export const TextDate: React.FunctionComponent<Props> = ({ day, month }: Props) => {
|
|
13
11
|
const { configureState } = useContext(ConfigureContext)
|
|
14
12
|
const { dateMonthFormat, dateDayFormat } = configureState.parameters
|
|
15
13
|
|
|
@@ -20,11 +18,3 @@ export const TextDate = ({ day, month }: Props) => {
|
|
|
20
18
|
</div>
|
|
21
19
|
)
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
TextDate.propTypes = {
|
|
25
|
-
day: PropTypes.number.isRequired,
|
|
26
|
-
dayFormat: PropTypes.object,
|
|
27
|
-
month: PropTypes.number.isRequired,
|
|
28
|
-
monthFormat: PropTypes.object
|
|
29
|
-
}
|
|
30
|
-
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { CircleDate } from './
|
|
3
|
-
import { FlatDate } from './
|
|
4
|
-
import { TextCalendarDate } from './
|
|
5
|
-
import { TextDate } from './
|
|
6
|
-
import { OutlineDate } from './
|
|
2
|
+
import { CircleDate } from './CircleDate'
|
|
3
|
+
import { FlatDate } from './FlatDate'
|
|
4
|
+
import { TextCalendarDate } from './TextCalendarDate'
|
|
5
|
+
import { TextDate } from './TextDate'
|
|
6
|
+
import { OutlineDate } from './OutlineDate'
|
|
7
7
|
|
|
8
8
|
const itemStyles = {
|
|
9
9
|
calendarFlat: FlatDate,
|
|
@@ -28,12 +28,8 @@ interface Props {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const AnniversaryDate = ({ style, day, month }: Props) => {
|
|
31
|
-
|
|
32
|
-
let StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles[style] : itemStyles.text
|
|
31
|
+
const StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles[style] : itemStyles.text
|
|
33
32
|
return (
|
|
34
|
-
<StyledItem
|
|
35
|
-
day={day}
|
|
36
|
-
month={month} />
|
|
33
|
+
<StyledItem day={day} month={month} />
|
|
37
34
|
)
|
|
38
35
|
}
|
|
39
|
-
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { utils } from '../utils'
|
|
2
|
+
|
|
3
|
+
const Months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']
|
|
4
|
+
|
|
5
|
+
export class AnniveraryDateUtils {
|
|
6
|
+
static getZeroLeadedText(text: any) {
|
|
7
|
+
return `0${text}`.slice(-2)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static getMonth(index: any, abbreviated: any) {
|
|
11
|
+
if (!abbreviated) return Months[index]
|
|
12
|
+
return Months[index].substring(0, 3).toUpperCase()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static utils(orientation: any, size: any = undefined) {
|
|
16
|
+
return utils(orientation, size)
|
|
17
|
+
}
|
|
18
|
+
}
|