@licklist/design 0.44.530 → 0.44.533
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/events/event-card/EventCard.d.ts.map +1 -1
- package/dist/events/event-card/EventCard.js +1 -1
- package/dist/events/event-card/utils.d.ts +1 -0
- package/dist/events/event-card/utils.d.ts.map +1 -1
- package/dist/events/event-card/utils.js +1 -1
- package/dist/sales/source-of-sales/SourceOfSalesChart.d.ts.map +1 -1
- package/dist/sales/source-of-sales/SourceOfSalesChart.js +1 -1
- package/dist/styles/events/EventCard.scss +10 -3
- package/package.json +1 -1
- package/src/events/event-card/EventCard.tsx +6 -2
- package/src/events/event-card/utils.ts +2 -0
- package/src/sales/source-of-sales/SourceOfSalesChart.tsx +31 -28
- package/src/styles/events/EventCard.scss +10 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAElG,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAElG,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAS5C,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,aAAoB,EACpB,WAAW,EACX,cAAc,EACd,OAAO,EACP,aAAa,GACd,EAAE,cAAc,eAiIhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("@licklist/core/dist/Config"),l=require("react-i18next"),c=require("react-bootstrap"),i=require("../../static/Icon.js"),s=e(require("clsx")),m=require("react-intl"),o=require("../../tiptap-editor/TipTapEditor.js"),u=require("./utils.js"),d=require("../../assets/dashboard/chartBar.svg.js");exports.EventCard=function(e){var
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("@licklist/core/dist/Config"),l=require("react-i18next"),c=require("react-bootstrap"),i=require("../../static/Icon.js"),s=e(require("clsx")),m=require("react-intl"),o=require("../../tiptap-editor/TipTapEditor.js"),u=require("./utils.js"),d=require("../../assets/dashboard/chartBar.svg.js");exports.EventCard=function(e){var E=e.name,v=e.description,p=e.date,y=e.imageUrl,f=e.sales,b=e.onPreview,N=e.onEdit,C=e.onCopy,k=e.onRemove,x=e.hasPermission,g=void 0===x||x,q=e.onStatistic,w=e.eventStatistic,h=e.titleId,j=e.descriptionId,I=l.useTranslation("Design").t,T=m.useIntl(),P=T.formatNumber,_=T.formatDate,B=u.getStatisticInfo(w,p),S=B.totalViews,D=t.__rest(B,["totalViews"]),M=a.useMemo((function(){return u.formatContent(v,u.EVENT_DESCRIPTION_SIZE)}),[v]);return n.createElement(c.Card,{className:"d-flex flex-column event-card h-100"},n.createElement("div",{className:s("event-card-image-container",!y&&"no-image")},y&&n.createElement(c.Card.Img,{variant:"top",src:y}),n.createElement(c.Badge,{className:"event-card-date",as:"time",dateTime:p,variant:"primary"},_(new Date(p),{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"numeric"}))),n.createElement(c.Card.Body,null,n.createElement(c.Card.Title,{id:h},E),n.createElement("div",{className:"flex-grow-1"},n.createElement(o.TipTapEditor,{viewMode:!0,disabled:!0,className:s("event-description",!y&&"no-image"),content:M,id:j}),n.createElement("div",{className:"mt-2 ml-2"},Object.keys(D).map((function(e){return n.createElement("div",{className:"event-card-sale",key:e},n.createElement("span",{className:"event-card-sale-name"},I(e),":"," ","totalAmount"===e?P(D[e],{style:"currency",currency:r.Currency.GBP}):D[e]))}))),f&&f.map((function(e){return n.createElement("div",{className:"event-card-sale",key:e.id},n.createElement("div",{className:"event-card-sale-text"},n.createElement("span",{className:"event-card-sale-name"},e.name)," ",n.createElement("span",{className:"event-card-sale-quantity"},[e.current,e.max].map((function(e){return P(e)})).join(" / "))),n.createElement(c.ProgressBar,{now:e.current,max:e.max}))})))),n.createElement(c.Card.Footer,null,n.createElement("div",{className:"d-flex w-100 justify-content-between"},n.createElement("div",{className:"d-flex"},n.createElement("button",{type:"button",className:"event-card-link-button ml-3 mr-4",onClick:q},n.createElement(d.ReactComponent,null)),n.createElement("div",{className:"event-card-views"},n.createElement(i.default,{type:"eye"}),n.createElement("span",null,P(S)))),n.createElement("div",null,n.createElement("button",{type:"button",className:"event-card-link-button",onClick:b},n.createElement(i.default,{type:"external-link-alt"})),g&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"event-card-link-button",onClick:N},n.createElement(i.default,{type:"edit"})),n.createElement("button",{type:"button",className:"event-card-link-button",onClick:C},n.createElement(i.default,{type:"copy"})),n.createElement("button",{type:"button",className:"event-card-link-button",onClick:k},n.createElement(i.default,{type:"trash-alt"})))))))};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventStatistic } from "@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper";
|
|
2
2
|
export declare function formatContent(content: any, maxSymbols: any): any;
|
|
3
|
+
export declare const EVENT_DESCRIPTION_SIZE = 340;
|
|
3
4
|
export declare const getStatisticInfo: (eventStatistic: EventStatistic | null, date: string) => {
|
|
4
5
|
totalViews: number;
|
|
5
6
|
totalSold: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAGlG,wBAAgB,aAAa,CAAC,OAAO,KAAA,EAAE,UAAU,KAAA,OAIhD;AAED,eAAO,MAAM,gBAAgB,mBACX,cAAc,GAAG,IAAI,QAC/B,MAAM;;;;CA6Bb,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAGlG,wBAAgB,aAAa,CAAC,OAAO,KAAA,EAAE,UAAU,KAAA,OAIhD;AAED,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,gBAAgB,mBACX,cAAc,GAAG,IAAI,QAC/B,MAAM;;;;CA6Bb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon");exports.formatContent=function(t,o){return t?t.length>o?"".concat(t.slice(0,o),"..."):t:""},exports.getStatisticInfo=function(r,e){var i,a,l,n,u=0,c=0;if(!r)return{totalViews:0,totalSold:0,totalAmount:0};var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon");exports.EVENT_DESCRIPTION_SIZE=340,exports.formatContent=function(t,o){return t?t.length>o?"".concat(t.slice(0,o),"..."):t:""},exports.getStatisticInfo=function(r,e){var i,a,l,n,u=0,c=0;if(!r)return{totalViews:0,totalSold:0,totalAmount:0};var s=o.DateTime.fromISO(e).toUTC().toFormat(t.DATE_FORMAT);n=(null===(i=r.views[s])||void 0===i?void 0:i.pageViews)||0;var d=o.DateTime.fromISO(e).toUTC().toFormat(t.DATE_TIME_FULL_FORMAT);return null===(l=null===(a=null==r?void 0:r.productCategorySummary)||void 0===a?void 0:a[d])||void 0===l||l.forEach((function(t){var o=t.totalPerCategory,r=t.productsSummary,e=void 0===r?[]:r;c+=o||0,null==e||e.forEach((function(t){var o=t.productsSold;u+=o}))})),{totalViews:n,totalSold:u,totalAmount:c}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceOfSalesChart.d.ts","sourceRoot":"","sources":["../../../src/sales/source-of-sales/SourceOfSalesChart.tsx"],"names":[],"mappings":";AAMA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAcD,iBAAS,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"SourceOfSalesChart.d.ts","sourceRoot":"","sources":["../../../src/sales/source-of-sales/SourceOfSalesChart.tsx"],"names":[],"mappings":";AAMA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAcD,iBAAS,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,kBAAkB,eA4FvD;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("tslib"),t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),c=require("react-intl"),l=require("recharts"),o="affiliates";exports.SourceOfSalesChart=function(e){var i=e.data,s=t.useMemo((function(){return a.__spreadArray(a.__spreadArray([],a.__read(i),!1),[{source:2,name:o}],!1)}),[i]),u=n.useTranslation("Design").t,d=c.useIntl().formatNumber,m=a.__read(t.useState(44),2),p=m[0],f=m[1];return t.useEffect((function(){s.length>0&&f(44-22*s.length)}),[s]),r.createElement("div",{className:"source-of-sales"},r.createElement("div",{className:"source-of-sales__header"},u("sourceOfSales")),r.createElement("div",{className:"source-of-sales__pie-chart"}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("tslib"),t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),c=require("react-intl"),l=require("recharts"),o="affiliates";exports.SourceOfSalesChart=function(e){var i=e.data,s=t.useMemo((function(){return a.__spreadArray(a.__spreadArray([],a.__read(i),!1),[{source:2,name:o}],!1)}),[i.length]),u=n.useTranslation("Design").t,d=c.useIntl().formatNumber,m=a.__read(t.useState(44),2),p=m[0],f=m[1];return t.useEffect((function(){s.length>0&&f(44-22*s.length)}),[s]),r.createElement("div",{className:"source-of-sales"},r.createElement("div",{className:"source-of-sales__header"},u("sourceOfSales")),r.createElement("div",{className:"source-of-sales__pie-chart"},!!i.length&&r.createElement(l.ResponsiveContainer,{debounce:100,width:"100%",height:"100%"},r.createElement(l.PieChart,null,r.createElement(l.Legend,{iconType:"circle",wrapperStyle:{left:170,top:20},layout:"vertical",verticalAlign:"top",content:function(e){var a=e.payload;return r.createElement(r.Fragment,null,a.map((function(e,a){var t,n,c,l=(null===(t=e.payload)||void 0===t?void 0:t.name)===o?"":" - ".concat(d(null===(n=e.payload)||void 0===n?void 0:n.percent,{style:"percent"})),i="iframe"===e.payload.name?"website":e.payload.name;return r.createElement("div",{className:"legend",key:"item-".concat(e.payload.source)},r.createElement("div",{className:"bullet-point colors-".concat((null===(c=e.payload)||void 0===c?void 0:c.name)===o?"pink":a%4)}),"".concat(u("".concat(i)),"\n ").concat(l))})))}}),r.createElement(l.Pie,{data:s,cx:80,cy:p,innerRadius:40,outerRadius:48,dataKey:"percentage"},i.map((function(e,a){var t=e.source;return r.createElement(l.Cell,{className:"colors-".concat(a%4),key:"cell-".concat(t)})})))))))};
|
|
@@ -34,7 +34,7 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
34
34
|
transition: ease-in 0.25s;
|
|
35
35
|
border-radius: $event-card-border-radius;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
>*+* {
|
|
38
38
|
margin-top: $event-card-contents-gutter;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,9 +43,16 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
43
43
|
|
|
44
44
|
.event-description {
|
|
45
45
|
min-height: 8rem;
|
|
46
|
+
max-height: 21rem;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
|
|
49
|
+
&:last-child {
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
}
|
|
46
52
|
|
|
47
53
|
&.no-image {
|
|
48
54
|
min-height: 13.75rem;
|
|
55
|
+
max-height: 22rem;
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
58
|
}
|
|
@@ -75,7 +82,7 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
&:hover {
|
|
78
|
-
box-shadow: 0px 0px 1rem 0px rgb(0 0 0 / 20%);
|
|
85
|
+
box-shadow: 0px 0px 1rem 0px rgb(0 0 0 / 20%);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
@@ -168,4 +175,4 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
168
175
|
color: #504f4f;
|
|
169
176
|
width: 1.7rem;
|
|
170
177
|
}
|
|
171
|
-
}
|
|
178
|
+
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,11 @@ import { EventStatistic } from "@licklist/core/dist/DataMapper/Provider/EventSta
|
|
|
9
9
|
import Icon from "../../static/Icon";
|
|
10
10
|
import { Sale } from "../../types/bookings";
|
|
11
11
|
import { TipTapEditor } from "../../tiptap-editor/TipTapEditor";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
EVENT_DESCRIPTION_SIZE,
|
|
14
|
+
formatContent,
|
|
15
|
+
getStatisticInfo,
|
|
16
|
+
} from "./utils";
|
|
13
17
|
import { ReactComponent as ChartBarIcon } from "../../assets/dashboard/chartBar.svg";
|
|
14
18
|
|
|
15
19
|
export interface EventCardProps extends HasPermissionProp {
|
|
@@ -48,7 +52,7 @@ export function EventCard({
|
|
|
48
52
|
const { formatNumber, formatDate } = useIntl();
|
|
49
53
|
const { totalViews, ...statistics } = getStatisticInfo(eventStatistic, date);
|
|
50
54
|
const memoedContent = useMemo(
|
|
51
|
-
() => formatContent(description,
|
|
55
|
+
() => formatContent(description, EVENT_DESCRIPTION_SIZE),
|
|
52
56
|
[description]
|
|
53
57
|
);
|
|
54
58
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState, useMemo, useEffect } from "react";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
|
|
@@ -35,7 +35,8 @@ function SourceOfSalesChart({ data }: SourceOfSalesProps) {
|
|
|
35
35
|
name: AFFILIATES,
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
|
-
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
[data.length]
|
|
39
40
|
);
|
|
40
41
|
const { t } = useTranslation("Design");
|
|
41
42
|
const { formatNumber } = useIntl();
|
|
@@ -86,32 +87,34 @@ function SourceOfSalesChart({ data }: SourceOfSalesProps) {
|
|
|
86
87
|
<div className="source-of-sales">
|
|
87
88
|
<div className="source-of-sales__header">{t("sourceOfSales")}</div>
|
|
88
89
|
<div className="source-of-sales__pie-chart">
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
{!!data.length && (
|
|
91
|
+
<ResponsiveContainer debounce={100} width="100%" height="100%">
|
|
92
|
+
<PieChart>
|
|
93
|
+
<Legend
|
|
94
|
+
iconType="circle"
|
|
95
|
+
wrapperStyle={{ left: 170, top: 20 }}
|
|
96
|
+
layout="vertical"
|
|
97
|
+
verticalAlign="top"
|
|
98
|
+
content={legendRenderer}
|
|
99
|
+
/>
|
|
100
|
+
<Pie
|
|
101
|
+
data={extendedData}
|
|
102
|
+
cx={80}
|
|
103
|
+
cy={defaultCYPosition}
|
|
104
|
+
innerRadius={40}
|
|
105
|
+
outerRadius={48}
|
|
106
|
+
dataKey="percentage"
|
|
107
|
+
>
|
|
108
|
+
{data.map(({ source }: PieChartData, index) => (
|
|
109
|
+
<Cell
|
|
110
|
+
className={`colors-${index % 4}`}
|
|
111
|
+
key={`cell-${source}`}
|
|
112
|
+
/>
|
|
113
|
+
))}
|
|
114
|
+
</Pie>
|
|
115
|
+
</PieChart>
|
|
116
|
+
</ResponsiveContainer>
|
|
117
|
+
)}
|
|
115
118
|
</div>
|
|
116
119
|
</div>
|
|
117
120
|
);
|
|
@@ -34,7 +34,7 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
34
34
|
transition: ease-in 0.25s;
|
|
35
35
|
border-radius: $event-card-border-radius;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
>*+* {
|
|
38
38
|
margin-top: $event-card-contents-gutter;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,9 +43,16 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
43
43
|
|
|
44
44
|
.event-description {
|
|
45
45
|
min-height: 8rem;
|
|
46
|
+
max-height: 21rem;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
|
|
49
|
+
&:last-child {
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
}
|
|
46
52
|
|
|
47
53
|
&.no-image {
|
|
48
54
|
min-height: 13.75rem;
|
|
55
|
+
max-height: 22rem;
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
58
|
}
|
|
@@ -75,7 +82,7 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
&:hover {
|
|
78
|
-
box-shadow: 0px 0px 1rem 0px rgb(0 0 0 / 20%);
|
|
85
|
+
box-shadow: 0px 0px 1rem 0px rgb(0 0 0 / 20%);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
@@ -168,4 +175,4 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
168
175
|
color: #504f4f;
|
|
169
176
|
width: 1.7rem;
|
|
170
177
|
}
|
|
171
|
-
}
|
|
178
|
+
}
|