@dev-crew-berlin/enter-js-utils 0.33.0 → 0.34.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/dist/generated/api-schema.d.ts +40 -47
- package/dist/models/instance.d.ts +2 -0
- package/dist/models/instance.js +7 -1
- package/dist/ui/guest-card.d.ts +1 -1
- package/dist/ui/guest-card.js +25 -11
- package/dist/ui/guest-card.stories.d.ts +19 -8
- package/dist/ui/guest-card.stories.js +41 -3
- package/package.json +1 -1
|
@@ -67,17 +67,17 @@ export declare type components = {
|
|
|
67
67
|
* @description New attendee was created
|
|
68
68
|
*/
|
|
69
69
|
AttendeeCreatedEvent: {
|
|
70
|
+
/**
|
|
71
|
+
* Id
|
|
72
|
+
* Format: uuid
|
|
73
|
+
*/
|
|
74
|
+
id?: string;
|
|
70
75
|
/**
|
|
71
76
|
* Event
|
|
72
77
|
* @default attendee-created
|
|
73
78
|
* @enum {string}
|
|
74
79
|
*/
|
|
75
80
|
event: "attendee-created";
|
|
76
|
-
/**
|
|
77
|
-
* Id
|
|
78
|
-
* Format: uuid
|
|
79
|
-
*/
|
|
80
|
-
id: string;
|
|
81
81
|
attendee: components["schemas"]["PublicAttendee"];
|
|
82
82
|
/** Instancename */
|
|
83
83
|
instanceName: string;
|
|
@@ -87,17 +87,17 @@ export declare type components = {
|
|
|
87
87
|
* @description Attendee was deleted
|
|
88
88
|
*/
|
|
89
89
|
AttendeeDeletedEvent: {
|
|
90
|
+
/**
|
|
91
|
+
* Id
|
|
92
|
+
* Format: uuid
|
|
93
|
+
*/
|
|
94
|
+
id?: string;
|
|
90
95
|
/**
|
|
91
96
|
* Event
|
|
92
97
|
* @default attendee-deleted
|
|
93
98
|
* @enum {string}
|
|
94
99
|
*/
|
|
95
100
|
event: "attendee-deleted";
|
|
96
|
-
/**
|
|
97
|
-
* Id
|
|
98
|
-
* Format: uuid
|
|
99
|
-
*/
|
|
100
|
-
id: string;
|
|
101
101
|
/** Attendeeid */
|
|
102
102
|
attendeeId: string;
|
|
103
103
|
/** Instancename */
|
|
@@ -113,17 +113,17 @@ export declare type components = {
|
|
|
113
113
|
* Alternatively you can set `is_edit` to trigger email that are sent on edit instead.
|
|
114
114
|
*/
|
|
115
115
|
AttendeeRespondedEvent: {
|
|
116
|
+
/**
|
|
117
|
+
* Id
|
|
118
|
+
* Format: uuid
|
|
119
|
+
*/
|
|
120
|
+
id?: string;
|
|
116
121
|
/**
|
|
117
122
|
* Event
|
|
118
123
|
* @default attendee-responded
|
|
119
124
|
* @enum {string}
|
|
120
125
|
*/
|
|
121
126
|
event: "attendee-responded";
|
|
122
|
-
/**
|
|
123
|
-
* Id
|
|
124
|
-
* Format: uuid
|
|
125
|
-
*/
|
|
126
|
-
id: string;
|
|
127
127
|
/** Instancename */
|
|
128
128
|
instanceName: string;
|
|
129
129
|
/** Attendeeid */
|
|
@@ -163,17 +163,17 @@ export declare type components = {
|
|
|
163
163
|
* @description Attendee was updated. This includes `userdata` but also other data such as `payment`, `rsvp` or `tags`
|
|
164
164
|
*/
|
|
165
165
|
AttendeeUpdatedEvent: {
|
|
166
|
+
/**
|
|
167
|
+
* Id
|
|
168
|
+
* Format: uuid
|
|
169
|
+
*/
|
|
170
|
+
id?: string;
|
|
166
171
|
/**
|
|
167
172
|
* Event
|
|
168
173
|
* @default attendee-updated
|
|
169
174
|
* @enum {string}
|
|
170
175
|
*/
|
|
171
176
|
event: "attendee-updated";
|
|
172
|
-
/**
|
|
173
|
-
* Id
|
|
174
|
-
* Format: uuid
|
|
175
|
-
*/
|
|
176
|
-
id: string;
|
|
177
177
|
/** Instancename */
|
|
178
178
|
instanceName: string;
|
|
179
179
|
/** Attendeeid */
|
|
@@ -401,17 +401,17 @@ export declare type components = {
|
|
|
401
401
|
* @description A new checkin was created
|
|
402
402
|
*/
|
|
403
403
|
CheckinCreatedEvent: {
|
|
404
|
+
/**
|
|
405
|
+
* Id
|
|
406
|
+
* Format: uuid
|
|
407
|
+
*/
|
|
408
|
+
id?: string;
|
|
404
409
|
/**
|
|
405
410
|
* Event
|
|
406
411
|
* @default checkin-created
|
|
407
412
|
* @enum {string}
|
|
408
413
|
*/
|
|
409
414
|
event: "checkin-created";
|
|
410
|
-
/**
|
|
411
|
-
* Id
|
|
412
|
-
* Format: uuid
|
|
413
|
-
*/
|
|
414
|
-
id: string;
|
|
415
415
|
/** Instancename */
|
|
416
416
|
instanceName: string;
|
|
417
417
|
/** Attendeeid */
|
|
@@ -425,17 +425,17 @@ export declare type components = {
|
|
|
425
425
|
* @description An existing checkin was deleted
|
|
426
426
|
*/
|
|
427
427
|
CheckinDeletedEvent: {
|
|
428
|
+
/**
|
|
429
|
+
* Id
|
|
430
|
+
* Format: uuid
|
|
431
|
+
*/
|
|
432
|
+
id?: string;
|
|
428
433
|
/**
|
|
429
434
|
* Event
|
|
430
435
|
* @default checkin-deleted
|
|
431
436
|
* @enum {string}
|
|
432
437
|
*/
|
|
433
438
|
event: "checkin-deleted";
|
|
434
|
-
/**
|
|
435
|
-
* Id
|
|
436
|
-
* Format: uuid
|
|
437
|
-
*/
|
|
438
|
-
id: string;
|
|
439
439
|
/** Instancename */
|
|
440
440
|
instanceName: string;
|
|
441
441
|
/** Attendeeid */
|
|
@@ -853,15 +853,6 @@ export declare type components = {
|
|
|
853
853
|
*/
|
|
854
854
|
isCompanion: false;
|
|
855
855
|
};
|
|
856
|
-
/** MetaField */
|
|
857
|
-
MetaField: {
|
|
858
|
-
/** Type */
|
|
859
|
-
type: "list" | "checkbox" | "text" | "textfield";
|
|
860
|
-
/** Values */
|
|
861
|
-
values?: string[];
|
|
862
|
-
/** Default */
|
|
863
|
-
default?: string;
|
|
864
|
-
};
|
|
865
856
|
/** NumberField */
|
|
866
857
|
NumberField: {
|
|
867
858
|
/**
|
|
@@ -919,6 +910,8 @@ export declare type components = {
|
|
|
919
910
|
Payment: {
|
|
920
911
|
/** Paid */
|
|
921
912
|
paid: boolean;
|
|
913
|
+
/** Title */
|
|
914
|
+
title?: string;
|
|
922
915
|
/**
|
|
923
916
|
* Provider
|
|
924
917
|
* @enum {string}
|
|
@@ -936,17 +929,17 @@ export declare type components = {
|
|
|
936
929
|
* This triggers mails that are atomatically sent on payment
|
|
937
930
|
*/
|
|
938
931
|
PaymentPaidEvent: {
|
|
932
|
+
/**
|
|
933
|
+
* Id
|
|
934
|
+
* Format: uuid
|
|
935
|
+
*/
|
|
936
|
+
id?: string;
|
|
939
937
|
/**
|
|
940
938
|
* Event
|
|
941
939
|
* @default payment-paid
|
|
942
940
|
* @enum {string}
|
|
943
941
|
*/
|
|
944
942
|
event: "payment-paid";
|
|
945
|
-
/**
|
|
946
|
-
* Id
|
|
947
|
-
* Format: uuid
|
|
948
|
-
*/
|
|
949
|
-
id: string;
|
|
950
943
|
/** Attendeeid */
|
|
951
944
|
attendeeId: string;
|
|
952
945
|
/** Instancename */
|
|
@@ -1019,9 +1012,9 @@ export declare type components = {
|
|
|
1019
1012
|
registration: components["schemas"]["RegistrationInfo"];
|
|
1020
1013
|
/** Guestnamefields */
|
|
1021
1014
|
guestNameFields: string[];
|
|
1022
|
-
/**
|
|
1023
|
-
|
|
1024
|
-
[key: string]:
|
|
1015
|
+
/** Tagcolors */
|
|
1016
|
+
tagColors: {
|
|
1017
|
+
[key: string]: string;
|
|
1025
1018
|
};
|
|
1026
1019
|
};
|
|
1027
1020
|
/**
|
|
@@ -27,9 +27,11 @@ export declare class Instance {
|
|
|
27
27
|
editEnd?: Date;
|
|
28
28
|
};
|
|
29
29
|
guestNameFields: string[];
|
|
30
|
+
tagColors: Record<string, string>;
|
|
30
31
|
constructor(json: InstanceJSON);
|
|
31
32
|
toJSON(): InstanceJSON;
|
|
32
33
|
isRegistrationClosed(): boolean;
|
|
33
34
|
canEditRegistration(): boolean;
|
|
34
35
|
formatName(guest: Attendee): string;
|
|
36
|
+
getTagColor(tag: string): string;
|
|
35
37
|
}
|
package/dist/models/instance.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { theme } from '../lib';
|
|
1
2
|
export class Instance {
|
|
2
3
|
constructor(json) {
|
|
3
4
|
this.name = json.name;
|
|
@@ -14,6 +15,7 @@ export class Instance {
|
|
|
14
15
|
editEnd: json.registration.editEnd ? new Date(json.registration.editEnd) : undefined
|
|
15
16
|
};
|
|
16
17
|
this.guestNameFields = json.guestNameFields;
|
|
18
|
+
this.tagColors = json.tagColors;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
toJSON() {
|
|
@@ -32,7 +34,7 @@ export class Instance {
|
|
|
32
34
|
editEnd: this.registration.editEnd?.toISOString()
|
|
33
35
|
},
|
|
34
36
|
guestNameFields: this.guestNameFields,
|
|
35
|
-
|
|
37
|
+
tagColors: this.tagColors
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -69,4 +71,8 @@ export class Instance {
|
|
|
69
71
|
return this.guestNameFields.map(fieldKey => guest.userdata[fieldKey] ?? '').join(' ');
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
getTagColor(tag) {
|
|
75
|
+
return this.tagColors[tag] ?? theme.colors.enterMediumGrey;
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
}
|
package/dist/ui/guest-card.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ declare type Props = {
|
|
|
5
5
|
attendee: Attendee;
|
|
6
6
|
checkinTag: string;
|
|
7
7
|
plain?: boolean;
|
|
8
|
-
labelColor?: string;
|
|
9
8
|
infoText?: string;
|
|
10
9
|
formatName: (attendee: Attendee) => string;
|
|
11
10
|
filterTags?: (tag: string) => boolean;
|
|
11
|
+
getTagColor?: (tag: string) => string;
|
|
12
12
|
findMainGuest?: (attendeeId: string) => Attendee | undefined;
|
|
13
13
|
onClick?: (attendeeId: string) => void;
|
|
14
14
|
};
|
package/dist/ui/guest-card.js
CHANGED
|
@@ -9,21 +9,35 @@ export const GuestCard = props => {
|
|
|
9
9
|
const filterTags = props.filterTags ?? (() => true);
|
|
10
10
|
|
|
11
11
|
const tags = (props.attendee.tags || []).filter(filterTags);
|
|
12
|
+
|
|
13
|
+
const getTagColor = props.getTagColor ?? (() => undefined);
|
|
14
|
+
|
|
12
15
|
const onClick = props.onClick ? () => {
|
|
13
16
|
if (!props.onClick) return;
|
|
14
17
|
props.onClick(props.attendee.id);
|
|
15
18
|
} : undefined;
|
|
16
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'guest-card-wrapper'
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-color-list'
|
|
23
|
+
}, tags.map(tag => [tag, getTagColor(tag)]).filter(([, tagColor]) => tagColor).map(([tag, tagColor]) => /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
key: tag,
|
|
25
|
+
title: tag,
|
|
26
|
+
style: {
|
|
27
|
+
backgroundColor: tagColor,
|
|
28
|
+
height: '100%'
|
|
29
|
+
},
|
|
30
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-color'
|
|
31
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
17
32
|
onClick: onClick,
|
|
18
|
-
className: _JSXStyle.dynamic([["
|
|
33
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + (cx({
|
|
19
34
|
'guest-card': true,
|
|
20
|
-
plain: props.plain
|
|
21
|
-
labeled: props.labelColor !== undefined
|
|
35
|
+
plain: props.plain
|
|
22
36
|
}) || "")
|
|
23
37
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: _JSXStyle.dynamic([["
|
|
38
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]])
|
|
25
39
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
26
|
-
className: _JSXStyle.dynamic([["
|
|
40
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'name'
|
|
27
41
|
}, props.formatName(props.attendee)), /*#__PURE__*/React.createElement(CompanionInfo, {
|
|
28
42
|
companionStatus: props.attendee.companions,
|
|
29
43
|
findMainGuest: props.findMainGuest,
|
|
@@ -33,13 +47,13 @@ export const GuestCard = props => {
|
|
|
33
47
|
response: props.attendee.getResponseForTag(props.checkinTag),
|
|
34
48
|
rsvpCount: props.attendee.getRsvpCountForTag(props.checkinTag)
|
|
35
49
|
})), /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className: _JSXStyle.dynamic([["
|
|
50
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-list'
|
|
37
51
|
}, tags.map(tag => /*#__PURE__*/React.createElement(Tag, {
|
|
38
52
|
key: tag
|
|
39
53
|
}, tag)), props.infoText && /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: _JSXStyle.dynamic([["
|
|
41
|
-
}, " ", props.infoText)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
42
|
-
id: "
|
|
43
|
-
dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary
|
|
44
|
-
}, `.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;
|
|
54
|
+
className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'info'
|
|
55
|
+
}, " ", props.infoText))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
56
|
+
id: "4235458019",
|
|
57
|
+
dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]
|
|
58
|
+
}, `.guest-card-wrapper.__jsx-style-dynamic-selector{border-radius:2px;border:1px solid ${theme.colors.enterGrey};background-color:${theme.colors.enterBackground};font-family:${theme.fonts.primary};margin:1.5em 0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;padding:1.1em 1em 0.9em;-webkit-flex:1;-ms-flex:1;flex:1;}.tag-color-list.__jsx-style-dynamic-selector{width:0.5em;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.tag-color.__jsx-style-dynamic-selector:first-child{border-top-left-radius:1px;}.tag-color.__jsx-style-dynamic-selector:last-child{border-bottom-left-radius:1px;}.plain.__jsx-style-dynamic-selector{border:none;background-color:transparent;}.name.__jsx-style-dynamic-selector{font-size:1.15em;margin:-0.1em 0 0.3em;}.tag-list.__jsx-style-dynamic-selector{max-width:40%;text-align:right;font-size:0.9em;}.info.__jsx-style-dynamic-selector{display:block;width:100%;text-align:right;}`));
|
|
45
59
|
};
|
|
@@ -5,10 +5,10 @@ declare const _default: ComponentMeta<React.FunctionComponent<{
|
|
|
5
5
|
attendee: Attendee;
|
|
6
6
|
checkinTag: string;
|
|
7
7
|
plain?: boolean | undefined;
|
|
8
|
-
labelColor?: string | undefined;
|
|
9
8
|
infoText?: string | undefined;
|
|
10
9
|
formatName: (attendee: Attendee) => string;
|
|
11
10
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
11
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
12
12
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
13
13
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
14
14
|
}>>;
|
|
@@ -17,10 +17,10 @@ export declare const WithBackground: ComponentStory<React.FunctionComponent<{
|
|
|
17
17
|
attendee: Attendee;
|
|
18
18
|
checkinTag: string;
|
|
19
19
|
plain?: boolean | undefined;
|
|
20
|
-
labelColor?: string | undefined;
|
|
21
20
|
infoText?: string | undefined;
|
|
22
21
|
formatName: (attendee: Attendee) => string;
|
|
23
22
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
23
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
24
24
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
25
25
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
26
26
|
}>>;
|
|
@@ -28,10 +28,10 @@ export declare const Plain: ComponentStory<React.FunctionComponent<{
|
|
|
28
28
|
attendee: Attendee;
|
|
29
29
|
checkinTag: string;
|
|
30
30
|
plain?: boolean | undefined;
|
|
31
|
-
labelColor?: string | undefined;
|
|
32
31
|
infoText?: string | undefined;
|
|
33
32
|
formatName: (attendee: Attendee) => string;
|
|
34
33
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
34
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
35
35
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
36
36
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
37
37
|
}>>;
|
|
@@ -39,10 +39,10 @@ export declare const FilteredTags: ComponentStory<React.FunctionComponent<{
|
|
|
39
39
|
attendee: Attendee;
|
|
40
40
|
checkinTag: string;
|
|
41
41
|
plain?: boolean | undefined;
|
|
42
|
-
labelColor?: string | undefined;
|
|
43
42
|
infoText?: string | undefined;
|
|
44
43
|
formatName: (attendee: Attendee) => string;
|
|
45
44
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
45
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
46
46
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
47
47
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
48
48
|
}>>;
|
|
@@ -50,10 +50,21 @@ export declare const WithColorLabel: ComponentStory<React.FunctionComponent<{
|
|
|
50
50
|
attendee: Attendee;
|
|
51
51
|
checkinTag: string;
|
|
52
52
|
plain?: boolean | undefined;
|
|
53
|
-
labelColor?: string | undefined;
|
|
54
53
|
infoText?: string | undefined;
|
|
55
54
|
formatName: (attendee: Attendee) => string;
|
|
56
55
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
56
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
57
|
+
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
58
|
+
onClick?: ((attendeeId: string) => void) | undefined;
|
|
59
|
+
}>>;
|
|
60
|
+
export declare const WithMultipleColorLabels: ComponentStory<React.FunctionComponent<{
|
|
61
|
+
attendee: Attendee;
|
|
62
|
+
checkinTag: string;
|
|
63
|
+
plain?: boolean | undefined;
|
|
64
|
+
infoText?: string | undefined;
|
|
65
|
+
formatName: (attendee: Attendee) => string;
|
|
66
|
+
filterTags?: ((tag: string) => boolean) | undefined;
|
|
67
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
57
68
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
58
69
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
59
70
|
}>>;
|
|
@@ -61,10 +72,10 @@ export declare const WithInfoText: ComponentStory<React.FunctionComponent<{
|
|
|
61
72
|
attendee: Attendee;
|
|
62
73
|
checkinTag: string;
|
|
63
74
|
plain?: boolean | undefined;
|
|
64
|
-
labelColor?: string | undefined;
|
|
65
75
|
infoText?: string | undefined;
|
|
66
76
|
formatName: (attendee: Attendee) => string;
|
|
67
77
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
78
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
68
79
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
69
80
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
70
81
|
}>>;
|
|
@@ -72,10 +83,10 @@ export declare const WithCompanion: ComponentStory<React.FunctionComponent<{
|
|
|
72
83
|
attendee: Attendee;
|
|
73
84
|
checkinTag: string;
|
|
74
85
|
plain?: boolean | undefined;
|
|
75
|
-
labelColor?: string | undefined;
|
|
76
86
|
infoText?: string | undefined;
|
|
77
87
|
formatName: (attendee: Attendee) => string;
|
|
78
88
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
89
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
79
90
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
80
91
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
81
92
|
}>>;
|
|
@@ -83,10 +94,10 @@ export declare const WithCompanionButNoMainGuestInfo: ComponentStory<React.Funct
|
|
|
83
94
|
attendee: Attendee;
|
|
84
95
|
checkinTag: string;
|
|
85
96
|
plain?: boolean | undefined;
|
|
86
|
-
labelColor?: string | undefined;
|
|
87
97
|
infoText?: string | undefined;
|
|
88
98
|
formatName: (attendee: Attendee) => string;
|
|
89
99
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
100
|
+
getTagColor?: ((tag: string) => string) | undefined;
|
|
90
101
|
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
91
102
|
onClick?: ((attendeeId: string) => void) | undefined;
|
|
92
103
|
}>>;
|
|
@@ -28,10 +28,27 @@ const attendee = new Attendee({
|
|
|
28
28
|
},
|
|
29
29
|
deleted: false
|
|
30
30
|
});
|
|
31
|
+
const attendeeWithMultipleTags = new Attendee({
|
|
32
|
+
id: 'my-attendee-2',
|
|
33
|
+
language: 'de',
|
|
34
|
+
tags: ['VIP', 'tester', 'Import-200-02-10'],
|
|
35
|
+
time: new Date('2022-01-01').toISOString(),
|
|
36
|
+
rsvp: {
|
|
37
|
+
default: 1
|
|
38
|
+
},
|
|
39
|
+
checkin: {},
|
|
40
|
+
companions: {
|
|
41
|
+
isCompanion: false
|
|
42
|
+
},
|
|
43
|
+
userdata: {
|
|
44
|
+
name: 'Max Mustermann'
|
|
45
|
+
},
|
|
46
|
+
deleted: false
|
|
47
|
+
});
|
|
31
48
|
const companion = new Attendee({
|
|
32
49
|
id: 'my-companion',
|
|
33
50
|
language: 'de',
|
|
34
|
-
tags: ['VIP'
|
|
51
|
+
tags: ['VIP'],
|
|
35
52
|
time: new Date('2022-01-01').toISOString(),
|
|
36
53
|
rsvp: {
|
|
37
54
|
default: 1
|
|
@@ -42,10 +59,14 @@ const companion = new Attendee({
|
|
|
42
59
|
mainGuestId: 'my-attendee'
|
|
43
60
|
},
|
|
44
61
|
userdata: {
|
|
45
|
-
name: '
|
|
62
|
+
name: 'John Doe'
|
|
46
63
|
},
|
|
47
64
|
deleted: false
|
|
48
65
|
});
|
|
66
|
+
const tagColors = {
|
|
67
|
+
VIP: theme.colors.enterPink,
|
|
68
|
+
tester: theme.colors.enterCyan
|
|
69
|
+
};
|
|
49
70
|
|
|
50
71
|
const Template = args => /*#__PURE__*/React.createElement(GuestCard, args);
|
|
51
72
|
|
|
@@ -89,10 +110,27 @@ export const WithColorLabel = Template.bind({});
|
|
|
89
110
|
WithColorLabel.args = {
|
|
90
111
|
attendee: attendee,
|
|
91
112
|
checkinTag: 'default',
|
|
92
|
-
labelColor: theme.colors.enterPink,
|
|
93
113
|
|
|
94
114
|
formatName(attendee) {
|
|
95
115
|
return attendee.userdata.name?.toString() ?? '';
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
getTagColor(tag) {
|
|
119
|
+
return tagColors[tag] ?? null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
};
|
|
123
|
+
export const WithMultipleColorLabels = Template.bind({});
|
|
124
|
+
WithMultipleColorLabels.args = {
|
|
125
|
+
attendee: attendeeWithMultipleTags,
|
|
126
|
+
checkinTag: 'default',
|
|
127
|
+
|
|
128
|
+
formatName(attendee) {
|
|
129
|
+
return attendee.userdata.name?.toString() ?? '';
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
getTagColor(tag) {
|
|
133
|
+
return tagColors[tag] ?? null;
|
|
96
134
|
}
|
|
97
135
|
|
|
98
136
|
};
|