@licklist/design 0.44.541 → 0.44.543

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 (74) hide show
  1. package/dist/availability-indicator/AvailabilityIndicator.d.ts +5 -4
  2. package/dist/availability-indicator/AvailabilityIndicator.d.ts.map +1 -1
  3. package/dist/availability-indicator/AvailabilityIndicator.js +1 -1
  4. package/dist/calendar/Calendar.d.ts +2 -4
  5. package/dist/calendar/Calendar.d.ts.map +1 -1
  6. package/dist/date-time-button/DateTimeButton.d.ts +4 -5
  7. package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
  8. package/dist/date-time-button/DateTimeButton.js +1 -1
  9. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
  11. package/dist/iframe/activity-card/ActivityCard.d.ts +1 -3
  12. package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
  13. package/dist/iframe/activity-card/ActivityCard.js +1 -1
  14. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +3 -1
  15. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  16. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -1
  17. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  18. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  19. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +5 -1
  20. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  21. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  22. package/dist/product-set/control/ProductSetControl.d.ts +4 -2
  23. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  24. package/dist/product-set/control/ProductSetControl.js +1 -1
  25. package/dist/product-set/control/ProductSetRecurrenceControl.d.ts +2 -1
  26. package/dist/product-set/control/ProductSetRecurrenceControl.d.ts.map +1 -1
  27. package/dist/product-set/control/ProductSetRecurrenceControl.js +1 -1
  28. package/dist/product-set/form/ProductSetForm.d.ts +3 -1
  29. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  30. package/dist/product-set/form/ProductSetForm.js +1 -1
  31. package/dist/product-set/utils/index.d.ts +10 -0
  32. package/dist/product-set/utils/index.d.ts.map +1 -1
  33. package/dist/product-set/utils/index.js +1 -1
  34. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  35. package/dist/sales/payment-form/SalePaymentForm.js +1 -1
  36. package/dist/styles/activity-card/GridActivitiesCard.scss +0 -8
  37. package/dist/styles/form/CustomCheckbox.scss +1 -0
  38. package/dist/styles/zones/ZoneForm.scss +3 -0
  39. package/dist/zone/form/ZoneForm.d.ts +1 -1
  40. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  41. package/dist/zone/form/ZoneForm.js +1 -1
  42. package/dist/zone/form/components/AvailableTimesControl.d.ts +2 -0
  43. package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
  44. package/dist/zone/form/components/AvailableTimesControl.js +1 -1
  45. package/dist/zone/form/components/ZoneControl.d.ts +1 -1
  46. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  47. package/dist/zone/form/components/ZoneControl.js +1 -1
  48. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +1 -1
  49. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  50. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  51. package/package.json +1 -1
  52. package/src/availability-indicator/AvailabilityIndicator.tsx +41 -33
  53. package/src/calendar/Calendar.tsx +2 -3
  54. package/src/date-time-button/DateTimeButton.tsx +11 -6
  55. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.stories.tsx +0 -3
  56. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  57. package/src/iframe/activity-card/ActivityCard.stories.tsx +27 -51
  58. package/src/iframe/activity-card/ActivityCard.tsx +2 -13
  59. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +13 -32
  60. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +12 -10
  61. package/src/product-set/control/DateAndRecurrenceInput.tsx +73 -2
  62. package/src/product-set/control/ProductSetControl.stories.tsx +0 -2
  63. package/src/product-set/control/ProductSetControl.tsx +8 -10
  64. package/src/product-set/control/ProductSetRecurrenceControl.tsx +6 -1
  65. package/src/product-set/form/ProductSetForm.stories.tsx +6 -6
  66. package/src/product-set/form/ProductSetForm.tsx +19 -3
  67. package/src/product-set/utils/index.ts +38 -0
  68. package/src/styles/activity-card/GridActivitiesCard.scss +0 -8
  69. package/src/styles/form/CustomCheckbox.scss +1 -0
  70. package/src/styles/zones/ZoneForm.scss +3 -0
  71. package/src/zone/form/ZoneForm.tsx +1 -2
  72. package/src/zone/form/components/AvailableTimesControl.tsx +89 -83
  73. package/src/zone/form/components/ZoneControl.tsx +2 -5
  74. package/src/zone/form/components/ZoneRecurrencesControl.tsx +2 -51
