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