@vixoniccom/aniversarios 1.4.0 → 1.4.1-dev.1
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 +4 -0
- package/build/main.js +1 -1
- package/build.zip +0 -0
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/components/AnniversaryItem/components/AnniversaryDate/CircleDate/index.tsx +10 -6
- package/src/components/AnniversaryItem/components/AnniversaryDate/FlatDate/index.tsx +10 -6
- package/src/components/AnniversaryItem/components/AnniversaryDate/OutlineDate/index.tsx +10 -7
- package/src/components/AnniversaryItem/components/AnniversaryDate/TextCalendarDate/index.tsx +7 -3
- package/src/components/AnniversaryItem/components/AnniversaryDate/TextDate/index.tsx +4 -4
- package/src/components/AnniversaryItem/components/AnniversaryDate/index.tsx +18 -6
- package/src/components/AnniversaryItem/components/ClassicItem/index.tsx +38 -6
- package/src/components/AnniversaryItem/index.tsx +4 -3
- package/src/components/FontLoader/index.tsx +4 -3
- package/src/components/Render/index.tsx +13 -6
- package/test +0 -0
package/build.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -12,6 +12,6 @@ export const App: React.FunctionComponent<Props> = ({ start, appData, anniversar
|
|
|
12
12
|
if (!appData) return null
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<Render
|
|
15
|
+
<Render data={appData} start={start} anniversaries={anniversaries} />
|
|
16
16
|
)
|
|
17
17
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { AnniveraryDateUtils } from '../utils'
|
|
3
3
|
import { FormattedText } from '../../../../FormattedText'
|
|
4
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
|
-
day: number
|
|
7
|
-
month: number
|
|
8
|
-
|
|
7
|
+
day: number
|
|
8
|
+
month: number
|
|
9
|
+
orientation?: string
|
|
10
|
+
dateDayFormat: TextFormat.Value
|
|
11
|
+
dateMonthFormat: TextFormat.Value
|
|
12
|
+
datePrimaryColor: string
|
|
13
|
+
abbreviatedMonths: boolean
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
export const CircleDate: React.FunctionComponent<Props> = ({ day, month,
|
|
12
|
-
const { orientation, dateMonthFormat, datePrimaryColor, dateDayFormat } = data.parameters
|
|
16
|
+
export const CircleDate: React.FunctionComponent<Props> = ({ day, month, orientation, dateMonthFormat, datePrimaryColor, dateDayFormat, abbreviatedMonths }) => {
|
|
13
17
|
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
14
18
|
const daySize = (dateDayFormat?.fontSize || 100) * 400 / 100
|
|
15
19
|
const monthSize = (dateMonthFormat?.fontSize || 100) * 400 / 100
|
|
@@ -20,7 +24,7 @@ export const CircleDate: React.FunctionComponent<Props> = ({ day, month, data })
|
|
|
20
24
|
<circle fill={datePrimaryColor} cx='200' cy='200' r='200' />
|
|
21
25
|
<foreignObject width='400' height='400'>
|
|
22
26
|
<div style={{ height: 400, width: 400, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
23
|
-
<FormattedText text={AnniveraryDateUtils.getMonth(month,
|
|
27
|
+
<FormattedText text={AnniveraryDateUtils.getMonth(month, abbreviatedMonths)} format={{...dateMonthFormat, fontSize: monthSize}} unit='px' />
|
|
24
28
|
<FormattedText text={AnniveraryDateUtils.getZeroLeadedText(day)} format={{...dateDayFormat, fontSize: daySize}} unit='px' />
|
|
25
29
|
</div>
|
|
26
30
|
</foreignObject>
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
|
|
2
|
+
import { AnniveraryDateUtils } from "../utils"
|
|
3
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
|
-
month: number
|
|
6
6
|
day: number
|
|
7
|
-
|
|
7
|
+
month: number
|
|
8
|
+
orientation?: string
|
|
9
|
+
dateDayFormat: TextFormat.Value
|
|
10
|
+
dateMonthFormat: TextFormat.Value
|
|
11
|
+
datePrimaryColor: string
|
|
12
|
+
abbreviatedMonths: boolean
|
|
8
13
|
}
|
|
9
14
|
|
|
10
|
-
export const FlatDate: React.FunctionComponent<Props> = ({ month, day,
|
|
11
|
-
const { abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor } = data.parameters
|
|
15
|
+
export const FlatDate: React.FunctionComponent<Props> = ({ month, day, abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor }: Props) => {
|
|
12
16
|
|
|
13
17
|
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
14
|
-
const monthSize = ((dateMonthFormat?.fontSize ?? 18.5) * 400) / 100
|
|
15
18
|
const daySize = ((dateDayFormat?.fontSize ?? 57.5) * 400) / 100
|
|
19
|
+
const monthSize = ((dateMonthFormat?.fontSize ?? 18.5) * 400) / 100
|
|
16
20
|
|
|
17
21
|
const getFontFamily = (format: any) => {
|
|
18
22
|
if (format?.font?.filename) return format.font.filename.replace('.', '-')
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
|
|
2
|
+
import { FormattedText } from '../../../../FormattedText'
|
|
3
3
|
import { AnniveraryDateUtils } from '../utils'
|
|
4
|
-
|
|
4
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
day: number
|
|
8
8
|
month: number
|
|
9
|
-
|
|
9
|
+
orientation?: string
|
|
10
|
+
dateDayFormat: TextFormat.Value
|
|
11
|
+
dateMonthFormat: TextFormat.Value
|
|
12
|
+
datePrimaryColor: string
|
|
13
|
+
abbreviatedMonths: boolean
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
export const OutlineDate: React.FunctionComponent<Props> = ({ day, month,
|
|
13
|
-
const { abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor } = data.parameters
|
|
16
|
+
export const OutlineDate: React.FunctionComponent<Props> = ({ day, month, abbreviatedMonths, dateDayFormat, dateMonthFormat, orientation, datePrimaryColor }: Props) => {
|
|
14
17
|
const sizeProp = AnniveraryDateUtils.utils(orientation)
|
|
15
18
|
|
|
16
19
|
const parseFormat = (format: any, defaultSize: any) => {
|
|
@@ -20,8 +23,8 @@ export const OutlineDate: React.FunctionComponent<Props> = ({ day, month, data }
|
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
const [
|
|
24
|
-
const [
|
|
26
|
+
const [dayFormatState,] = useState(parseFormat(dateDayFormat, 20))
|
|
27
|
+
const [monthFormatState,] = useState(parseFormat(dateMonthFormat, 50))
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
30
|
<svg {...sizeProp} viewBox='0 0 100 100'>
|
package/src/components/AnniversaryItem/components/AnniversaryDate/TextCalendarDate/index.tsx
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { FormattedText } from '../../../../FormattedText'
|
|
3
3
|
import { AnniveraryDateUtils } from '../utils'
|
|
4
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
day: number
|
|
7
8
|
month: number
|
|
8
|
-
|
|
9
|
+
orientation?: string
|
|
10
|
+
dateDayFormat: TextFormat.Value
|
|
11
|
+
dateMonthFormat: TextFormat.Value
|
|
12
|
+
datePrimaryColor: string
|
|
13
|
+
abbreviatedMonths: boolean
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
export const TextCalendarDate: React.FunctionComponent<Props> = ({ day, month,
|
|
12
|
-
const { dateMonthFormat, dateDayFormat, abbreviatedMonths, orientation } = data.parameters
|
|
16
|
+
export const TextCalendarDate: React.FunctionComponent<Props> = ({ day, month, dateMonthFormat, dateDayFormat, abbreviatedMonths, orientation }: Props) => {
|
|
13
17
|
const sizeProp = AnniveraryDateUtils.utils(orientation, '100%')
|
|
14
18
|
|
|
15
19
|
const parseFormat = (format: any, defaultSize: any) => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { FormattedText } from '../../../../FormattedText'
|
|
3
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
day: number
|
|
6
7
|
month: number
|
|
7
|
-
|
|
8
|
+
dateDayFormat: TextFormat.Value
|
|
9
|
+
dateMonthFormat: TextFormat.Value
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
export const TextDate: React.FunctionComponent<Props> = ({ day, month,
|
|
11
|
-
const { dateMonthFormat, dateDayFormat } = data.parameters
|
|
12
|
-
|
|
12
|
+
export const TextDate: React.FunctionComponent<Props> = ({ day, month, dateDayFormat, dateMonthFormat }: Props) => {
|
|
13
13
|
return (
|
|
14
14
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
15
15
|
<FormattedText text={`${day}/`} format={dateDayFormat} />
|
|
@@ -3,6 +3,7 @@ import { FlatDate } from './FlatDate'
|
|
|
3
3
|
import { TextCalendarDate } from './TextCalendarDate'
|
|
4
4
|
import { TextDate } from './TextDate'
|
|
5
5
|
import { OutlineDate } from './OutlineDate'
|
|
6
|
+
import { TextFormat } from '@vixoniccom/modules'
|
|
6
7
|
|
|
7
8
|
const itemStyles = {
|
|
8
9
|
calendarFlat: FlatDate,
|
|
@@ -13,15 +14,26 @@ const itemStyles = {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
16
|
-
style: keyof typeof itemStyles
|
|
17
|
-
day: number
|
|
18
|
-
month: number
|
|
19
|
-
|
|
17
|
+
style: keyof typeof itemStyles
|
|
18
|
+
day: number
|
|
19
|
+
month: number
|
|
20
|
+
orientation?: string
|
|
21
|
+
dateDayFormat: TextFormat.Value
|
|
22
|
+
dateMonthFormat: TextFormat.Value
|
|
23
|
+
datePrimaryColor: string
|
|
24
|
+
abbreviatedMonths: boolean
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
export const AnniversaryDate = ({ style, day, month,
|
|
27
|
+
export const AnniversaryDate = ({ style, day, month, orientation, dateDayFormat, dateMonthFormat, datePrimaryColor, abbreviatedMonths }: Props) => {
|
|
23
28
|
const StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles[style] : itemStyles.text
|
|
24
29
|
return (
|
|
25
|
-
<StyledItem day={day}
|
|
30
|
+
<StyledItem day={day}
|
|
31
|
+
month={month}
|
|
32
|
+
orientation={orientation}
|
|
33
|
+
dateDayFormat={dateDayFormat}
|
|
34
|
+
dateMonthFormat={dateMonthFormat}
|
|
35
|
+
datePrimaryColor={datePrimaryColor}
|
|
36
|
+
abbreviatedMonths={abbreviatedMonths}
|
|
37
|
+
/>
|
|
26
38
|
)
|
|
27
39
|
}
|
|
@@ -2,17 +2,45 @@ import React, { useEffect, useRef, useState } from "react"
|
|
|
2
2
|
import { AnniversaryDate, AnniversaryImage, Separator } from '..'
|
|
3
3
|
import { FormattedText } from "../../../FormattedText"
|
|
4
4
|
import { getPhotoUrl, parseBorderMargin, parseParameters } from '../utils'
|
|
5
|
+
import { TextFormat } from "@vixoniccom/modules"
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
anniversary: Anniversary
|
|
8
|
-
|
|
9
|
+
parameters: VixonicParameters
|
|
10
|
+
downloadsPath: string
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
const dayFormatTemplate: TextFormat.Value = {
|
|
14
|
+
'font': {
|
|
15
|
+
id: '7953953c-7029-4730-ae4d-cff4abd5288f',
|
|
16
|
+
filename: '7953953c-7029-4730-ae4d-cff4abd5288f.ttf',
|
|
17
|
+
__isAsset: true
|
|
18
|
+
},
|
|
19
|
+
fontSize: 20,
|
|
20
|
+
alignment: {
|
|
21
|
+
horizontal: 'center'
|
|
22
|
+
},
|
|
23
|
+
fontColor: '#ffffff'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const monthFormatTemplate: TextFormat.Value = {
|
|
27
|
+
'font': {
|
|
28
|
+
id: '7953953c-7029-4730-ae4d-cff4abd5288f',
|
|
29
|
+
filename: '7953953c-7029-4730-ae4d-cff4abd5288f.ttf',
|
|
30
|
+
__isAsset: true
|
|
31
|
+
},
|
|
32
|
+
fontSize: 20,
|
|
33
|
+
alignment: {
|
|
34
|
+
horizontal: 'center'
|
|
35
|
+
},
|
|
36
|
+
fontColor: '#ffffff'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export const ClassicItem: React.FunctionComponent<Props> = ({ anniversary, parameters, downloadsPath }: Props) => {
|
|
12
41
|
let month = anniversary.month
|
|
13
42
|
const cont = useRef(null)
|
|
14
|
-
const {
|
|
15
|
-
const { orientation, separatorColor, separatorWidth, imageSize } = parameters
|
|
43
|
+
const { orientation, separatorColor, separatorWidth, imageSize, dateDayFormat, dateMonthFormat, datePrimaryColor, abbreviatedMonths } = parameters
|
|
16
44
|
const [margins, setMargins] = useState(parseBorderMargin(parameters.itemMargins))
|
|
17
45
|
const [state, setState] = useState({...parseParameters(parameters)})
|
|
18
46
|
|
|
@@ -49,7 +77,7 @@ export const ClassicItem: React.FunctionComponent<Props> = ({ anniversary, data
|
|
|
49
77
|
<AnniversaryImage
|
|
50
78
|
url={anniversary.image ? getPhotoUrl(anniversary.image, parameters, downloadsPath) : null}
|
|
51
79
|
orientation={orientation}
|
|
52
|
-
size={Number(imageSize) ||
|
|
80
|
+
size={Number(imageSize) || 20}
|
|
53
81
|
borderStyle={parameters.imageStyle}
|
|
54
82
|
/>
|
|
55
83
|
}
|
|
@@ -97,7 +125,11 @@ export const ClassicItem: React.FunctionComponent<Props> = ({ anniversary, data
|
|
|
97
125
|
style={parameters.dateStyle}
|
|
98
126
|
day={anniversary.day}
|
|
99
127
|
month={month}
|
|
100
|
-
|
|
128
|
+
orientation={orientation}
|
|
129
|
+
dateDayFormat={dateDayFormat || dayFormatTemplate}
|
|
130
|
+
dateMonthFormat={dateMonthFormat || monthFormatTemplate}
|
|
131
|
+
datePrimaryColor={datePrimaryColor || 'transparent'}
|
|
132
|
+
abbreviatedMonths={!!abbreviatedMonths}
|
|
101
133
|
/>
|
|
102
134
|
</div>
|
|
103
135
|
)}
|
|
@@ -7,11 +7,12 @@ const itemStyles = {
|
|
|
7
7
|
interface Props {
|
|
8
8
|
style: 'standard' | 'custom',
|
|
9
9
|
anniversary: Anniversary,
|
|
10
|
-
|
|
10
|
+
parameters: VixonicParameters,
|
|
11
|
+
downloadsPath: string
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export const AnniversaryItem = ({ style, anniversary,
|
|
14
|
+
export const AnniversaryItem = ({ style, anniversary, parameters, downloadsPath }: Props) => {
|
|
14
15
|
const StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles['standard'] : itemStyles.standard
|
|
15
16
|
|
|
16
|
-
return <StyledItem anniversary={anniversary}
|
|
17
|
+
return <StyledItem anniversary={anniversary} parameters={parameters} downloadsPath={downloadsPath} />
|
|
17
18
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
paths: Array<string>
|
|
3
|
-
|
|
3
|
+
parameters: VixonicParameters
|
|
4
|
+
downloadsPath: string
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
export const FontLoader = ({ paths,
|
|
7
|
-
const { parameters, downloadsPath } = data
|
|
7
|
+
export const FontLoader = ({ paths, parameters, downloadsPath }: Props) => {
|
|
8
8
|
|
|
9
9
|
const _getValueByPath = (path: string, obj: any): any => {
|
|
10
10
|
const pathsArray = path.split('.')
|
|
@@ -30,6 +30,7 @@ export const FontLoader = ({ paths, data }: Props) => {
|
|
|
30
30
|
}
|
|
31
31
|
`
|
|
32
32
|
} catch (err) {
|
|
33
|
+
console.error('Error loading font:', err)
|
|
33
34
|
return ''
|
|
34
35
|
}
|
|
35
36
|
})
|
|
@@ -4,14 +4,14 @@ import { AnniversaryItem } from '../AnniversaryItem'
|
|
|
4
4
|
import { ItemsContainer } from '../ItemsContainer'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
+
data: VixonicData
|
|
7
8
|
start: boolean
|
|
8
|
-
appData: VixonicData
|
|
9
9
|
anniversaries: Anniversary[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
export const Render = ({ start,
|
|
14
|
-
const { parameters, downloadsPath } =
|
|
13
|
+
export const Render = ({ start, data, anniversaries }: Props) => {
|
|
14
|
+
const { parameters, downloadsPath } = data
|
|
15
15
|
const { backgroundImage,
|
|
16
16
|
padding,
|
|
17
17
|
defaultMessage = 'Sin ingresos',
|
|
@@ -28,7 +28,14 @@ export const Render = ({ start, appData, anniversaries }: Props) => {
|
|
|
28
28
|
? `url("${downloadsPath}/${backgroundImage.filename}")` : ''
|
|
29
29
|
|
|
30
30
|
const anniversaryItems = anniversaries.map((anniversary: Anniversary) => {
|
|
31
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<AnniversaryItem
|
|
33
|
+
key={anniversary?.name}
|
|
34
|
+
style={'standard'}
|
|
35
|
+
anniversary={anniversary}
|
|
36
|
+
parameters={parameters}
|
|
37
|
+
downloadsPath={downloadsPath}
|
|
38
|
+
/>)
|
|
32
39
|
})
|
|
33
40
|
|
|
34
41
|
return (
|
|
@@ -42,7 +49,7 @@ export const Render = ({ start, appData, anniversaries }: Props) => {
|
|
|
42
49
|
backgroundSize: '100% 100%',
|
|
43
50
|
padding: padding
|
|
44
51
|
}}>
|
|
45
|
-
<FontLoader paths={['nameFormat.font', 'descriptionFormat.font', 'dateDayFormat.font', 'dateMonthFormat.font', 'optionalFormat.font']}
|
|
52
|
+
<FontLoader paths={['nameFormat.font', 'descriptionFormat.font', 'dateDayFormat.font', 'dateMonthFormat.font', 'optionalFormat.font']} parameters={parameters} downloadsPath={downloadsPath} />
|
|
46
53
|
{(anniversaries.length > 0) ?
|
|
47
54
|
<ItemsContainer
|
|
48
55
|
items={anniversaryItems}
|
|
@@ -64,7 +71,7 @@ export const Render = ({ start, appData, anniversaries }: Props) => {
|
|
|
64
71
|
justifyContent: 'center',
|
|
65
72
|
alignItems: 'center'
|
|
66
73
|
}}>
|
|
67
|
-
<FormattedText text={defaultMessage.trim()} format={parameters.defaultMessageFormat} />
|
|
74
|
+
<FormattedText text={defaultMessage.trim() || "No existen aniversarios"} format={parameters.defaultMessageFormat} />
|
|
68
75
|
</div>
|
|
69
76
|
}
|
|
70
77
|
</div >
|
package/test
DELETED
|
File without changes
|