@@ -12,5 +12,5 @@ export type ZoneFormProps = {
12
12
  export type ZoneFormValues = Partial<Zone> & {
13
13
  localImageBlobURL?: string;
14
14
  };
15
- export declare const ZoneForm: ({ defaultValues, onSubmit, serverErrors, isLoading, workHours, }: ZoneFormProps) => JSX.Element;
15
+ export declare const ZoneForm: ({ defaultValues, onSubmit, serverErrors, isLoading, }: ZoneFormProps) => JSX.Element;
16
16
  //# sourceMappingURL=ZoneForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZoneForm.d.ts","sourceRoot":"","sources":["../../../src/zone/form/ZoneForm.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,QAAQ,qEAMlB,aAAa,gBAiDf,CAAC"}
1
+ {"version":3,"file":"ZoneForm.d.ts","sourceRoot":"","sources":["../../../src/zone/form/ZoneForm.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,QAAQ,0DAKlB,aAAa,gBAiDf,CAAC"}
@@ -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 r=require("tslib"),t=require("react"),o=e(t),n=require("react-i18next"),s=require("react-bootstrap"),a=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),u=require("./components/ZoneControl.js");exports.ZoneForm=function(e){var i=e.defaultValues,c=e.onSubmit,m=e.serverErrors,d=e.isLoading,f=void 0!==d&&d,b=e.workHours,p=void 0===b?[]:b,v=n.useTranslation("Design").t,E=a.useForm({mode:"onChange",defaultValues:{zoneRecurrences:[]}}),g=E.reset,q=E.setError,w=E.handleSubmit,C=(0,E.watch)();return t.useEffect((function(){i&&g(i)}),[i,g]),t.useEffect((function(){m&&l.handleServerErrors(m,q)}),[m,q]),o.createElement(a.FormProvider,r.__assign({},E),o.createElement(s.Form,{onSubmit:w((function(e){e.localImageBlobURL;var t=r.__rest(e,["localImageBlobURL"]);c(t)}))},o.createElement(u.ZoneControl,{isLoading:f,workHours:p}),o.createElement(s.Row,null,o.createElement(s.Col,{md:6,sm:12}),o.createElement(s.Col,{className:"product-set-save-btn-wrapper p-0 pl-4 d-flex mw-100",md:6,sm:12},o.createElement(s.Button,{className:"product-set-save-btn mt-5 ml-5 d-no dne d-md-block",type:"submit",disabled:f||!C.name},v("saveAndClose"))))))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),o=e(t),n=require("react-i18next"),s=require("react-bootstrap"),a=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),i=require("./components/ZoneControl.js");exports.ZoneForm=function(e){var u=e.defaultValues,c=e.onSubmit,m=e.serverErrors,d=e.isLoading,f=void 0!==d&&d,b=n.useTranslation("Design").t,p=a.useForm({mode:"onChange",defaultValues:{zoneRecurrences:[]}}),v=p.reset,E=p.setError,g=p.handleSubmit,q=(0,p.watch)();return t.useEffect((function(){u&&v(u)}),[u,v]),t.useEffect((function(){m&&l.handleServerErrors(m,E)}),[m,E]),o.createElement(a.FormProvider,r.__assign({},p),o.createElement(s.Form,{onSubmit:g((function(e){e.localImageBlobURL;var t=r.__rest(e,["localImageBlobURL"]);c(t)}))},o.createElement(i.ZoneControl,{isLoading:f}),o.createElement(s.Row,null,o.createElement(s.Col,{md:6,sm:12}),o.createElement(s.Col,{className:"product-set-save-btn-wrapper p-0 pl-4 d-flex mw-100",md:6,sm:12},o.createElement(s.Button,{className:"product-set-save-btn mt-5 ml-5 d-no dne d-md-block",type:"submit",disabled:f||!q.name},b("saveAndClose"))))))};
@@ -14,6 +14,8 @@ type AvailableTimesControlProps = {
14
14
  defaultValues?: string[];
15
15
  startTime?: string;
16
16
  endTime?: string;
17
+ errorMessage?: string;
18
+ clearErrorMessage: () => void;
17
19
  };
18
20
  type AvailableTimesForm = {
19
21
  availableTimes: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"AvailableTimesControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/AvailableTimesControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAW,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM;QAAE,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9C,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvD,eAAO,MAAM,qBAAqB,6GA0FhC,CAAC"}
1
+ {"version":3,"file":"AvailableTimesControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/AvailableTimesControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAW,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM;QAAE,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9C,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,CAAC;AAEF,KAAK,kBAAkB,GAAG;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvD,eAAO,MAAM,qBAAqB,6GA8FjC,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-i18next"),l=require("react-bootstrap"),n=require("react-hook-form"),s=require("@react-aria/utils"),o=require("../utils/dates.js"),u=t.forwardRef((function(e,u){var c,m=e.isLoading,d=e.workHours,f=e.defaultValues,b=void 0===f?[]:f,v=s.useId(),g=i.useTranslation(["Design","Validation"]).t,p=n.useForm({mode:"onChange"}),h=p.register,E=p.formState.errors,k=p.reset,T=p.trigger,_=p.getValues,q=p.setValue,y=p.watch,C=p.setError,F=y("availableTimes")||[],V=t.useMemo((function(){return o.getCheckboxesByWorkHours(d)}),[d]);t.useImperativeHandle(u,(function(){return{trigger:T,getValues:_,setError:C}}));return t.useEffect((function(){b&&k({availableTimes:b})}),[b]),a.createElement(l.Form.Group,{controlId:v},a.createElement(l.Form.Label,null,g("Design:startTimes")),a.createElement("div",{className:"zone-available-times"},V.map((function(e){return a.createElement(l.Form.Check,{key:e,inline:!0,custom:!0,id:e},a.createElement(l.Form.Check.Input,{type:"checkbox",value:e,checked:F.includes(e),onChange:function(){return function(e){F.includes(e)?q("availableTimes",F.filter((function(r){return r!==e}))):q("availableTimes",r.__spreadArray(r.__spreadArray([],r.__read(F),!1),[e],!1))}(e)},disabled:m}),a.createElement(l.Form.Check.Label,null,e))}))),a.createElement(l.Form.Control,r.__assign({type:"hidden"},h("availableTimes",{required:{value:!0,message:g("Validation:fieldMinNumber",{attribute:g("startTimes"),min:1})}}))),a.createElement("div",{className:"manual-form-error"},null===(c=E.availableTimes)||void 0===c?void 0:c.message))}));exports.AvailableTimesControl=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),a=require("react"),t=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-i18next"),o=require("react-bootstrap"),s=require("react-hook-form"),n=require("@react-aria/utils"),l=require("../utils/dates.js"),u=a.forwardRef((function(e,u){var c,m=e.isLoading,d=e.workHours,f=e.defaultValues,v=void 0===f?[]:f,g=e.errorMessage,b=e.clearErrorMessage,p=n.useId(),E=i.useTranslation(["Design","Validation"]).t,h=s.useForm({mode:"onChange"}),k=h.register,_=h.formState.errors,y=h.reset,C=h.trigger,T=h.getValues,q=h.setValue,F=h.watch,x=h.setError,V=F("availableTimes")||[],I=a.useMemo((function(){return l.getCheckboxesByWorkHours(d)}),[d]);a.useImperativeHandle(u,(function(){return{trigger:C,getValues:T,setError:x}}));return a.useEffect((function(){v&&y({availableTimes:v})}),[v]),t.createElement(o.Form.Group,{controlId:p},t.createElement(o.Form.Label,null,E("Design:startTimes")),t.createElement("div",{className:"zone-available-times"},I.map((function(e){return t.createElement(o.Form.Check,{key:e,inline:!0,custom:!0,id:e},t.createElement(o.Form.Check.Input,{type:"checkbox",value:e,checked:V.includes(e),onChange:function(){return function(e){var a=V.includes(e);g&&b(),q("availableTimes",a?V.filter((function(r){return r!==e})):r.__spreadArray(r.__spreadArray([],r.__read(V),!1),[e],!1))}(e)},disabled:m}),t.createElement(o.Form.Check.Label,null,e))}))),t.createElement(o.Form.Control,r.__assign({type:"hidden"},k("availableTimes"))),t.createElement("div",{className:"manual-form-error"},(null===(c=_.availableTimes)||void 0===c?void 0:c.message)||g))}));exports.AvailableTimesControl=u;
@@ -4,5 +4,5 @@ export type ZoneControlProps = {
4
4
  isLoading: boolean;
5
5
  workHours?: WorkHour[];
6
6
  };
