@licklist/design 0.71.5-dev.10 → 0.71.5-dev.3

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.
Files changed (23) hide show
  1. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts +1 -0
  2. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts.map +1 -1
  3. package/dist/events/edit-event-modal/hooks/useValidationOptions.js +6 -1
  4. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  5. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.js +0 -1
  6. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts +1 -2
  7. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
  8. package/dist/events/event-statistic-modal/EventStatisticModal.js +2 -2
  9. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts +1 -1
  10. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts.map +1 -1
  11. package/dist/events/event-statistic-modal/hooks/useTableData.js +2 -3
  12. package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
  13. package/dist/events/event-statistic-modal/utils/index.js +5 -4
  14. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
  15. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +3 -5
  16. package/package.json +3 -3
  17. package/src/events/edit-event-modal/hooks/useValidationOptions.tsx +5 -0
  18. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -6
  19. package/src/events/event-statistic-modal/EventStatisticModal.tsx +1 -3
  20. package/src/events/event-statistic-modal/hooks/useTableData.tsx +3 -5
  21. package/src/events/event-statistic-modal/utils/index.ts +13 -5
  22. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +8 -10
  23. package/yarn.lock +449 -536
@@ -1,6 +1,7 @@
1
1
  export declare const useValidationOptions: () => {
2
2
  start: {
3
3
  required: string;
4
+ validate: (value: any) => string | true;
4
5
  };
5
6
  end: {
6
7
  required: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useValidationOptions.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useValidationOptions.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;kBASrB,MAAM;;;kBAMN,MAAM;;;CAWjB,CAAA"}
1
+ {"version":3,"file":"useValidationOptions.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useValidationOptions.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;kBASrB,MAAM;;;;kBAWN,MAAM;;;CAWjB,CAAA"}
@@ -16,7 +16,12 @@ var useValidationOptions = function() {
16
16
  start: {
17
17
  required: t('Validation:fieldRequired', {
18
18
  attribute: t('start')
19
- })
19
+ }),
20
+ // TODO: uncomment when event splitting is implemented
21
+ // and extract into plugins
22
+ validate: function(value) {
23
+ return DateTime.fromISO(value).diffNow().toMillis() > 0 || t('Validation:fieldValidEventStart');
24
+ }
20
25
  },
21
26
  end: {
22
27
  required: t('Validation:fieldRequired', {
@@ -1 +1 @@
1
- {"version":3,"file":"EditRecurrentEventModal.d.ts","sourceRoot":"","sources":["../../../src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,cAAc,CAAA;AAC1C,eAAO,MAAM,8BAA8B,2BAA2B,CAAA;AACtE,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C,QAAA,MAAM,KAAK,+DAID,CAAA;AAEV,eAAO,MAAM,2BAA2B,cAAkB,CAAA;AAE1D,eAAO,MAAM,yBAAyB;;;;CAIrC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,kBAAkB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,MAAM,EAAE,6BAA6B,KAAK,IAAI,CAAA;CAC1D,CAAA;AAED,eAAO,MAAM,uBAAuB,mDAMjC,4BAA4B,4CAgF9B,CAAA"}
1
+ {"version":3,"file":"EditRecurrentEventModal.d.ts","sourceRoot":"","sources":["../../../src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,cAAc,CAAA;AAC1C,eAAO,MAAM,8BAA8B,2BAA2B,CAAA;AACtE,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C,QAAA,MAAM,KAAK,+DAID,CAAA;AAEV,eAAO,MAAM,2BAA2B,cAAkB,CAAA;AAE1D,eAAO,MAAM,yBAAyB;;;;CAIrC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,kBAAkB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,MAAM,EAAE,6BAA6B,KAAK,IAAI,CAAA;CAC1D,CAAA;AAED,eAAO,MAAM,uBAAuB,mDAMjC,4BAA4B,4CA2E9B,CAAA"}
@@ -51,7 +51,6 @@ var EditRecurrentEventModal = function(param) {
51
51
  /*#__PURE__*/ jsx(Button, {
52
52
  variant: "danger",
53
53
  className: "btn-sm rounded",
54
- disabled: disabled,
55
54
  onClick: onHide,
56
55
  children: /*#__PURE__*/ jsx(FaTimes, {
57
56
  size: 16
@@ -6,7 +6,6 @@ export type EventStatisticModalProps = {
6
6
  date?: Event['startAt'] | null;
7
7
  eventStatistic?: EventStatistic | null;
8
8
  title?: string;
9
- eventId?: string;
10
9
  };
11
- export declare const EventStatisticModal: ({ isOpen, setIsOpen, date, eventStatistic, title, eventId, }: EventStatisticModalProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const EventStatisticModal: ({ isOpen, setIsOpen, date, eventStatistic, title, }: EventStatisticModalProps) => import("react/jsx-runtime").JSX.Element;
12
11
  //# sourceMappingURL=EventStatisticModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventStatisticModal.d.ts","sourceRoot":"","sources":["../../../src/events/event-statistic-modal/EventStatisticModal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,yDAAyD,CAAA;AAK/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;IAC9B,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,mBAAmB,iEAO7B,wBAAwB,4CAiD1B,CAAA"}
1
+ {"version":3,"file":"EventStatisticModal.d.ts","sourceRoot":"","sources":["../../../src/events/event-statistic-modal/EventStatisticModal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,yDAAyD,CAAA;AAK/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;IAC9B,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,mBAAmB,wDAM7B,wBAAwB,4CAiD1B,CAAA"}
@@ -18,9 +18,9 @@ import '@tanstack/react-table';
18
18
  import { useTableData } from './hooks/useTableData.js';
19
19
 
20
20
  var EventStatisticModal = function(param) {
21
- var isOpen = param.isOpen, setIsOpen = param.setIsOpen, date = param.date, eventStatistic = param.eventStatistic, title = param.title, eventId = param.eventId;
21
+ var isOpen = param.isOpen, setIsOpen = param.setIsOpen, date = param.date, eventStatistic = param.eventStatistic, title = param.title;
22
22
  var t = useTranslation('Design').t;
23
- var data = useTableData(date, eventStatistic, eventId);
23
+ var data = useTableData(date, eventStatistic);
24
24
  var handleClose = function() {
25
25
  setIsOpen(false);
26
26
  };
@@ -1,5 +1,5 @@
1
1
  import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper';
2
2
  import { Event } from '@licklist/core/dist/DataMapper/Provider/EventDataMapper';
3
3
  import { StaticTableData } from '../../../table';
4
- export declare const useTableData: (date: Event["startAt"] | null, eventStatistic: EventStatistic | null, eventId: string) => StaticTableData[];
4
+ export declare const useTableData: (date: Event["startAt"] | null, eventStatistic: EventStatistic | null) => StaticTableData[];
5
5
  //# sourceMappingURL=useTableData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/hooks/useTableData.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,yDAAyD,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,YAAY,SACjB,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,kBACb,cAAc,GAAG,IAAI,WAC5B,MAAM,sBA8EhB,CAAA"}
1
+ {"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/hooks/useTableData.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,yDAAyD,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,YAAY,SACjB,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,kBACb,cAAc,GAAG,IAAI,sBA6EtC,CAAA"}
@@ -52,7 +52,7 @@ function _unsupported_iterable_to_array(o, minLen) {
52
52
  if (n === "Map" || n === "Set") return Array.from(n);
53
53
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
54
54
  }
55
- var useTableData = function(date, eventStatistic, eventId) {
55
+ var useTableData = function(date, eventStatistic) {
56
56
  var t = useTranslation('Design').t;
57
57
  var formatNumber = useIntl().formatNumber;
58
58
  var _useState = _sliced_to_array(useState([]), 2), tableRows = _useState[0], setTableRows = _useState[1];
@@ -70,7 +70,7 @@ var useTableData = function(date, eventStatistic, eventId) {
70
70
  }
71
71
  return t(key);
72
72
  };
73
- var transformStatisticToTableRows = function(date, statistic, eventId) {
73
+ var transformStatisticToTableRows = function(date, statistic) {
74
74
  if (!statistic) {
75
75
  return [];
76
76
  }
@@ -106,7 +106,6 @@ var useTableData = function(date, eventStatistic, eventId) {
106
106
  // eslint-disable-next-line react-hooks/exhaustive-deps
107
107
  }, [
108
108
  date,
109
- eventId,
110
109
  eventStatistic
111
110
  ]);
112
111
  return tableRows;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,sBA6G/B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,sBAqH/B,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { DateTime } from 'luxon';
2
2
  import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config';
3
- import { values, maxBy } from 'lodash';
3
+ import { values } from 'lodash';
4
4
 
5
5
  function _array_like_to_array(arr, len) {
6
6
  if (len == null || len > arr.length) len = arr.length;
@@ -45,10 +45,11 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
45
45
  return DateTime.fromFormat(date, DATE_TIME_FULL_FORMAT).toFormat(DATE_FORMAT) === summaryFormattedDate;
46
46
  })) !== null && _Object_keys_filter !== void 0 ? _Object_keys_filter : [];
47
47
  var summaryMap = new Map();
48
- var allProductsSummary = values(eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary).flat().flatMap(function(categorySummary) {
48
+ var maxTotalQuantity = values(eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary).flat().flatMap(function(categorySummary) {
49
49
  return categorySummary.productsSummary;
50
- });
51
- var maxTotalQuantity = maxBy(allProductsSummary, 'id').totalQuantity || 0;
50
+ }).reduce(function(acc, productSummary) {
51
+ return productSummary.totalQuantity > acc ? productSummary.totalQuantity : acc;
52
+ }, 0);
52
53
  summaryDays.map(function(day) {
53
54
  return eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary[day];
54
55
  }).flat().sort(function(prev, next) {
@@ -1 +1 @@
1
- {"version":3,"file":"useResizePageBody.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/page/components/PageBody/hooks/useResizePageBody.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;eAMnB,MAAM;gBACL,MAAM;;CAmPjB,CAAA"}
1
+ {"version":3,"file":"useResizePageBody.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/page/components/PageBody/hooks/useResizePageBody.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;eAMnB,MAAM;gBACL,MAAM;;CAiPjB,CAAA"}
@@ -73,11 +73,9 @@ var useResizePageBody = function() {
73
73
  behavior: 'smooth'
74
74
  });
75
75
  }
76
- if (width <= MOBILE_WIDTH && Boolean(CALENDAR_WRAPPER_HEIGHT)) {
77
- return {
78
- maxHeight: height - STANDARD_BODY_PADDING - rightBlockHeight - CALENDAR_WRAPPER_HEIGHT
79
- };
80
- }
76
+ if (width <= MOBILE_WIDTH) return {
77
+ maxHeight: height - STANDARD_BODY_PADDING - rightBlockHeight - CALENDAR_WRAPPER_HEIGHT
78
+ };
81
79
  return {
82
80
  maxHeight: height - STANDARD_BODY_PADDING - rightBlockHeight - STANDARD_HEADER_FOOTER_SIZE - CALENDAR_WRAPPER_HEIGHT
83
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.71.5-dev.10",
3
+ "version": "0.71.5-dev.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -42,7 +42,7 @@
42
42
  ]
43
43
  },
44
44
  "peerDependencies": {
45
- "@licklist/core": "0.31.2-dev.3",
45
+ "@licklist/core": "0.31.2-dev.2",
46
46
  "@licklist/eslint-config": "0.5.6",
47
47
  "@licklist/plugins": "0.35.0-dev.0",
48
48
  "lodash": "4.17.21",
@@ -61,7 +61,7 @@
61
61
  "@dnd-kit/utilities": "2.0.0",
62
62
  "@fortawesome/fontawesome-svg-core": "1.2.34",
63
63
  "@fortawesome/free-solid-svg-icons": "5.15.2",
64
- "@licklist/core": "0.31.2-dev.3",
64
+ "@licklist/core": "0.31.2-dev.2",
65
65
  "@licklist/eslint-config": "0.5.6",
66
66
  "@licklist/plugins": "0.35.0-dev.0",
67
67
  "@mantine/core": "6.0.22",
@@ -12,6 +12,11 @@ export const useValidationOptions = () => {
12
12
  required: t('Validation:fieldRequired', {
13
13
  attribute: t('start'),
14
14
  }) as string,
15
+ // TODO: uncomment when event splitting is implemented
16
+ // and extract into plugins
17
+ validate: (value) =>
18
+ DateTime.fromISO(value).diffNow().toMillis() > 0 ||
19
+ (t('Validation:fieldValidEventStart') as string),
15
20
  },
16
21
 
17
22
  end: {
@@ -61,12 +61,7 @@ export const EditRecurrentEventModal = ({
61
61
  <Form onSubmit={handleSubmit(onSubmit)} noValidate>
62
62
  <Modal.Header className='border-0'>
63
63
  <Modal.Title as='h6'>{title}</Modal.Title>
64
- <Button
65
- variant='danger'
66
- className='btn-sm rounded'
67
- disabled={disabled}
68
- onClick={onHide}
69
- >
64
+ <Button variant='danger' className='btn-sm rounded' onClick={onHide}>
70
65
  <FaTimes size={16} />
71
66
  </Button>
72
67
  </Modal.Header>
@@ -12,7 +12,6 @@ export type EventStatisticModalProps = {
12
12
  date?: Event['startAt'] | null
13
13
  eventStatistic?: EventStatistic | null
14
14
  title?: string
15
- eventId?: string
16
15
  }
17
16
 
18
17
  export const EventStatisticModal = ({
@@ -21,11 +20,10 @@ export const EventStatisticModal = ({
21
20
  date,
22
21
  eventStatistic,
23
22
  title,
24
- eventId,
25
23
  }: EventStatisticModalProps) => {
26
24
  const { t } = useTranslation('Design')
27
25
 
28
- const data = useTableData(date, eventStatistic, eventId )
26
+ const data = useTableData(date, eventStatistic)
29
27
  const handleClose = () => {
30
28
  setIsOpen(false)
31
29
  }
@@ -11,7 +11,6 @@ import { StaticTableData } from '../../../table'
11
11
  export const useTableData = (
12
12
  date: Event['startAt'] | null,
13
13
  eventStatistic: EventStatistic | null,
14
- eventId: string
15
14
  ) => {
16
15
  const { t } = useTranslation('Design')
17
16
  const { formatNumber } = useIntl()
@@ -34,7 +33,6 @@ export const useTableData = (
34
33
  const transformStatisticToTableRows = (
35
34
  date: Event['startAt'],
36
35
  statistic: EventStatistic | null,
37
- eventId: string
38
36
  ) => {
39
37
  if (!statistic) {
40
38
  return []
@@ -42,7 +40,7 @@ export const useTableData = (
42
40
 
43
41
  const tableDataRows: StaticTableData[] = []
44
42
 
45
- convertEventStatisticToTableData(date, statistic, eventId).forEach(
43
+ convertEventStatisticToTableData(date, statistic).forEach(
46
44
  ({ name, quantity, total, isBold, isHeader, key }) => {
47
45
  const formattedTotal = !Object.keys(TRANSLATION_KEYS).includes(
48
46
  String(total),
@@ -84,9 +82,9 @@ export const useTableData = (
84
82
  }
85
83
 
86
84
  useEffect(() => {
87
- setTableRows(transformStatisticToTableRows(date, eventStatistic, eventId))
85
+ setTableRows(transformStatisticToTableRows(date, eventStatistic))
88
86
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
- }, [date, eventId, eventStatistic])
87
+ }, [date, eventStatistic])
90
88
 
91
89
  return tableRows
92
90
  }
@@ -1,7 +1,7 @@
1
1
  import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper'
2
2
  import { DateTime } from 'luxon'
3
3
  import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config'
4
- import { values, maxBy } from 'lodash'
4
+ import { values } from 'lodash'
5
5
 
6
6
  export const TRANSLATION_KEYS = {
7
7
  shortQuantity: 'shortQuantity',
@@ -36,6 +36,7 @@ export const convertEventStatisticToTableData = (
36
36
  const summaryFormattedDate = DateTime.fromISO(date)
37
37
  .toUTC()
38
38
  .toFormat(DATE_FORMAT)
39
+
39
40
  const summaryDays =
40
41
  Object.keys(eventStatistic?.productCategorySummary)?.filter(
41
42
  (date) =>
@@ -45,11 +46,15 @@ export const convertEventStatisticToTableData = (
45
46
  ) ?? []
46
47
 
47
48
  const summaryMap = new Map<string, TableDataRecord>()
48
- const allProductsSummary = values(eventStatistic?.productCategorySummary)
49
+
50
+ const maxTotalQuantity = values(eventStatistic?.productCategorySummary)
49
51
  .flat()
50
52
  .flatMap((categorySummary) => categorySummary.productsSummary)
51
-
52
- const maxTotalQuantity = maxBy(allProductsSummary, 'id').totalQuantity || 0
53
+ .reduce(
54
+ (acc, productSummary) =>
55
+ productSummary.totalQuantity > acc ? productSummary.totalQuantity : acc,
56
+ 0,
57
+ )
53
58
 
54
59
  summaryDays
55
60
  .map((day) => eventStatistic?.productCategorySummary[day])
@@ -64,7 +69,9 @@ export const convertEventStatisticToTableData = (
64
69
  .forEach(
65
70
  ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
66
71
  let quantity = 0
72
+
67
73
  totalAmount += totalPerCategory || 0
74
+
68
75
  if (!summaryMap.has(`${categoryName}`)) {
69
76
  summaryMap.set(`${categoryName}`, {
70
77
  name: categoryName,
@@ -106,13 +113,13 @@ export const convertEventStatisticToTableData = (
106
113
  })
107
114
  },
108
115
  )
116
+
109
117
  const prevTotalPerCategory = summaryMap.get(
110
118
  `${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
111
119
  ) ?? {
112
120
  quantity: 0,
113
121
  total: 0,
114
122
  }
115
-
116
123
  summaryMap.set(`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`, {
117
124
  name: TRANSLATION_KEYS.totalPerCategory,
118
125
  key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
@@ -120,6 +127,7 @@ export const convertEventStatisticToTableData = (
120
127
  total: String(Number(prevTotalPerCategory.total) + totalPerCategory),
121
128
  isBold: true,
122
129
  })
130
+
123
131
  totalQuantity += quantity
124
132
  },
125
133
  )
@@ -61,16 +61,14 @@ export const useResizePageBody = () => {
61
61
  })
62
62
  }
63
63
 
64
- if (width <= MOBILE_WIDTH && Boolean(CALENDAR_WRAPPER_HEIGHT)) {
65
- return {
66
- maxHeight:
67
- height -
68
- STANDARD_BODY_PADDING -
69
- rightBlockHeight -
70
- CALENDAR_WRAPPER_HEIGHT,
71
- }
72
-
73
- }
64
+ if (width <= MOBILE_WIDTH) return {
65
+ maxHeight:
66
+ height -
67
+ STANDARD_BODY_PADDING -
68
+ rightBlockHeight -
69
+ CALENDAR_WRAPPER_HEIGHT,
70
+ }
71
+
74
72
  return {
75
73
  maxHeight:
76
74
  height -