@dev-crew-berlin/enter-js-utils 0.38.0 → 0.39.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/models/attendee.js +1 -1
- package/dist/models/checkin.d.ts +0 -1
- package/dist/models/checkin.js +1 -2
- package/dist/models/checkins.d.ts +1 -3
- package/dist/models/checkins.js +2 -11
- package/dist/ui/checkin-progress-bar.d.ts +2 -0
- package/dist/ui/checkin-progress-bar.js +2 -2
- package/dist/ui/checkin-progress-bar.stories.d.ts +21 -0
- package/dist/ui/checkin-progress-bar.stories.js +8 -0
- package/dist/ui/guest-card.js +1 -1
- package/package.json +2 -2
package/dist/models/attendee.js
CHANGED
|
@@ -72,7 +72,7 @@ export class Attendee {
|
|
|
72
72
|
getCheckinCountForTag(checkinTag) {
|
|
73
73
|
const checkins = this.checkin[checkinTag];
|
|
74
74
|
if (!checkins) return 0;
|
|
75
|
-
return checkins.
|
|
75
|
+
return checkins.getActiveCheckins().length;
|
|
76
76
|
}
|
|
77
77
|
addCheckinForTag(args) {
|
|
78
78
|
const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
|
package/dist/models/checkin.d.ts
CHANGED
package/dist/models/checkin.js
CHANGED
|
@@ -2,13 +2,12 @@ export class Checkin {
|
|
|
2
2
|
constructor(json) {
|
|
3
3
|
this.id = json.id;
|
|
4
4
|
this.time = new Date(json.time);
|
|
5
|
-
this.main = json.main;
|
|
6
5
|
}
|
|
7
6
|
toJSON() {
|
|
8
7
|
return {
|
|
9
8
|
id: this.id,
|
|
10
9
|
time: this.time.toISOString(),
|
|
11
|
-
main:
|
|
10
|
+
main: false
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -6,8 +6,6 @@ export declare class Checkins {
|
|
|
6
6
|
deleted: string[];
|
|
7
7
|
constructor(json?: CheckinsJSON);
|
|
8
8
|
toJSON(): CheckinsJSON;
|
|
9
|
-
|
|
10
|
-
getOtherCheckins(): Checkin[];
|
|
11
|
-
getMainCheckin(): Checkin | undefined;
|
|
9
|
+
getActiveCheckins(): Checkin[];
|
|
12
10
|
merge(otherCheckin: Checkins): Checkins;
|
|
13
11
|
}
|
package/dist/models/checkins.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { notUndefined } from '../lib';
|
|
2
1
|
import { Checkin } from './checkin';
|
|
3
2
|
export class Checkins {
|
|
4
3
|
checkins = [];
|
|
@@ -15,16 +14,8 @@ export class Checkins {
|
|
|
15
14
|
deleted: this.deleted
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return mainAndOthers.filter(notUndefined);
|
|
21
|
-
}
|
|
22
|
-
getOtherCheckins() {
|
|
23
|
-
return this.checkins.filter(c => c.main === false && !this.deleted.includes(c.id));
|
|
24
|
-
}
|
|
25
|
-
getMainCheckin() {
|
|
26
|
-
const nonDeletedCheckins = this.checkins.filter(checkin => checkin.main === true && !this.deleted.includes(checkin.id)).sort((a, b) => a.time.getTime() - b.time.getTime());
|
|
27
|
-
return nonDeletedCheckins[0];
|
|
17
|
+
getActiveCheckins() {
|
|
18
|
+
return this.checkins.filter(c => !this.deleted.includes(c.id));
|
|
28
19
|
}
|
|
29
20
|
merge(otherCheckin) {
|
|
30
21
|
const checkins = new Map([...this.checkins, ...otherCheckin.checkins].map(checkin => [checkin.id, checkin])).values();
|
|
@@ -14,13 +14,13 @@ export const CheckinProgressBar = props => {
|
|
|
14
14
|
className: _JSXStyle.dynamic([["818622950", [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]]]) + " " + 'number checkin-count'
|
|
15
15
|
}, props.checkinCount, /*#__PURE__*/React.createElement("label", {
|
|
16
16
|
className: _JSXStyle.dynamic([["818622950", [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]]])
|
|
17
|
-
},
|
|
17
|
+
}, props.leftLabel || 'Checkins')), /*#__PURE__*/React.createElement("div", {
|
|
18
18
|
className: _JSXStyle.dynamic([["818622950", [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]]]) + " " + 'checkin-tag-display'
|
|
19
19
|
}, props.children), /*#__PURE__*/React.createElement("div", {
|
|
20
20
|
className: _JSXStyle.dynamic([["818622950", [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]]]) + " " + 'number confirmations'
|
|
21
21
|
}, props.rsvp, /*#__PURE__*/React.createElement("label", {
|
|
22
22
|
className: _JSXStyle.dynamic([["818622950", [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]]])
|
|
23
|
-
},
|
|
23
|
+
}, props.rightLabel || 'Confirmations')), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
24
|
id: "818622950",
|
|
25
25
|
dynamic: [theme.colors.enterDarkGrey, theme.colors.enterBackground, theme.fonts.primary, theme.colors.enterGreen, theme.fonts.secondary]
|
|
26
26
|
}, `.checkin-progress-bar.__jsx-style-dynamic-selector{position:relative;padding:0.5em 1em 0.7em;background-color:${theme.colors.enterDarkGrey};border:1px solid ${theme.colors.enterBackground};font-family:${theme.fonts.primary};color:white;display:grid;grid-template-columns:1fr auto 1fr;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:4px;overflow:hidden;cursor:pointer;}.progress.__jsx-style-dynamic-selector{z-index:0;top:0;margin:0;padding:0;position:absolute;height:100%;background-color:${theme.colors.enterGreen};}.number.__jsx-style-dynamic-selector{z-index:1;font-weight:200;font-size:1.4em;}.checkin-count.__jsx-style-dynamic-selector{text-align:left;}.confirmations.__jsx-style-dynamic-selector{text-align:right;}.number.__jsx-style-dynamic-selector label.__jsx-style-dynamic-selector{display:block;font-family:${theme.fonts.secondary};font-size:0.6rem;-webkit-letter-spacing:0.05em;-moz-letter-spacing:0.05em;-ms-letter-spacing:0.05em;letter-spacing:0.05em;text-transform:uppercase;font-weight:normal;}.checkin-tag-display.__jsx-style-dynamic-selector{z-index:1;font-size:1.3em;}`));
|
|
@@ -4,35 +4,56 @@ declare const _default: ComponentMeta<React.FunctionComponent<{
|
|
|
4
4
|
checkinCount: number;
|
|
5
5
|
rsvp: number;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
+
leftLabel?: string | undefined;
|
|
8
|
+
rightLabel?: string | undefined;
|
|
7
9
|
}>>;
|
|
8
10
|
export default _default;
|
|
9
11
|
export declare const Basic: ComponentStory<React.FunctionComponent<{
|
|
10
12
|
checkinCount: number;
|
|
11
13
|
rsvp: number;
|
|
12
14
|
children?: React.ReactNode;
|
|
15
|
+
leftLabel?: string | undefined;
|
|
16
|
+
rightLabel?: string | undefined;
|
|
13
17
|
}>>;
|
|
14
18
|
export declare const WithoutTagName: ComponentStory<React.FunctionComponent<{
|
|
15
19
|
checkinCount: number;
|
|
16
20
|
rsvp: number;
|
|
17
21
|
children?: React.ReactNode;
|
|
22
|
+
leftLabel?: string | undefined;
|
|
23
|
+
rightLabel?: string | undefined;
|
|
18
24
|
}>>;
|
|
19
25
|
export declare const NoCheckins: ComponentStory<React.FunctionComponent<{
|
|
20
26
|
checkinCount: number;
|
|
21
27
|
rsvp: number;
|
|
22
28
|
children?: React.ReactNode;
|
|
29
|
+
leftLabel?: string | undefined;
|
|
30
|
+
rightLabel?: string | undefined;
|
|
23
31
|
}>>;
|
|
24
32
|
export declare const AllCheckinsComplete: ComponentStory<React.FunctionComponent<{
|
|
25
33
|
checkinCount: number;
|
|
26
34
|
rsvp: number;
|
|
27
35
|
children?: React.ReactNode;
|
|
36
|
+
leftLabel?: string | undefined;
|
|
37
|
+
rightLabel?: string | undefined;
|
|
28
38
|
}>>;
|
|
29
39
|
export declare const MoreCheckinsThanExpected: ComponentStory<React.FunctionComponent<{
|
|
30
40
|
checkinCount: number;
|
|
31
41
|
rsvp: number;
|
|
32
42
|
children?: React.ReactNode;
|
|
43
|
+
leftLabel?: string | undefined;
|
|
44
|
+
rightLabel?: string | undefined;
|
|
33
45
|
}>>;
|
|
34
46
|
export declare const NoRSVP: ComponentStory<React.FunctionComponent<{
|
|
35
47
|
checkinCount: number;
|
|
36
48
|
rsvp: number;
|
|
37
49
|
children?: React.ReactNode;
|
|
50
|
+
leftLabel?: string | undefined;
|
|
51
|
+
rightLabel?: string | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
export declare const CustomLabels: ComponentStory<React.FunctionComponent<{
|
|
54
|
+
checkinCount: number;
|
|
55
|
+
rsvp: number;
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
leftLabel?: string | undefined;
|
|
58
|
+
rightLabel?: string | undefined;
|
|
38
59
|
}>>;
|
|
@@ -39,4 +39,12 @@ NoRSVP.args = {
|
|
|
39
39
|
rsvp: 0,
|
|
40
40
|
checkinCount: 200,
|
|
41
41
|
children: 'Dinner'
|
|
42
|
+
};
|
|
43
|
+
export const CustomLabels = Template.bind({});
|
|
44
|
+
CustomLabels.args = {
|
|
45
|
+
rsvp: 200,
|
|
46
|
+
checkinCount: 125,
|
|
47
|
+
children: 'Dinner',
|
|
48
|
+
leftLabel: 'Present',
|
|
49
|
+
rightLabel: 'Guests'
|
|
42
50
|
};
|
package/dist/ui/guest-card.js
CHANGED
|
@@ -40,7 +40,7 @@ export const GuestCard = props => {
|
|
|
40
40
|
findMainGuest: props.findMainGuest,
|
|
41
41
|
formatName: props.formatName
|
|
42
42
|
}), /*#__PURE__*/React.createElement(CheckinCountIndicator, {
|
|
43
|
-
checkins: props.attendee.getCheckinsForTag(props.checkinTag).
|
|
43
|
+
checkins: props.attendee.getCheckinsForTag(props.checkinTag).getActiveCheckins(),
|
|
44
44
|
response: props.attendee.getResponseForTag(props.checkinTag),
|
|
45
45
|
rsvpCount: props.attendee.getRsvpCountForTag(props.checkinTag)
|
|
46
46
|
})), /*#__PURE__*/React.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-crew-berlin/enter-js-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "utils such as vaildation and other helpers to work with data from the enter app",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@storybook/react": "^6.5.15",
|
|
54
54
|
"@storybook/testing-library": "^0.0.13",
|
|
55
55
|
"@types/node": "^17.0.38",
|
|
56
|
-
"@types/uuid": "^8.3.4",
|
|
57
56
|
"@types/react": "^18.0.10",
|
|
58
57
|
"@types/react-dom": "^18.0.5",
|
|
58
|
+
"@types/uuid": "^8.3.4",
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
60
60
|
"@typescript-eslint/parser": "^5.27.0",
|
|
61
61
|
"eslint": "^8.16.0",
|