7
- export declare const ZoneControl: ({ isLoading, workHours, }: ZoneControlProps) => JSX.Element;
7
+ export declare const ZoneControl: ({ isLoading }: ZoneControlProps) => JSX.Element;
8
8
  //# sourceMappingURL=ZoneControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAStF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,8BAGrB,gBAAgB,gBA0BlB,CAAC"}
1
+ {"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAStF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,kBAAmB,gBAAgB,gBA0B1D,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,t=require("react-bootstrap"),n=require("./NameControl.js"),l=require("./ZoneTypeControl.js"),a=require("./SortControl.js"),i=require("./ZoneRecurrencesControl.js"),s=require("./DescriptionControl.js"),m=require("./ZoneImageControl.js"),c=require("./GameDurationControl.js");exports.ZoneControl=function(e){var r=e.isLoading,u=e.workHours,C=void 0===u?[]:u;return o.createElement(t.Row,null,o.createElement(t.Col,{md:6,sm:12,className:"pr-5"},o.createElement(n.NameControl,{isLoading:r}),o.createElement(i.ZoneRecurrencesControl,{workHours:C,isLoading:r}),o.createElement("hr",null),o.createElement(t.Row,null,o.createElement(t.Col,{md:6,sm:6},o.createElement(l.ZoneTypeControl,{isLoading:r}),o.createElement(a.SortControl,{isLoading:r}),o.createElement(c.GameDurationControl,{isLoading:r})),o.createElement(t.Col,{md:6,sm:6},o.createElement(m.ZoneImageControl,{isLoading:r}))),o.createElement("hr",null),o.createElement(t.Row,null,o.createElement(t.Col,{md:12,sm:12},o.createElement(s.DescriptionControl,{isLoading:r})))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-bootstrap"),n=require("./NameControl.js"),l=require("./ZoneTypeControl.js"),a=require("./SortControl.js"),i=require("./ZoneRecurrencesControl.js"),m=require("./DescriptionControl.js"),s=require("./ZoneImageControl.js"),c=require("./GameDurationControl.js");exports.ZoneControl=function(e){var r=e.isLoading;return t.createElement(o.Row,null,t.createElement(o.Col,{md:6,sm:12,className:"pr-5"},t.createElement(n.NameControl,{isLoading:r}),t.createElement(i.ZoneRecurrencesControl,null),t.createElement("hr",null),t.createElement(o.Row,null,t.createElement(o.Col,{md:6,sm:6},t.createElement(l.ZoneTypeControl,{isLoading:r}),t.createElement(a.SortControl,{isLoading:r}),t.createElement(c.GameDurationControl,{isLoading:r})),t.createElement(o.Col,{md:6,sm:6},t.createElement(s.ZoneImageControl,{isLoading:r}))),t.createElement("hr",null),t.createElement(o.Row,null,t.createElement(o.Col,{md:12,sm:12},t.createElement(m.DescriptionControl,{isLoading:r})))))};
@@ -8,5 +8,5 @@ export type ZoneRecurrenceControlProps = {
8
8
  workHours?: WorkHour[];
9
9
  isLoading?: boolean;
10
10
  };
11
- export declare const ZoneRecurrencesControl: ({ workHours, isLoading, }: ZoneRecurrenceControlProps) => JSX.Element;
11
+ export declare const ZoneRecurrencesControl: () => JSX.Element;
12
12
  //# sourceMappingURL=ZoneRecurrencesControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZoneRecurrencesControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneRecurrencesControl.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAMlG,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAiBtF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,8BAGhC,0BAA0B,gBA8O5B,CAAC"}
