@vixoniccom/aniversarios 1.2.1-dev.1 → 1.2.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 +1 -14
- package/build.zip +0 -0
- package/configuration.json +0 -4
- package/package.json +4 -3
- package/src/App.tsx +73 -59
- package/src/components/{FontLoader/index.tsx → FontLoader.tsx} +12 -11
- package/src/components/FormattedText.tsx +81 -0
- package/src/components/{Render/index.tsx → Render.tsx} +11 -9
- package/src/components/anniversary-item/AnniversaryItem.tsx +22 -0
- package/src/components/anniversary-item/clasic/ClasicItem.tsx +220 -0
- package/src/components/{AnniversaryItem/components/AnniversaryImage/index.tsx → anniversary-item/shared/AnniversaryImage.tsx} +19 -11
- package/src/components/{AnniversaryItem/components/AnniversaryDate/index.tsx → anniversary-item/shared/anniversary-date/AnniversaryDate.tsx} +11 -7
- package/src/components/anniversary-item/shared/anniversary-date/DateUtils.ts +33 -0
- package/src/components/anniversary-item/shared/anniversary-date/circle/CircleDate.tsx +39 -0
- package/src/components/anniversary-item/shared/anniversary-date/flat/FlatDate.tsx +79 -0
- package/src/components/{AnniversaryItem/components/AnniversaryDate/OutlineDate/index.tsx → anniversary-item/shared/anniversary-date/outline/OutlineDate.tsx} +25 -7
- package/src/components/{AnniversaryItem/components/AnniversaryDate/TextDate/index.tsx → anniversary-item/shared/anniversary-date/text/TextDate.tsx} +12 -2
- package/src/components/{AnniversaryItem/components/AnniversaryDate/TextCalendarDate/index.tsx → anniversary-item/shared/anniversary-date/text-calendar/TextCalendarDate.tsx} +16 -7
- package/src/components/{AnniversaryItem/components/Separator → anniversary-item/shared/separator}/Separator.tsx +6 -3
- package/src/components/anniversary-item/shared/utils.ts +10 -0
- package/src/components/{ItemsContainer/components → items-container}/Item.tsx +10 -2
- package/src/components/{ItemsContainer/index.tsx → items-container/ItemsContainer.tsx} +61 -54
- package/src/components/items-container/animation.ts +125 -0
- package/src/contex/configureContext/ConfigureContext.tsx +8 -0
- package/src/contex/configureContext/ConfigureProvider.tsx +77 -0
- package/src/contex/configureContext/configureReducer.ts +67 -0
- package/src/contex/dataContext/DataContex.tsx +8 -0
- package/src/contex/dataContext/DataProvider.tsx +31 -0
- package/src/contex/dataContext/dataReducer.ts +19 -0
- package/src/helpers/filterEmployees.ts +37 -31
- package/src/helpers/getEmployees.ts +22 -18
- package/src/helpers/parseMonthAndDay.ts +38 -0
- package/src/helpers/setToken.ts +69 -0
- package/src/helpers/utils.ts +50 -44
- package/src/hooks/useFetch.ts +47 -0
- package/src/main.tsx +2 -2
- package/src/model/income.ts +129 -0
- package/src/test/parameters.json +97 -97
- package/src/components/AnniversaryItem/components/AnniversaryDate/CircleDate/index.tsx +0 -31
- package/src/components/AnniversaryItem/components/AnniversaryDate/FlatDate/index.tsx +0 -47
- package/src/components/AnniversaryItem/components/AnniversaryDate/utils.ts +0 -18
- package/src/components/AnniversaryItem/components/ClassicItem/index.tsx +0 -109
- package/src/components/AnniversaryItem/components/index.ts +0 -11
- package/src/components/AnniversaryItem/components/utils.ts +0 -75
- package/src/components/AnniversaryItem/index.tsx +0 -17
- package/src/components/FormattedText/index.tsx +0 -81
- package/src/components/ItemsContainer/components/animation.ts +0 -130
- package/src/components/index.ts +0 -13
- package/src/context/configureContext/ConfigureContext.tsx +0 -8
- package/src/context/configureContext/ConfigureProvider.tsx +0 -72
- package/src/context/configureContext/configureReducer.ts +0 -62
- package/src/context/dataContext/DataContex.tsx +0 -8
- package/src/context/dataContext/DataProvider.tsx +0 -25
- package/src/context/dataContext/dataReducer.ts +0 -12
- /package/src/components/{AnniversaryItem/components → anniversary-item/shared}/default-profile.png +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export const utils = (orientation: string, size: number) => {
|
|
2
|
-
const sizeAttr = orientation === 'v' ? 'width' : 'height'
|
|
3
|
-
const percentage = size ? `${size}` : orientation === 'v' ? '40%' : '80%'
|
|
4
|
-
return { [sizeAttr]: percentage }
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const parseBorderMargin = (marginString: any) => {
|
|
8
|
-
const pattern = /(( )?[+-]?[0-9]+.?([0-9]+)?(px|em|ex|%|in|cm|mm|pt|pc))?/g
|
|
9
|
-
const match = marginString ? marginString.match(pattern) : ['']
|
|
10
|
-
|
|
11
|
-
switch (match.length) {
|
|
12
|
-
case 1:
|
|
13
|
-
return { r: '4%', l: '4%' }
|
|
14
|
-
case 2:
|
|
15
|
-
return { r: match[0], l: match[0] }
|
|
16
|
-
default:
|
|
17
|
-
return { r: match[0], l: match[1] }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const parseElementStyles = (margin: string, position: number, defaultPosition: number, parameters: VixonicParameters) => {
|
|
22
|
-
const { orientation, separator } = parameters
|
|
23
|
-
const marginAttr = orientation === 'v' ? 'marginBottom' : 'marginRight'
|
|
24
|
-
const sizeAttr = orientation === 'v' ? 'width' : 'height'
|
|
25
|
-
const pos = position !== undefined ? position : defaultPosition
|
|
26
|
-
return {
|
|
27
|
-
order: pos,
|
|
28
|
-
[sizeAttr]: '100%',
|
|
29
|
-
[marginAttr]: margin !== undefined && margin !== '' ? `${margin}%` : pos === 3 || separator === true ? 0 : '4%',
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const parseParameters = (parameters: any) => {
|
|
34
|
-
const imageAlignment = parameters.imageAlignment || 'center'
|
|
35
|
-
const textAlignment = parameters.textAlignment || 'center'
|
|
36
|
-
const dateAlignment = parameters.dateAlignment || 'center'
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
imageEnabled: parameters.imageEnabled,
|
|
40
|
-
imageStyle: Object.assign(
|
|
41
|
-
{
|
|
42
|
-
flexShrink: 0,
|
|
43
|
-
display: 'flex',
|
|
44
|
-
justifyContent: imageAlignment,
|
|
45
|
-
alignItems: imageAlignment,
|
|
46
|
-
},
|
|
47
|
-
parseElementStyles(parameters.imageMargin, parameters.imagePosition, 1, parameters)
|
|
48
|
-
),
|
|
49
|
-
descriptionEnabled: parameters.descriptionEnabled,
|
|
50
|
-
optionalEnabled: parameters.optionalEnabled,
|
|
51
|
-
textStyle: Object.assign(
|
|
52
|
-
{ display: 'flex', flexDirection: 'column', justifyContent: textAlignment, flex: 1 },
|
|
53
|
-
parseElementStyles(parameters.textMargin, parameters.textPosition, 2, parameters)
|
|
54
|
-
),
|
|
55
|
-
dateEnabled: parameters.dateEnabled,
|
|
56
|
-
dateStyle: Object.assign(
|
|
57
|
-
{
|
|
58
|
-
display: 'flex',
|
|
59
|
-
justifyContent: dateAlignment,
|
|
60
|
-
alignItems: dateAlignment,
|
|
61
|
-
flexShrink: 0,
|
|
62
|
-
},
|
|
63
|
-
parseElementStyles(parameters.dateMargin, parameters.datePosition, 3, parameters)
|
|
64
|
-
),
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const getPhotoUrl = (filename: string, parameters: VixonicParameters, downloadsPath: string) => {
|
|
69
|
-
const mode = parameters.photosMode
|
|
70
|
-
if (mode === 'zip' && parameters.photosZip && parameters.photosZip.filename !== undefined) {
|
|
71
|
-
return downloadsPath + '/' + parameters.photosZip.filename.replace('.zip', '/') + filename
|
|
72
|
-
} else {
|
|
73
|
-
return filename
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ClassicItem } from './components'
|
|
3
|
-
|
|
4
|
-
const itemStyles = {
|
|
5
|
-
standard: ClassicItem
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
style: 'standard' | 'custom',
|
|
10
|
-
anniversary: DataEmployee
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const AnniversaryItem = ({ style, anniversary }: Props) => {
|
|
14
|
-
const StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles['standard'] : itemStyles.standard
|
|
15
|
-
|
|
16
|
-
return <StyledItem anniversary={anniversary} />
|
|
17
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
const alignments = {
|
|
4
|
-
center: 'center',
|
|
5
|
-
left: 'flex-start',
|
|
6
|
-
right: 'flex-end'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type Aligment = {
|
|
10
|
-
horizontal: keyof typeof alignments,
|
|
11
|
-
vertical: keyof typeof alignments
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface Props {
|
|
15
|
-
format?: any
|
|
16
|
-
lineHeight?: number
|
|
17
|
-
maxChar?: number
|
|
18
|
-
style?: number
|
|
19
|
-
text: string
|
|
20
|
-
unit?: string
|
|
21
|
-
paddingBottom?: string
|
|
22
|
-
paddingTop?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const FormattedText: React.FunctionComponent<Props> = ({ text, format, maxChar, lineHeight, style, unit, paddingBottom, paddingTop }) => {
|
|
26
|
-
const trimText = (text: any, maxChar: any) => {
|
|
27
|
-
const isValid = maxChar && maxChar >= 3
|
|
28
|
-
if (isValid && (text && text.length > maxChar) || false) {
|
|
29
|
-
const returnText = text.substring(0, maxChar - 3)
|
|
30
|
-
returnText.substr(-1, 3)
|
|
31
|
-
return `${returnText.trim()}...`
|
|
32
|
-
}
|
|
33
|
-
return text
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const checkNested = (obj: any, path: string): boolean => {
|
|
37
|
-
return path.split('.').every(segment => {
|
|
38
|
-
if (obj && obj.hasOwnProperty(segment)) {
|
|
39
|
-
obj = obj[segment]
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
42
|
-
return false
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const getHorizontalAlignment = (alignment: Aligment) => {
|
|
47
|
-
if (alignment) {
|
|
48
|
-
const hA = alignment.horizontal
|
|
49
|
-
return alignments.hasOwnProperty(hA) ? alignments[alignment.horizontal] : 'flex-start'
|
|
50
|
-
}
|
|
51
|
-
return 'flex-start'
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const renderText = maxChar ? trimText(text, maxChar) : text
|
|
55
|
-
const containerStyle = Object.assign({
|
|
56
|
-
display: 'inline-flex',
|
|
57
|
-
justifyContent: getHorizontalAlignment(format.alignment)
|
|
58
|
-
}, style)
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<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>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
FormattedText.defaultProps = {
|
|
77
|
-
format: {},
|
|
78
|
-
lineHeight: 1,
|
|
79
|
-
unit: 'vh',
|
|
80
|
-
maxChar: undefined
|
|
81
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import anime from 'animejs'
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
mode: keyof typeof animationModes
|
|
5
|
-
duration: number
|
|
6
|
-
speed: number
|
|
7
|
-
stagger: number
|
|
8
|
-
reverse: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const animationModes = {
|
|
12
|
-
fade: {
|
|
13
|
-
in: {
|
|
14
|
-
opacity: [0, 1],
|
|
15
|
-
easing: 'linear',
|
|
16
|
-
},
|
|
17
|
-
out: {
|
|
18
|
-
opacity: [1, 0],
|
|
19
|
-
easing: 'linear',
|
|
20
|
-
},
|
|
21
|
-
init: {
|
|
22
|
-
opacity: 0,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
slideRight: {
|
|
26
|
-
in: {
|
|
27
|
-
translateX: () => {
|
|
28
|
-
return [`-100vw`, '0vw']
|
|
29
|
-
},
|
|
30
|
-
easing: 'easeOutQuad',
|
|
31
|
-
},
|
|
32
|
-
out: {
|
|
33
|
-
translateX: () => {
|
|
34
|
-
return ['0vw', `100vw`]
|
|
35
|
-
},
|
|
36
|
-
easing: 'easeInQuad',
|
|
37
|
-
},
|
|
38
|
-
init: {
|
|
39
|
-
transform: 'translateX(-100vw)',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
slideLeft: {
|
|
43
|
-
in: {
|
|
44
|
-
translateX: () => {
|
|
45
|
-
return [`100vw`, '0vw']
|
|
46
|
-
},
|
|
47
|
-
easing: 'easeOutQuad',
|
|
48
|
-
},
|
|
49
|
-
out: {
|
|
50
|
-
translateX: () => {
|
|
51
|
-
return ['0vw', `-100vw`]
|
|
52
|
-
},
|
|
53
|
-
easing: 'easeInQuad',
|
|
54
|
-
},
|
|
55
|
-
init: {
|
|
56
|
-
transform: 'translateX(100vw)',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
class Animation {
|
|
62
|
-
public mode: any
|
|
63
|
-
public duration: number
|
|
64
|
-
public speed: number
|
|
65
|
-
public stagger: number
|
|
66
|
-
public reverse: boolean
|
|
67
|
-
|
|
68
|
-
constructor() {
|
|
69
|
-
this.mode = animationModes.fade
|
|
70
|
-
this.duration = 10000
|
|
71
|
-
this.speed = 1000
|
|
72
|
-
this.stagger = 1000 / 4
|
|
73
|
-
this.reverse = true
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
configure(options: Options) {
|
|
77
|
-
this.mode = animationModes.hasOwnProperty(options.mode) ? animationModes[options.mode] : animationModes.fade
|
|
78
|
-
this.duration = options.duration || 10000
|
|
79
|
-
this.speed = 1000 * (options.speed || 1)
|
|
80
|
-
this.stagger = this.speed / (options.stagger || 4)
|
|
81
|
-
this.reverse = options.reverse
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getInitialStyle() {
|
|
85
|
-
return this.mode.init
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
animate(listNodes: any, finished: any) {
|
|
89
|
-
let self = this
|
|
90
|
-
let els = [].slice.call(listNodes, 0)
|
|
91
|
-
if (this.reverse) els = els.reverse()
|
|
92
|
-
if (!els || els.length < 1) return
|
|
93
|
-
let offset = this.duration - ((els.length - 1) * this.stagger + this.speed) * 2
|
|
94
|
-
offset = offset < 0 ? 0 : offset
|
|
95
|
-
let animation = anime.timeline({
|
|
96
|
-
autoplay: false,
|
|
97
|
-
})
|
|
98
|
-
animation.add(
|
|
99
|
-
Object.assign(
|
|
100
|
-
{
|
|
101
|
-
targets: els,
|
|
102
|
-
duration: this.speed,
|
|
103
|
-
delay: function (_el: any, i: any, _l: any) {
|
|
104
|
-
return i * self.stagger
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
this.mode.in
|
|
108
|
-
)
|
|
109
|
-
)
|
|
110
|
-
animation.add(
|
|
111
|
-
Object.assign(
|
|
112
|
-
{
|
|
113
|
-
targets: els,
|
|
114
|
-
duration: this.speed,
|
|
115
|
-
delay: function (_el: any, _i: any, _l: any) {
|
|
116
|
-
return _i * self.stagger
|
|
117
|
-
},
|
|
118
|
-
complete: () => {
|
|
119
|
-
finished()
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
this.mode.out
|
|
123
|
-
),
|
|
124
|
-
`+=${offset}`
|
|
125
|
-
)
|
|
126
|
-
animation.play()
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
module.exports = exports = Animation
|
package/src/components/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AnniversaryItem } from './AnniversaryItem';
|
|
2
|
-
import { FontLoader } from './FontLoader';
|
|
3
|
-
import { FormattedText } from './FormattedText';
|
|
4
|
-
import { ItemsContainer } from './ItemsContainer';
|
|
5
|
-
import { Render } from './Render';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
AnniversaryItem,
|
|
9
|
-
FontLoader,
|
|
10
|
-
FormattedText,
|
|
11
|
-
ItemsContainer,
|
|
12
|
-
Render
|
|
13
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { useReducer } from "react"
|
|
2
|
-
import { ConfigureContext } from './ConfigureContext'
|
|
3
|
-
import { anniversaryReducer } 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
|
-
containerRows: "",
|
|
17
|
-
containerRowsGap: "",
|
|
18
|
-
containerColumnsGap: "",
|
|
19
|
-
dataMode: "",
|
|
20
|
-
dateAlignment: "center",
|
|
21
|
-
dateDayFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 55, alignment: { horizontal: "center" }, fontColor: "", },
|
|
22
|
-
dateEnabled: true,
|
|
23
|
-
dateMonthFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 20, alignment: { horizontal: "center" }, fontColor: "" },
|
|
24
|
-
datePosition: 1,
|
|
25
|
-
datePrimaryColor: "",
|
|
26
|
-
dateStyle: "circle",
|
|
27
|
-
descriptionEnabled: true,
|
|
28
|
-
descriptionFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
29
|
-
optionalEnabled: true,
|
|
30
|
-
optionalFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
31
|
-
excludePast: false,
|
|
32
|
-
imageAlignment: "center",
|
|
33
|
-
imageEnabled: true,
|
|
34
|
-
imagePosition: 0,
|
|
35
|
-
imageStyle: "normal",
|
|
36
|
-
imageSize: 50,
|
|
37
|
-
itemMargins: "",
|
|
38
|
-
msj0: "",
|
|
39
|
-
nameFormat: { font: { filename: '', id: '', _isAsset: true }, fontSize: 3.8, alignment: { horizontal: "center" }, fontColor: "" },
|
|
40
|
-
orientation: "",
|
|
41
|
-
padding: "",
|
|
42
|
-
photosMode: "",
|
|
43
|
-
photosZip: { id: "0fb559ec-5da3-4b2d-95c4-d9623754c841", filename: "0fb559ec-5da3-4b2d-95c4-d9623754c841.zip", extension: "zip", _isAsset: true },
|
|
44
|
-
template: "",
|
|
45
|
-
textAlignment: "center",
|
|
46
|
-
textPosition: 0,
|
|
47
|
-
updateTime: 600000,
|
|
48
|
-
urlBaseApi: "",
|
|
49
|
-
imageMargin: "",
|
|
50
|
-
textMargin: "",
|
|
51
|
-
dateMargin: "",
|
|
52
|
-
separator: false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface props {
|
|
57
|
-
children: JSX.Element | JSX.Element[]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const AnniversaryProvider = ({ children }: props) => {
|
|
61
|
-
const [configureState, dispatch] = useReducer(anniversaryReducer, INITIAL_STATE)
|
|
62
|
-
|
|
63
|
-
const addConfiguration = (configure: VixonicData) => {
|
|
64
|
-
dispatch({ type: "addConfigure", payload: configure })
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<ConfigureContext.Provider value={{ configureState, addConfiguration }}>
|
|
69
|
-
{children}
|
|
70
|
-
</ConfigureContext.Provider>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
type ConfigureAction = { type: 'addConfigure', payload: VixonicData }
|
|
2
|
-
|
|
3
|
-
export const anniversaryReducer = (state: VixonicData, action: ConfigureAction) => {
|
|
4
|
-
const { downloadsPath, parameters } = action.payload
|
|
5
|
-
switch (action.type) {
|
|
6
|
-
case 'addConfigure':
|
|
7
|
-
return {
|
|
8
|
-
downloadsPath: downloadsPath,
|
|
9
|
-
parameters: {
|
|
10
|
-
abbreviatedMonths: parameters.abbreviatedMonths,
|
|
11
|
-
animationMode: parameters.animationMode,
|
|
12
|
-
animationOrder: parameters.animationOrder,
|
|
13
|
-
animationSpeed: parameters.animationSpeed,
|
|
14
|
-
animationTime: parameters.animationTime,
|
|
15
|
-
apiDomain: parameters.apiDomain,
|
|
16
|
-
backgroundImage: parameters.backgroundImage,
|
|
17
|
-
containerColumns: parameters.containerColumns,
|
|
18
|
-
containerColumnsGap: parameters.containerColumnsGap,
|
|
19
|
-
containerRows: parameters.containerRows,
|
|
20
|
-
containerRowsGap: parameters.containerRowsGap,
|
|
21
|
-
dataMode: parameters.dataMode,
|
|
22
|
-
dateAlignment: parameters.dateAlignment,
|
|
23
|
-
dateDayFormat: parameters.dateDayFormat,
|
|
24
|
-
dateEnabled: parameters.dateEnabled,
|
|
25
|
-
dateMonthFormat: parameters.dateMonthFormat,
|
|
26
|
-
datePosition: parameters.datePosition,
|
|
27
|
-
datePrimaryColor: parameters.datePrimaryColor,
|
|
28
|
-
dateStyle: parameters.dateStyle,
|
|
29
|
-
descriptionEnabled: parameters.descriptionEnabled,
|
|
30
|
-
descriptionFormat: parameters.descriptionFormat,
|
|
31
|
-
optionalEnabled: parameters.optionalEnabled,
|
|
32
|
-
optionalFormat: parameters.optionalFormat,
|
|
33
|
-
excludePast: parameters.excludePast,
|
|
34
|
-
imageAlignment: parameters.imageAlignment,
|
|
35
|
-
imageEnabled: parameters.imageEnabled,
|
|
36
|
-
imagePosition: parameters.imagePosition,
|
|
37
|
-
imageSize: parameters.imageSize,
|
|
38
|
-
imageStyle: parameters.imageStyle,
|
|
39
|
-
itemMargins: parameters.itemMargins,
|
|
40
|
-
msj0: parameters.msj0,
|
|
41
|
-
nameFormat: parameters.nameFormat,
|
|
42
|
-
orientation: parameters.orientation,
|
|
43
|
-
padding: parameters.padding,
|
|
44
|
-
photosMode: parameters.photosMode,
|
|
45
|
-
photosZip: parameters.photosZip,
|
|
46
|
-
template: parameters.template,
|
|
47
|
-
textAlignment: parameters.textAlignment,
|
|
48
|
-
textPosition: parameters.textPosition,
|
|
49
|
-
updateTime: parameters.updateTime,
|
|
50
|
-
urlBaseApi: parameters.urlBaseApi,
|
|
51
|
-
imageMargin: parameters.imageMargin,
|
|
52
|
-
textMargin: parameters.textMargin,
|
|
53
|
-
dateMargin: parameters.dateMargin,
|
|
54
|
-
separator: parameters.separator,
|
|
55
|
-
nameMaxChar: parameters.nameMaxChar,
|
|
56
|
-
descriptionMaxChar: parameters.descriptionMaxChar
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
default:
|
|
60
|
-
return state;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { useReducer } from 'react'
|
|
2
|
-
import { DataContext } from './DataContex'
|
|
3
|
-
import { dataReducer } from './dataReducer'
|
|
4
|
-
|
|
5
|
-
const INITIAL_STATE: Employees = {
|
|
6
|
-
dataEmployee: []
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface props {
|
|
10
|
-
children: JSX.Element | JSX.Element[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const DataProvider = ({ children }: props) => {
|
|
14
|
-
const [dataEmployee, dispatch] = useReducer(dataReducer, INITIAL_STATE)
|
|
15
|
-
|
|
16
|
-
const addEmployee = (employee: DataEmployee[]) => {
|
|
17
|
-
dispatch({ type: 'addAnniversary', payload: employee })
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<DataContext.Provider value={{ dataEmployee, addEmployee }}>
|
|
22
|
-
{children}
|
|
23
|
-
</DataContext.Provider>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type DataAction = { type: 'addAnniversary', payload: DataEmployee[] }
|
|
2
|
-
|
|
3
|
-
export const dataReducer = (state: Employees, action: DataAction): Employees => {
|
|
4
|
-
switch (action.type) {
|
|
5
|
-
case 'addAnniversary':
|
|
6
|
-
return {
|
|
7
|
-
dataEmployee: action.payload
|
|
8
|
-
}
|
|
9
|
-
default:
|
|
10
|
-
return state
|
|
11
|
-
}
|
|
12
|
-
}
|
/package/src/components/{AnniversaryItem/components → anniversary-item/shared}/default-profile.png
RENAMED
|
File without changes
|