@licklist/design 0.78.4-dev.1 → 0.78.4-dev.2
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.
|
@@ -17,9 +17,8 @@ export interface EventCardProps extends HasPermissionProp {
|
|
|
17
17
|
eventMetadata?: EventMetadata | null;
|
|
18
18
|
onStatistic: () => void;
|
|
19
19
|
titleId?: string;
|
|
20
|
-
descriptionId?: string;
|
|
21
20
|
productSetName?: string;
|
|
22
21
|
eventID?: string;
|
|
23
22
|
}
|
|
24
|
-
export declare function EventCard({ name,
|
|
23
|
+
export declare function EventCard({ name, date, imageUrl, sales, onPreview, onEdit, onCopy, eventMetadata, onRemove, onOpenQrCode, hasPermission, productSetName, onStatistic, eventStatistic, titleId, eventID, }: EventCardProps): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
//# sourceMappingURL=EventCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAA;AAS1F,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAI3C,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;IACd,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACtC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACpC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,aAAoB,EACpB,cAAc,EACd,WAAW,EACX,cAAc,EACd,OAAO,EACP,OAAO,GACR,EAAE,cAAc,2CAsKhB"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
import { Card, Badge, ProgressBar, OverlayTrigger, Popover } from 'react-bootstrap';
|
|
4
3
|
import { useIntl } from 'react-intl';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import * as Config from '@licklist/core/dist/Config';
|
|
8
7
|
import { FaEye, FaQrcode, FaExternalLinkAlt, FaEdit, FaCopy, FaTrashAlt } from 'react-icons/fa';
|
|
9
|
-
import { getStatisticInfo
|
|
8
|
+
import { getStatisticInfo } from './utils.js';
|
|
10
9
|
import { ReactComponent as SvgChartBar } from '../../assets/dashboard/chartBar.svg.js';
|
|
11
10
|
|
|
12
11
|
function _object_without_properties(source, excluded) {
|
|
@@ -37,21 +36,16 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
37
36
|
return target;
|
|
38
37
|
}
|
|
39
38
|
function EventCard(param) {
|
|
40
|
-
var name = param.name,
|
|
39
|
+
var name = param.name, date = param.date, imageUrl = param.imageUrl, sales = param.sales, onPreview = param.onPreview, onEdit = param.onEdit, onCopy = param.onCopy, eventMetadata = param.eventMetadata, onRemove = param.onRemove, onOpenQrCode = param.onOpenQrCode, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, productSetName = param.productSetName, onStatistic = param.onStatistic, eventStatistic = param.eventStatistic, titleId = param.titleId, eventID = param.eventID;
|
|
41
40
|
var t = useTranslation('Design').t;
|
|
42
41
|
var _useIntl = useIntl(), formatNumber = _useIntl.formatNumber, formatDate = _useIntl.formatDate;
|
|
43
42
|
var _getStatisticInfo = getStatisticInfo(eventStatistic, date), totalViews = _getStatisticInfo.totalViews, statistics = _object_without_properties(_getStatisticInfo, [
|
|
44
43
|
"totalViews"
|
|
45
44
|
]);
|
|
46
|
-
var duplicatedInfo = (eventMetadata === null || eventMetadata === void 0 ? void 0 : eventMetadata.
|
|
45
|
+
var duplicatedInfo = (eventMetadata === null || eventMetadata === void 0 ? void 0 : eventMetadata.duplicatedFromId) ? t('Design:duplicatedInfo', {
|
|
47
46
|
ID: eventMetadata === null || eventMetadata === void 0 ? void 0 : eventMetadata.duplicatedFromId,
|
|
48
47
|
name: eventMetadata === null || eventMetadata === void 0 ? void 0 : eventMetadata.editorName
|
|
49
48
|
}) : null;
|
|
50
|
-
useMemo(function() {
|
|
51
|
-
return formatContent(description, EVENT_DESCRIPTION_SIZE);
|
|
52
|
-
}, [
|
|
53
|
-
description
|
|
54
|
-
]);
|
|
55
49
|
return /*#__PURE__*/ jsxs(Card, {
|
|
56
50
|
className: "d-flex flex-column event-card h-100",
|
|
57
51
|
children: [
|
|
@@ -128,7 +122,7 @@ function EventCard(param) {
|
|
|
128
122
|
}, key);
|
|
129
123
|
})
|
|
130
124
|
}),
|
|
131
|
-
sales
|
|
125
|
+
sales === null || sales === void 0 ? void 0 : sales.map(function(sale) {
|
|
132
126
|
return /*#__PURE__*/ jsxs("div", {
|
|
133
127
|
className: "event-card-sale",
|
|
134
128
|
children: [
|
package/package.json
CHANGED
|
@@ -69,16 +69,13 @@ export const Default: Story<EventCardProps> = () => {
|
|
|
69
69
|
console.log('onStatistic')
|
|
70
70
|
}}
|
|
71
71
|
titleId='titleId'
|
|
72
|
-
descriptionId='descriptionId'
|
|
73
72
|
/>
|
|
74
73
|
</div>
|
|
75
74
|
)
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
export const Skeleton: Story<EventCardProps> = () =>
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
84
|
-
}
|
|
77
|
+
export const Skeleton: Story<EventCardProps> = () => (
|
|
78
|
+
<div style={{ maxWidth: '34rem' }}>
|
|
79
|
+
<EventCardSkeleton />
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
1
|
import {
|
|
3
2
|
Badge,
|
|
4
3
|
Card,
|
|
@@ -22,12 +21,7 @@ import {
|
|
|
22
21
|
FaQrcode,
|
|
23
22
|
} from 'react-icons/fa'
|
|
24
23
|
import { Sale } from '../../types/bookings'
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
EVENT_DESCRIPTION_SIZE,
|
|
28
|
-
formatContent,
|
|
29
|
-
getStatisticInfo,
|
|
30
|
-
} from './utils'
|
|
24
|
+
import { getStatisticInfo } from './utils'
|
|
31
25
|
import { ReactComponent as ChartBarIcon } from '../../assets/dashboard/chartBar.svg'
|
|
32
26
|
|
|
33
27
|
export interface EventCardProps extends HasPermissionProp {
|
|
@@ -45,14 +39,12 @@ export interface EventCardProps extends HasPermissionProp {
|
|
|
45
39
|
eventMetadata?: EventMetadata | null
|
|
46
40
|
onStatistic: () => void
|
|
47
41
|
titleId?: string
|
|
48
|
-
descriptionId?: string
|
|
49
42
|
productSetName?: string
|
|
50
43
|
eventID?: string
|
|
51
44
|
}
|
|
52
45
|
|
|
53
46
|
export function EventCard({
|
|
54
47
|
name,
|
|
55
|
-
description,
|
|
56
48
|
date,
|
|
57
49
|
imageUrl,
|
|
58
50
|
sales,
|
|
@@ -67,25 +59,18 @@ export function EventCard({
|
|
|
67
59
|
onStatistic,
|
|
68
60
|
eventStatistic,
|
|
69
61
|
titleId,
|
|
70
|
-
descriptionId,
|
|
71
62
|
eventID,
|
|
72
63
|
}: EventCardProps) {
|
|
73
64
|
const { t } = useTranslation('Design')
|
|
74
65
|
const { formatNumber, formatDate } = useIntl()
|
|
75
66
|
const { totalViews, ...statistics } = getStatisticInfo(eventStatistic, date)
|
|
76
67
|
|
|
77
|
-
const duplicatedInfo =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
: null
|
|
84
|
-
|
|
85
|
-
const memoedContent = useMemo(
|
|
86
|
-
() => formatContent(description, EVENT_DESCRIPTION_SIZE),
|
|
87
|
-
[description],
|
|
88
|
-
)
|
|
68
|
+
const duplicatedInfo = eventMetadata?.duplicatedFromId
|
|
69
|
+
? t('Design:duplicatedInfo', {
|
|
70
|
+
ID: eventMetadata?.duplicatedFromId,
|
|
71
|
+
name: eventMetadata?.editorName,
|
|
72
|
+
})
|
|
73
|
+
: null
|
|
89
74
|
|
|
90
75
|
return (
|
|
91
76
|
<Card className='d-flex flex-column event-card h-100'>
|
|
@@ -119,13 +104,15 @@ export function EventCard({
|
|
|
119
104
|
) : (
|
|
120
105
|
name
|
|
121
106
|
)}
|
|
122
|
-
{duplicatedInfo &&
|
|
107
|
+
{duplicatedInfo && (
|
|
108
|
+
<div className='mt-2 ml-2'>
|
|
123
109
|
<div className='event-card-sale'>
|
|
124
110
|
<span className='event-card-sale-name text-success'>
|
|
125
111
|
{duplicatedInfo}
|
|
126
112
|
</span>
|
|
127
113
|
</div>
|
|
128
|
-
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
129
116
|
</Card.Title>
|
|
130
117
|
<div className='flex-grow-1'>
|
|
131
118
|
<div className='mt-2 ml-2'>
|
|
@@ -144,23 +131,23 @@ export function EventCard({
|
|
|
144
131
|
))}
|
|
145
132
|
</div>
|
|
146
133
|
|
|
147
|
-
{sales
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
</span>
|
|
158
|
-
</div>
|
|
159
|
-
<ProgressBar now={sale.current} max={sale.max} />
|
|
134
|
+
{sales?.map((sale) => (
|
|
135
|
+
<div className='event-card-sale' key={sale.id}>
|
|
136
|
+
{/* TODO: make it an i18n message instead */}
|
|
137
|
+
<div className='event-card-sale-text'>
|
|
138
|
+
<span className='event-card-sale-name'>{sale.name}</span>{' '}
|
|
139
|
+
<span className='event-card-sale-quantity'>
|
|
140
|
+
{[sale.current, sale.max]
|
|
141
|
+
.map((value) => formatNumber(value))
|
|
142
|
+
.join(' / ')}
|
|
143
|
+
</span>
|
|
160
144
|
</div>
|
|
161
|
-
|
|
145
|
+
<ProgressBar now={sale.current} max={sale.max} />
|
|
146
|
+
</div>
|
|
147
|
+
))}
|
|
162
148
|
</div>
|
|
163
149
|
</Card.Body>
|
|
150
|
+
|
|
164
151
|
<Card.Footer className='flex-column'>
|
|
165
152
|
{productSetName && (
|
|
166
153
|
<OverlayTrigger
|
|
@@ -190,7 +177,6 @@ export function EventCard({
|
|
|
190
177
|
</button>
|
|
191
178
|
<div className='event-card-views'>
|
|
192
179
|
<FaEye />
|
|
193
|
-
|
|
194
180
|
<span>{formatNumber(totalViews)}</span>
|
|
195
181
|
</div>
|
|
196
182
|
</div>
|
|
@@ -209,6 +195,7 @@ export function EventCard({
|
|
|
209
195
|
>
|
|
210
196
|
<FaExternalLinkAlt />
|
|
211
197
|
</button>
|
|
198
|
+
|
|
212
199
|
{hasPermission && (
|
|
213
200
|
<>
|
|
214
201
|
<button
|