1
+ {"version":3,"file":"ZoneRecurrencesControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneRecurrencesControl.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAMlG,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAWtF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,mBAsMlC,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/core/dist/Config"),a=require("react-i18next"),o=require("react-bootstrap"),u=require("../../../static/Icon.js"),l=require("react-hook-form"),s=require("@react-aria/utils"),c=require("react-use"),d=require("luxon");require("../../../static/index.js");var m=require("@dnd-kit/core"),v=require("@dnd-kit/sortable"),f=require("../../../modals/confirmation/ConfirmModal.js"),g=require("../../../recurring-date-picker-input/RecurringDatePickerInput.js"),p=require("../../../product-set/control/DateAndRecurrenceInput.js"),T=require("./ZoneRecurrenceControl.js"),_=require("./AvailableTimesControl.js");exports.ZoneRecurrencesControl=function(e){var E,b,q=e.workHours,D=e.isLoading,R=void 0!==D&&D,x=l.useFormContext(),C=x.control,I=x.register,S=x.formState.errors,k=x.getValues,y=x.setValue,A=x.clearErrors,F=l.useFieldArray({name:"zoneRecurrences",control:C,keyName:"_id"}),M=F.fields,h=F.append,z=F.update,N=F.move,w=r.__read(t.useState(!1),2),O=w[0],j=w[1],V=r.__read(t.useState({index:null,values:null}),2),P=V[0],L=V[1],Z=function(){return L({index:null,values:null})},H=r.__read(t.useState([]),2),B=H[0],G=H[1],K=t.useRef(),W=t.useRef();c.useClickAway(K,(function(e){var r,t,n;f.CONFIRM_MODAL_ACTIONS.includes(null===(n=null===(t=null===(r=e.target)||void 0===r?void 0:r.attributes)||void 0===t?void 0:t.getNamedItem("data-id"))||void 0===n?void 0:n.value)||(j(!1),Z())}));var J=s.useId(),Q=a.useTranslation(["Design","Validation"]).t,U=function(){Z(),j((function(e){return!e}))};return t.useEffect((function(){M.length&&A("zoneRecurrences")}),[M,A]),n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,Q("zoneAvailable")),n.createElement(o.OverlayTrigger,{show:O,overlay:n.createElement(o.Popover,{id:J,className:"rounded"},n.createElement(o.Popover.Content,{className:"shadow-lg rounded",ref:K},n.createElement(g.RecurringDatePickerInput,{defaultValues:P.values,onChange:function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,u,l,s;return r.__generator(this,(function(c){switch(c.label){case 0:return[4,null===(u=W.current)||void 0===u?void 0:u.trigger()];case 1:return c.sent()?!(null==e?void 0:e.startTime)||!(null==e?void 0:e.endTime)||(t=d.DateTime.fromISO(e.startTime),n=d.DateTime.fromISO(e.endTime),a=W.current.getValues().availableTimes,a.every((function(e){var r=d.DateTime.fromFormat(e,i.TIME_FORMAT);return r.diff(t,"minutes").minutes>=0&&r.diff(n,"minutes").minutes<=0})))?(o=r.__assign({rrule:e.rrule,startDate:e.startDate,endDate:e.endDate,startTime:e.startTime,endTime:e.endTime},W.current.getValues()),(null===(l=P.values)||void 0===l?void 0:l.id)&&(o.id=null===(s=P.values)||void 0===s?void 0:s.id),null!==P.index?z(P.index,o):h(o),j((function(){return!1})),Z(),[2]):(W.current.setError("availableTimes",{message:Q("Validation:fieldTimeBetween",{attribute:Q("Design:startTimesSmall"),min:t.toFormat(i.TIME_FORMAT),max:n.toFormat(i.TIME_FORMAT)})}),[2]):[2]}}))}))},onDelete:function(){var e=P.index;j(!1),Z(),setTimeout((function(){var r=k().zoneRecurrences;y("zoneRecurrences",(void 0===r?[]:r).filter((function(r,t){return t!==e})))}),100)},setInitialStartDateAfterSelect:!0},n.createElement(_.AvailableTimesControl,{workHours:q,isLoading:R,defaultValues:B,ref:W})))),trigger:"click",placement:"bottom",popperConfig:{modifiers:[p.sameWidthPopperModifier]}},n.createElement("div",{className:"zone-recurrences"},n.createElement(m.DndContext,{onDragEnd:function(e){var r=e.over,t=e.active;if(r.id!==t.id){var n=M.findIndex((function(e){return String(e._id)===t.id})),i=M.findIndex((function(e){return String(e._id)===r.id}));N(n,i)}}},n.createElement(v.SortableContext,{items:null!==(E=null==M?void 0:M.map((function(e){return String(e._id)})))&&void 0!==E?E:[],strategy:v.verticalListSortingStrategy},null==M?void 0:M.map((function(e,r){return n.createElement(T.ZoneRecurrenceControl,{key:e._id,zoneRecurrence:e,onEdit:function(){return function(e,r){Z(),L({index:r,values:e}),G(e.availableTimes||[]),j((function(){return!0}))}(e,r)}})})))),n.createElement("div",{className:"zone-recurrence-icon-wrapper",role:"button",tabIndex:0,onClick:U,onKeyDown:U},n.createElement(u.default,{type:"plus-circle",height:"1rem",className:"zone-recurrence-icon-add mr-2"}),Q("addDates")),n.createElement(o.Form.Control,r.__assign({type:"hidden"},I("zoneRecurrences",{required:{value:!0,message:Q("Validation:fieldMinNumber",{attribute:Q("dates"),min:1})}}))),n.createElement("div",{className:"manual-form-error"},null===(b=S.zoneRecurrences)||void 0===b?void 0:b.message))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-i18next"),o=require("react-bootstrap"),a=require("../../../static/Icon.js"),u=require("react-hook-form"),l=require("@react-aria/utils"),c=require("react-use");require("../../../static/index.js");var d=require("@dnd-kit/core"),s=require("@dnd-kit/sortable"),m=require("../../../modals/confirmation/ConfirmModal.js"),v=require("../../../recurring-date-picker-input/RecurringDatePickerInput.js"),f=require("../../../product-set/control/DateAndRecurrenceInput.js"),p=require("./ZoneRecurrenceControl.js");exports.ZoneRecurrencesControl=function(){var e,g,_=u.useFormContext(),E=_.control,q=_.register,x=_.formState.errors,C=_.getValues,D=_.setValue,R=_.clearErrors,b=u.useFieldArray({name:"zoneRecurrences",control:E,keyName:"_id"}),y=b.fields,I=b.append,S=b.update,k=b.move,z=r.__read(t.useState(!1),2),N=z[0],h=z[1],j=r.__read(t.useState({index:null,values:null}),2),T=j[0],A=j[1],w=function(){return A({index:null,values:null})},F=t.useRef();c.useClickAway(F,(function(e){var r,t,n;m.CONFIRM_MODAL_ACTIONS.includes(null===(n=null===(t=null===(r=e.target)||void 0===r?void 0:r.attributes)||void 0===t?void 0:t.getNamedItem("data-id"))||void 0===n?void 0:n.value)||(h(!1),w())}));var M=l.useId(),P=i.useTranslation(["Design","Validation"]).t,O=function(){w(),h((function(e){return!e}))};return t.useEffect((function(){y.length&&R("zoneRecurrences")}),[y,R]),n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,P("zoneAvailable")),n.createElement(o.OverlayTrigger,{show:N,overlay:n.createElement(o.Popover,{id:M,className:"rounded"},n.createElement(o.Popover.Content,{className:"shadow-lg rounded",ref:F},n.createElement(v.RecurringDatePickerInput,{defaultValues:T.values,onChange:function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var t,n,i;return r.__generator(this,(function(r){return t={rrule:e.rrule,startDate:e.startDate,endDate:e.endDate,startTime:e.startTime,endTime:e.endTime},(null===(n=T.values)||void 0===n?void 0:n.id)&&(t.id=null===(i=T.values)||void 0===i?void 0:i.id),null!==T.index?S(T.index,t):I(t),h((function(){return!1})),w(),[2]}))}))},onDelete:function(){var e=T.index;h(!1),w(),setTimeout((function(){var r=C().zoneRecurrences;D("zoneRecurrences",(void 0===r?[]:r).filter((function(r,t){return t!==e})))}),100)},setInitialStartDateAfterSelect:!0}))),trigger:"click",placement:"bottom",popperConfig:{modifiers:[f.sameWidthPopperModifier]}},n.createElement("div",{className:"zone-recurrences"},n.createElement(d.DndContext,{onDragEnd:function(e){var r=e.over,t=e.active;if(r.id!==t.id){var n=y.findIndex((function(e){return String(e._id)===t.id})),i=y.findIndex((function(e){return String(e._id)===r.id}));k(n,i)}}},n.createElement(s.SortableContext,{items:null!==(e=null==y?void 0:y.map((function(e){return String(e._id)})))&&void 0!==e?e:[],strategy:s.verticalListSortingStrategy},null==y?void 0:y.map((function(e,r){return n.createElement(p.ZoneRecurrenceControl,{key:e._id,zoneRecurrence:e,onEdit:function(){return function(e,r){w(),A({index:r,values:e}),h((function(){return!0}))}(e,r)}})})))),n.createElement("div",{className:"zone-recurrence-icon-wrapper",role:"button",tabIndex:0,onClick:O,onKeyDown:O},n.createElement(a.default,{type:"plus-circle",height:"1rem",className:"zone-recurrence-icon-add mr-2"}),P("addDates")),n.createElement(o.Form.Control,r.__assign({type:"hidden"},q("zoneRecurrences",{required:{value:!0,message:P("Validation:fieldMinNumber",{attribute:P("dates"),min:1})}}))),n.createElement("div",{className:"manual-form-error"},null===(g=x.zoneRecurrences)||void 0===g?void 0:g.message))))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.541",
3
+ "version": "0.44.543",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -1,5 +1,6 @@
1
- import React, { ReactElement } from "react";
1
+ import React, { FunctionComponent, SVGProps } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
+ import { ZoneResourcesAvailability } from "@licklist/core/dist/DataMapper/Order/ZoneResourcesAvailabilityDataMapper";
3
4
  import { ReactComponent as AvailableIcon } from "../assets/iframe/available.svg";
4
5
  import { ReactComponent as LimitedIcon } from "../assets/iframe/limited.svg";
5
6
  import { ReactComponent as SoldOutIcon } from "../assets/iframe/soldOut.svg";
@@ -7,53 +8,60 @@ import { ReactComponent as SoldOutIcon } from "../assets/iframe/soldOut.svg";
7
8
  const LOTS_OF_SPACE_LIMIT = 0.2;
8
9
  const LIMITED_LIMIT = 0.8;
9
10
 
10
- const getIconsAndLabels = (
11
- booked: number,
12
- total: number
13
- ): { label: string; icon: ReactElement } => {
14
- if (booked === total) {
15
- return { label: "soldOut", icon: <SoldOutIcon className="logo" /> };
11
+ type Config = {
12
+ label: string;
13
+ icon: FunctionComponent<SVGProps<SVGSVGElement>>;
14
+ };
15
+
16
+ const getIconsAndLabels = ({
17
+ bookedResources,
18
+ totalResources,
19
+ }: ZoneResourcesAvailability): Config => {
20
+ if (bookedResources === totalResources) {
21
+ return { label: "soldOut", icon: SoldOutIcon };
16
22
  }
17
23
 
18
24
  // lots of space if less than 80% booked
19
- if (booked / total <= LOTS_OF_SPACE_LIMIT) {
20
- return { label: "lotsOfSpace", icon: <AvailableIcon className="logo" /> };
25
+ if (bookedResources / totalResources <= LOTS_OF_SPACE_LIMIT) {
26
+ return { label: "lotsOfSpace", icon: AvailableIcon };
21
27
  }
22
28
 
23
- if (booked / total >= LIMITED_LIMIT) {
24
- return { label: "limited", icon: <LimitedIcon className="logo" /> };
29
+ if (bookedResources / totalResources >= LIMITED_LIMIT) {
30
+ return { label: "limited", icon: LimitedIcon };
25
31
  }
26
32
 
27
- return { label: "available", icon: <AvailableIcon className="logo" /> };
33
+ return { label: "available", icon: AvailableIcon };
28
34
  };
29
35
 
30
36
  type AvailabilityIndicatorProps = {
31
- booked: number;
32
- total: number;
33
- notAvailable?: boolean;
37
+ resources: ZoneResourcesAvailability;
38
+ isUnavailable?: boolean;
39
+ isSoldOut?: boolean;
34
40
  };
35
41
 
36
42
  export const AvailabilityIndicator = ({
37
- booked,
38
- total,
39
- notAvailable,
43
+ resources,
44
+ isUnavailable,
45
+ isSoldOut,
40
46
  }: AvailabilityIndicatorProps) => {
41
47
  const { t } = useTranslation("Design");
42
- const { icon, label } = getIconsAndLabels(booked, total);
43
-
44
- if (notAvailable) {
45
- return (
46
- <div className="availability-indicator">
47
- <SoldOutIcon className="logo" />
48
- <div>{t("notAvailable")}</div>
49
- </div>
50
- );
48
+
49
+ if (isUnavailable) {
50
+ return <Indicator icon={SoldOutIcon} label={t("notAvailable")} />;
51
51
  }
52
52
 
53
- return (
54
- <div className="availability-indicator">
55
- {icon}
56
- <div>{t(label)}</div>
57
- </div>
58
- );
53
+ if (isSoldOut) {
54
+ return <Indicator icon={SoldOutIcon} label={t("soldOut")} />;
55
+ }
56
+
57
+ const { icon, label } = getIconsAndLabels(resources);
58
+
59
+ return <Indicator icon={icon} label={t(label)} />;
59
60
  };
61
+
62
+ const Indicator = ({ icon, label }: Config) => (
63
+ <div className="availability-indicator">
64
+ {icon}
65
+ <div>{label}</div>
66
+ </div>
67
+ );
@@ -1,5 +1,6 @@
1
1
  import React, { Dispatch, ReactElement, SetStateAction } from "react";
2
2
  import { DateTime } from "luxon";
3
+ import { ZoneResourcesAvailability } from "@licklist/core/dist/DataMapper/Order/ZoneResourcesAvailabilityDataMapper";
3
4
  import { CalendarButtons } from "./components/CalendarButtons";
4
5
  import { CalendarDates } from "./components/CalendarDates";
5
6
 
@@ -20,9 +21,7 @@ export type CalendarProps = {
20
21
  fromPrice?: string | ReactElement | null;
21
22
  isLoading?: boolean;
22
23
  initialDate?: DateTime;
23
- getAvailability?: (
24
- date: DateTime
25
- ) => { booked: number; total: number } | undefined;
24
+ getAvailability?: (date: DateTime) => ZoneResourcesAvailability | null;
26
25
  includeAvailability?: boolean;
27
26
  };
28
27
 
@@ -1,6 +1,7 @@
1
1
  import React, { ReactElement } from "react";
2
2
  import clsx from "clsx";
3
3
  import { DateTime } from "luxon";
4
+ import { ZoneResourcesAvailability } from "@licklist/core/dist/DataMapper/Order/ZoneResourcesAvailabilityDataMapper";
4
5
  import { AvailabilityIndicator } from "../availability-indicator";
5
6
  import { DateContent } from "./DateContent";
6
7
 
@@ -8,13 +9,11 @@ export type DateTimeButtonProps<T = DateTime | string> = {
8
9
  date: T;
9
10
  isSelected?: boolean;
10
11
  isDisabled?: boolean;
12
+ isSoldOut?: boolean;
11
13
  onSelect: (date: T) => void;
12
14
  isOnlyTimeContainer?: boolean;
13
15
  price?: string | number | ReactElement | null;
14
- resources?: {
15
- booked: number;
16
- total: number;
17
- };
16
+ resources?: ZoneResourcesAvailability | null;
18
17
  calendarView?: boolean;
19
18
  showResources?: boolean;
20
19
  };
@@ -23,6 +22,7 @@ export const DateTimeButton = <T extends DateTime | string>({
23
22
  date,
24
23
  isDisabled: _isDisabled,
25
24
  isSelected,
25
+ isSoldOut,
26
26
  onSelect,
27
27
  isOnlyTimeContainer,
28
28
  price,
@@ -33,7 +33,8 @@ export const DateTimeButton = <T extends DateTime | string>({
33
33
  const isTimeVariant = typeof date === "string";
34
34
 
35
35
  const isDisabled =
36
- _isDisabled || (resources && resources.booked === resources.total);
36
+ _isDisabled ||
37
+ (resources && resources.bookedResources === resources.totalResources);
37
38
 
38
39
  return (
39
40
  <button
@@ -63,7 +64,11 @@ export const DateTimeButton = <T extends DateTime | string>({
63
64
  {price && !isDisabled && <div className="price">{price}</div>}
64
65
 
65
66
  {showResources && resources && (
66
- <AvailabilityIndicator {...resources} notAvailable={_isDisabled} />
67
+ <AvailabilityIndicator
68
+ resources={resources}
69
+ isUnavailable={_isDisabled}
70
+ isSoldOut={isSoldOut}
71
+ />
67
72
  )}
68
73
  </button>
69
74
  );
@@ -47,7 +47,6 @@ const contextValue = {
47
47
  name: "Example",
48
48
  type: "sale",
49
49
  termsAndConditions: "",
50
- isDefault: true,
51
50
  operationalCost: OPERATIONAL_COST_CUSTOMER,
52
51
  steps: [
53
52
  {
@@ -687,7 +686,6 @@ const defaultProductSets = [
687
686
  name: "Example",
688
687
  type: PRODUCT_SET_TYPES[0],
689
688
  termsAndConditions: "",
690
- isDefault: true,
691
689
  operationalCost: OPERATIONAL_COST_TYPES[0],
692
690
  fieldSet: {
693
691
  id: 1,
@@ -877,7 +875,6 @@ const defaultProductSets = [
877
875
  name: "Example 2",
878
876
  type: PRODUCT_SET_TYPES[1],
879
877
  termsAndConditions: "",
880
- isDefault: true,
881
878
  operationalCost: OPERATIONAL_COST_TYPES[1],
882
879
  fieldSet: {
883
880
  id: 2,
@@ -17,7 +17,6 @@ export const getDefaultValues = (
17
17
  operationalCost: productSet?.operationalCost ?? DEFAULT_OPERATIONAL_COST_TYPE,
18
18
  relyOnPeopleType: productSet?.relyOnPeopleType ?? null,
19
19
  thankYouPageUrl: productSet?.thankYouPageUrl ?? "",
20
- isDefault: productSet?.isDefault ?? false,
21
20
  fieldSetId: productSet?.fieldSetId,
22
21
  emailTemplates:
23
22
  productSet?.mailTemplates && productSet?.mailTemplates?.length > 0
@@ -1,75 +1,51 @@
1
1
  import React from "react";
2
2
  import { Meta, Story } from "@storybook/react";
3
- import { ActivityCard, ActivityCardProps, LAYOUT_LIST } from "./ActivityCard";
3
+ import {
4
+ ActivityCard,
5
+ ActivityCardProps,
6
+ LAYOUT_GRID,
7
+ LAYOUT_LIST,
8
+ } from "./ActivityCard";
4
9
 
5
10
  export default {
6
11
  title: "Iframe/ActivityCard",
7
12
  component: ActivityCard,
8
13
  } as Meta;
9
14
 
10
- export const Default: Story<ActivityCardProps> = (props) => {
11
- return <ActivityCard {...props} />;
12
- };
15
+ export const GridView: Story<ActivityCardProps> = (props) => {
16
+ const [isSelected, setIsSelected] = React.useState(false);
13
17
 
14
- Default.args = {
15
- title: "Clay Pigeons & Axe Thowing",
16
- duration: "60 mins",
17
- price: "from £20",
18
- image: {
19
- hash: "0b37b130e22aa2d3",
20
- id: 195,
21
- imageType: "cover",
22
- imageableId: 25,
23
- imageableType: "zone",
24
- path: "images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
25
- // eslint-disable-next-line max-len
26
- url: "https://cdn.lickli.st/doNktZRze1yuz3Uo2OPrLSvXVtUcdUsF/images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
27
- },
28
- onSelect: () => null,
29
- isSelected: false,
18
+ return (
19
+ <ActivityCard
20
+ {...props}
21
+ isSelected={isSelected}
22
+ onSelect={() => setIsSelected(true)}
23
+ />
24
+ );
30
25
  };
31
26
 
32
- export const Selected: Story<ActivityCardProps> = (props) => {
33
- return <ActivityCard {...props} />;
34
- };
35
-
36
- Selected.args = {
27
+ GridView.args = {
28
+ layout: LAYOUT_GRID,
37
29
  title: "Clay Pigeons & Axe Thowing",
38
30
  duration: "60 mins",
39
31
  price: "from £20",
40
- image: {
41
- hash: "0b37b130e22aa2d3",
42
- id: 195,
43
- imageType: "cover",
44
- imageableId: 25,
45
- imageableType: "zone",
46
- path: "images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
47
- // eslint-disable-next-line max-len
48
- url: "https://cdn.lickli.st/doNktZRze1yuz3Uo2OPrLSvXVtUcdUsF/images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
49
- },
50
- onSelect: () => null,
51
- isSelected: true,
52
32
  };
53
33
 
54
34
  export const ListView: Story<ActivityCardProps> = (props) => {
55
- return <ActivityCard {...props} />;
35
+ const [isSelected, setIsSelected] = React.useState(false);
36
+
37
+ return (
38
+ <ActivityCard
39
+ {...props}
40
+ isSelected={isSelected}
41
+ onSelect={() => setIsSelected(true)}
42
+ />
43
+ );
56
44
  };
57
45
 
58
- Default.args = {
46
+ ListView.args = {
59
47
  layout: LAYOUT_LIST,
60
48
  title: "Clay Pigeons & Axe Thowing",
61
49
  duration: "60 mins",
62
50
  price: "from £20",
63
- image: {
64
- hash: "0b37b130e22aa2d3",
65
- id: 195,
66
- imageType: "cover",
67
- imageableId: 25,
68
- imageableType: "zone",
69
- path: "images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
70
- // eslint-disable-next-line max-len
71
- url: "https://cdn.lickli.st/doNktZRze1yuz3Uo2OPrLSvXVtUcdUsF/images/original/000/000/000/000/195-0b37b130e22aa2d3.jpeg",
72
- },
73
- onSelect: () => null,
74
- isSelected: false,
75
51
  };
@@ -1,6 +1,5 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import clsx from "clsx";
3
- import { Image } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
4
3
 
5
4
  export const LAYOUT_GRID = "grid";
6
5
  export const LAYOUT_LIST = "list";
@@ -11,7 +10,6 @@ export type ActivityCardProps = {
11
10
  title: ReactNode;
12
11
  duration: ReactNode;
13
12
  price: ReactNode;
14
- image?: Image | null;
15
13
  onSelect: () => void;
16
14
  isSelected: boolean;
17
15
  layout?: Layout;
@@ -21,7 +19,7 @@ export const ActivityCard = ({
21
19
  title,
22
20
  duration,
23
21
  price,
24
- image,
22
+ // image,
25
23
  onSelect,
26
24
  isSelected,
27
25
  layout = LAYOUT_GRID,
@@ -33,10 +31,7 @@ export const ActivityCard = ({
33
31
  className={clsx("activity-card", isSelected && "active")}
34
32
  onClick={onSelect}
35
33
  >
36
- {image && (
37
- <img className="activity-card-image" alt="" src={image.url} />
38
- )}
39
- <div className={clsx("d-flex", "flex-column", !image && "no-image")}>
34
+ <div className={clsx("d-flex", "flex-column")}>
40
35
  <div className="activity-card-title">{title}</div>
41
36
 
42
37
  {duration && <div>{duration}</div>}
@@ -64,12 +59,6 @@ export const ActivityCard = ({
64
59
 
65
60
  {price && <div>{price}</div>}
66
61
  </div>
67
-
68
- {image && (
69
- <div className="image-container">
70
- <img className="image" src={image.url} alt="" />
71
- </div>
72
- )}
73
62
  </div>
74
63
  <hr className="list-activity-card-hr" />
75
64
  </div>
@@ -3,6 +3,7 @@ import clsx from "clsx";
3
3
  import { Button } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
6
+ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
6
7
  import { NumberInput } from "../NumberInput";
7
8
  import { Product, ProductCategory } from "../../../../../../types";
8
9
 
@@ -11,6 +12,7 @@ interface FormOrderItem {
11
12
  name: string;
12
13
  price: number;
13
14
  productsCategoryId: number;
15
+ zoneId?: Zone["id"];
14
16
  deposit?: number | null;
15
17
  quantity: number;
16
18
  capacity?: number | null;
@@ -30,7 +32,7 @@ interface ProductQuantityInputProps {
30
32
  export const ProductQuantityInput = ({
31
33
  product,
32
34
  category,
33
- onChange,
35
+ onChange: _onChange,
34
36
  clearErrors,
35
37
  refCallback,
36
38
  productInfo,
@@ -39,14 +41,15 @@ export const ProductQuantityInput = ({
39
41
  }: ProductQuantityInputProps) => {
40
42
  const { t } = useTranslation("Design");
41
43
 
42
- const onClick = () => {
43
- onChange({
44
+ const onChange = (quantity: number | null) => {
45
+ _onChange({
44
46
  id: product.id,
45
47
  name: product.name,
46
48
  deposit,
47
49
  price: product.price,
48
50
  productsCategoryId: category.id,
49
- quantity: productInfo?.quantity ? 0 : 1,
51
+ zoneId: category.zone?.id,
52
+ quantity,
50
53
  capacity: product?.capacity,
51
54
  });
52
55
  };
@@ -58,6 +61,7 @@ export const ProductQuantityInput = ({
58
61
  </div>
59
62
  );
60
63
  }
64
+
61
65
  if (product?.maxAmount === 1) {
62
66
  return (
63
67
  <Button
@@ -69,49 +73,26 @@ export const ProductQuantityInput = ({
69
73
  }`,
70
74
  invalid && "error"
71
75
  )}
72
- onClick={onClick}
76
+ onClick={() => onChange(productInfo?.quantity ? 0 : 1)}
73
77
  >
74
78
  {t(`Design:${productInfo?.quantity ? "unselect" : "select"}`)}
75
79
  </Button>
76
80
  );
77
81
  }
82
+
78
83
  return (
79
84
  <NumberInput
80
85
  ref={refCallback}
81
86
  onChange={(val) => {
82
- onChange({
83
- id: product.id,
84
- name: product.name,
85
- deposit,
86
- price: product.price,
87
- productsCategoryId: category.id,
88
- quantity: val || null,
89
- capacity: product?.capacity,
90
- });
87
+ onChange(val || null);
91
88
  clearErrors(`${product.id}` as const);
92
89
  }}
93
90
  onArrowDown={() => {
94
- onChange({
95
- id: product.id,
96
- name: product.name,
97
- deposit,
98
- price: product.price,
99
- productsCategoryId: category.id,
100
- quantity: productInfo?.quantity - 1 || 0,
101
- capacity: product?.capacity,
102
- });
91
+ onChange(productInfo?.quantity - 1 || 0);
103
92
  clearErrors(`${product.id}` as const);
104
93
  }}
105
94
  onArrowUp={() => {
106
- onChange({
107
- id: product.id,
108
- name: product.name,
109
- deposit,
110
- price: product.price,
111
- productsCategoryId: category.id,
112
- quantity: (productInfo?.quantity ?? 0) + 1,
113
- capacity: product?.capacity,
114
- });
95
+ onChange((productInfo?.quantity ?? 0) + 1);
115
96
  clearErrors(`${product.id}` as const);
116
97
  }}
117
98
  min={0}
@@ -24,17 +24,19 @@ export const LeftBlock = ({
24
24
 
25
25
  return (
26
26
  <div className={clsx("left-block", className)} {...props}>
27
- {pageTitle && (
28
- <div className="navigation">
29
- {typeof pageTitle === "string" ? (
30
- <div className="title">{pageTitle}</div>
31
- ) : (
32
- pageTitle
33
- )}
27
+ <div className="navigation">
28
+ {pageTitle && (
29
+ <>
30
+ {typeof pageTitle === "string" ? (
31
+ <div className="title">{pageTitle}</div>
32
+ ) : (
33
+ pageTitle
34
+ )}
35
+ </>
36
+ )}
34
37
 
35
- {component}
36
- </div>
37
- )}
38
+ {component}
39
+ </div>
38
40
  <div
39
41
  className={clsx("left-block-container", childrenClassName)}
40
42
  style={leftBlockStyles}