@ludo.ninja/components 2.3.83 → 2.3.85

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.
@@ -34,7 +34,8 @@ const useFetchMyActivityStreak = () => {
34
34
  });
35
35
  },
36
36
  onError: (err) => {
37
- if (err.cause?.extensions?.classification !== 'NOT_FOUND') {
37
+ const error = err;
38
+ if (error.cause?.extensions?.classification !== 'NOT_FOUND') {
38
39
  openAlert((0, getErrorAlertProps_1.getErrorAlertProps)(err));
39
40
  }
40
41
  resetUserStreak();
@@ -1,4 +1,4 @@
1
1
  export declare const useGetOpportunities: (availableProfileId: string) => {
2
- opportunities: import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").Maybe<Pick<import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").IOpportunityV2, "name" | "views" | "createdAt" | "shareLink" | "blockchain" | "description" | "collection" | "liked" | "opportunityId" | "projectId" | "categoryId" | "opportunityStatus" | "opportunityType" | "notificationType" | "projectBlockchain" | "projectContract" | "projectName" | "projectSlug" | "categoryName" | "ludoUrl" | "projectUrl" | "activeFrom" | "activeUntil" | "minXpLevel" | "maxXpLevel" | "minRank" | "maxRank" | "media" | "reportLink" | "clicks" | "blockchains" | "minWalletValue" | "maxWalletValue" | "geolocations" | "subscribed" | "participantsLimit" | "availablePlacesForAirdrop" | "slug">>[];
2
+ opportunities: import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").Maybe<Pick<import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").IOpportunityV2, "views" | "createdAt" | "shareLink" | "blockchain" | "name" | "description" | "collection" | "liked" | "opportunityId" | "projectId" | "categoryId" | "opportunityStatus" | "opportunityType" | "notificationType" | "projectBlockchain" | "projectContract" | "projectName" | "projectSlug" | "categoryName" | "ludoUrl" | "projectUrl" | "activeFrom" | "activeUntil" | "minXpLevel" | "maxXpLevel" | "minRank" | "maxRank" | "media" | "reportLink" | "clicks" | "blockchains" | "minWalletValue" | "maxWalletValue" | "geolocations" | "subscribed" | "participantsLimit" | "availablePlacesForAirdrop" | "slug">>[];
3
3
  isLoadingOpportunities: boolean;
4
4
  };
@@ -34,7 +34,7 @@ const OpportunityDropDown = ({ opportunity }) => {
34
34
  // };
35
35
  const onShareClick = (event) => {
36
36
  event.preventDefault();
37
- openModalSidebarPortal((0, jsx_runtime_1.jsx)(OpportunityMenu_1.OpportunityMenu, { opportunity: opportunity, onClose: closeModalSidebarPortal }));
37
+ openModalSidebarPortal((0, jsx_runtime_1.jsx)(OpportunityMenu_1.OpportunityMenu, { opportunity: opportunity, onClose: closeModalSidebarPortal }), true);
38
38
  };
39
39
  const onReportClick = () => {
40
40
  const opportunityId = opportunity.opportunityId ? `ID: ${opportunity.opportunityId}` : "";
@@ -101,6 +101,7 @@ exports.useUiStore = (0, traditional_1.createWithEqualityFn)()((setState) => ({
101
101
  //modals
102
102
  contentModals: null,
103
103
  stylesModals: null,
104
+ modalWithoutCloseIcon: false,
104
105
  addStylesModals: (styles) => {
105
106
  setState({ stylesModals: styles });
106
107
  },
@@ -24,12 +24,13 @@ export interface IUiStore {
24
24
  stylesModals: null | CSSProperties;
25
25
  addStylesModals: (styles: CSSProperties) => void;
26
26
  isModalOpen: boolean;
27
- openModal: (component: JSX.Element) => void;
27
+ openModal: (component: JSX.Element, withoutCloseIcon?: boolean) => void;
28
28
  closeModal: () => void;
29
29
  isModalSidebarOpen: boolean;
30
- openModalSidebar: (component: JSX.Element) => void;
30
+ openModalSidebar: (component: JSX.Element, withoutCloseIcon?: boolean) => void;
31
31
  closeModalSidebar: () => void;
32
32
  isOpenModalSidebarPortal: boolean;
33
- openModalSidebarPortal: (component: JSX.Element) => void;
33
+ modalWithoutCloseIcon: boolean;
34
+ openModalSidebarPortal: (component: JSX.Element, withoutCloseIcon?: boolean) => void;
34
35
  closeModalSidebarPortal: () => void;
35
36
  }
@@ -4,12 +4,13 @@ exports.builderModal = void 0;
4
4
  const utils_1 = require("@ludo.ninja/utils");
5
5
  const builderModal = (fields, setState) => ({
6
6
  [fields.trigger]: false,
7
- [fields.opener]: (component) => {
7
+ [fields.opener]: (component, withoutCloseIcon) => {
8
8
  (0, utils_1.rootAddOverflow)();
9
9
  setState({
10
10
  contentModals: component,
11
11
  isOverlayActive: true,
12
12
  [fields.trigger]: true,
13
+ modalWithoutCloseIcon: Boolean(withoutCloseIcon)
13
14
  });
14
15
  },
15
16
  [fields.closer]: () => {
@@ -36,10 +36,15 @@ const StyledModal = styled_components_1.default.div `
36
36
  .modalContent {
37
37
  max-height: calc(var(--app-height) - 20px - 16px - 16px - 24px);
38
38
  overflow-y: auto;
39
+ margin-top: 14px !important
40
+ }
41
+ .modalCloseIcon {
42
+ display: inline-block !important;
39
43
  }
40
44
  }
41
45
 
42
46
  .modalCloseIcon {
47
+ display: ${({ withoutCloseIcon }) => withoutCloseIcon ? 'none' : 'inline-block'};
43
48
  position: absolute;
44
49
  top: 16px;
45
50
  right: 16px;
@@ -47,7 +52,7 @@ const StyledModal = styled_components_1.default.div `
47
52
  }
48
53
 
49
54
  .modalContent {
50
- margin-top: 24px;
55
+ margin-top: ${({ withoutCloseIcon }) => withoutCloseIcon ? 'unset' : '24px'};
51
56
  }
52
57
 
53
58
  ${ScreenWidth_1.mediaQuery.minWidthFourK} {
@@ -69,14 +74,15 @@ const StyledModal = styled_components_1.default.div `
69
74
  }
70
75
  `;
71
76
  const Modal = () => {
72
- const { contentModals, isModalOpen, closeModal, stylesModals } = (0, ui_1.useUiStore)((state) => ({
77
+ const { contentModals, isModalOpen, closeModal, stylesModals, withoutCloseIcon } = (0, ui_1.useUiStore)((state) => ({
73
78
  contentModals: state.contentModals,
74
79
  stylesModals: state.stylesModals,
75
80
  isModalOpen: state.isModalOpen,
76
81
  closeModal: state.closeModal,
82
+ withoutCloseIcon: state.modalWithoutCloseIcon,
77
83
  }));
78
84
  if (!isModalOpen)
79
85
  return null;
80
- return ((0, jsx_runtime_1.jsxs)(StyledModal, { style: stylesModals ? stylesModals : undefined, children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModal }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: contentModals })] }));
86
+ return ((0, jsx_runtime_1.jsxs)(StyledModal, { style: stylesModals ? stylesModals : undefined, withoutCloseIcon: withoutCloseIcon, children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModal }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: contentModals })] }));
81
87
  };
82
88
  exports.default = Modal;
@@ -34,14 +34,15 @@ const ui_1 = require("../../../store/ui");
34
34
  const ModalSidebarPortal = (0, dynamic_1.default)(() => Promise.resolve().then(() => __importStar(require('./ModalSidebarPortal'))).then((_) => _.ModalSidebarPortal));
35
35
  // minimize dom tree for optimize virtualization
36
36
  const CreatorModalSidebarPortal = () => {
37
- const { isOpenModalSidebarPortal, closeModalSidebarPortal, contentModals } = (0, ui_1.useUiStore)((state) => ({
37
+ const { isOpenModalSidebarPortal, closeModalSidebarPortal, contentModals, withoutCloseIcon } = (0, ui_1.useUiStore)((state) => ({
38
38
  isOpenModalSidebarPortal: state.isOpenModalSidebarPortal,
39
39
  closeModalSidebarPortal: state.closeModalSidebarPortal,
40
40
  contentModals: state.contentModals,
41
+ withoutCloseIcon: state.modalWithoutCloseIcon,
41
42
  }));
42
43
  if (!isOpenModalSidebarPortal) {
43
44
  return null;
44
45
  }
45
- return ((0, jsx_runtime_1.jsx)(ModalSidebarPortal, { closeModal: closeModalSidebarPortal, component: contentModals }));
46
+ return ((0, jsx_runtime_1.jsx)(ModalSidebarPortal, { closeModal: closeModalSidebarPortal, component: contentModals, withoutCloseIcon: withoutCloseIcon }));
46
47
  };
47
48
  exports.CreatorModalSidebarPortal = CreatorModalSidebarPortal;
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from "react";
2
- export declare const ModalSidebarPortal: ({ component, closeModal }: {
2
+ export declare const ModalSidebarPortal: ({ component, closeModal, withoutCloseIcon, }: {
3
3
  component: ReactNode;
4
4
  closeModal: () => void;
5
+ withoutCloseIcon?: boolean;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
@@ -6,5 +6,5 @@ const index_1 = require("./index");
6
6
  const constants_1 = require("@ludo.ninja/core/build/constants");
7
7
  const utils_1 = require("@ludo.ninja/utils");
8
8
  // minimize dom tree for optimize virtualization
9
- const ModalSidebarPortal = ({ component, closeModal }) => ((0, jsx_runtime_1.jsx)(utils_1.PortalCreator, { children: (0, jsx_runtime_1.jsxs)(index_1.StyledModalSidebar, { children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModal }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: component })] }) }));
9
+ const ModalSidebarPortal = ({ component, closeModal, withoutCloseIcon, }) => ((0, jsx_runtime_1.jsx)(utils_1.PortalCreator, { children: (0, jsx_runtime_1.jsxs)(index_1.StyledModalSidebar, { withoutCloseIcon: withoutCloseIcon, children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModal }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: component })] }) }));
10
10
  exports.ModalSidebarPortal = ModalSidebarPortal;
@@ -1,3 +1,5 @@
1
- export declare const StyledModalSidebar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
1
+ export declare const StyledModalSidebar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
2
+ withoutCloseIcon?: boolean;
3
+ }, never>;
2
4
  declare const ModalSidebar: () => import("react/jsx-runtime").JSX.Element | null;
3
5
  export default ModalSidebar;
@@ -33,9 +33,16 @@ exports.StyledModalSidebar = styled_components_1.default.div `
33
33
  right: 0;
34
34
  bottom: 0;
35
35
  transform: none;
36
+ .modalCloseIcon {
37
+ display: inline-block !important;
38
+ }
39
+ .modalContent {
40
+ margin-top: 14px !important;};
41
+ }
36
42
  }
37
43
 
38
44
  .modalCloseIcon {
45
+ display: ${({ withoutCloseIcon }) => withoutCloseIcon ? 'none' : 'inline-block'};
39
46
  position: absolute;
40
47
  top: 16px;
41
48
  right: 16px;
@@ -43,7 +50,7 @@ exports.StyledModalSidebar = styled_components_1.default.div `
43
50
  }
44
51
 
45
52
  .modalContent {
46
- margin-top: 24px;
53
+ margin-top: ${({ withoutCloseIcon }) => withoutCloseIcon ? 'unset' : '24px'};
47
54
  }
48
55
 
49
56
  ${ScreenWidth_1.mediaQuery.minWidthFourK} {
@@ -63,13 +70,14 @@ exports.StyledModalSidebar = styled_components_1.default.div `
63
70
  }
64
71
  `;
65
72
  const ModalSidebar = () => {
66
- const { contentModals, isModalSidebarOpen, closeModalSidebar } = (0, ui_1.useUiStore)((state) => ({
73
+ const { contentModals, isModalSidebarOpen, closeModalSidebar, withoutCloseIcon } = (0, ui_1.useUiStore)((state) => ({
67
74
  contentModals: state.contentModals,
68
75
  isModalSidebarOpen: state.isModalSidebarOpen,
69
76
  closeModalSidebar: state.closeModalSidebar,
77
+ withoutCloseIcon: state.modalWithoutCloseIcon,
70
78
  }));
71
79
  if (!isModalSidebarOpen)
72
80
  return null;
73
- return ((0, jsx_runtime_1.jsxs)(exports.StyledModalSidebar, { children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModalSidebar }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: contentModals })] }));
81
+ return ((0, jsx_runtime_1.jsxs)(exports.StyledModalSidebar, { withoutCloseIcon: withoutCloseIcon, children: [(0, jsx_runtime_1.jsx)("img", { src: `${constants_1.staticLink}/public/modal/close.svg`, alt: "close", width: 24, height: 24, className: "modalCloseIcon", onClick: closeModalSidebar }), (0, jsx_runtime_1.jsx)("div", { className: "modalContent", children: contentModals })] }));
74
82
  };
75
83
  exports.default = ModalSidebar;
@@ -8,7 +8,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const ScreenWidth_1 = require("../../styles/ScreenWidth");
10
10
  const colors_1 = require("../../styles/colors");
11
- const scale_1 = require("../adaptive/scale");
12
11
  const screen_1 = require("../screen");
13
12
  const styled_components_1 = __importDefault(require("styled-components"));
14
13
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
@@ -22,6 +21,8 @@ const SWrapperIcon = styled_components_1.default.div `
22
21
  display: flex;
23
22
  align-items: center;
24
23
  justify-content: center;
24
+ width: 20px;
25
+ height: 20px;
25
26
 
26
27
  ${ScreenWidth_1.mediaQuery.minWidthFourK} {
27
28
  margin-left: ${(0, _4k_1.adaptiveValueCalc)(5)};
@@ -41,6 +42,6 @@ const CopyButton = ({ value, style, children, }) => {
41
42
  const { windowDimensions } = (0, screen_1.useWindowDimensionsWithServerInitial)();
42
43
  if (!value)
43
44
  return (0, jsx_runtime_1.jsx)(index_1.H5, { color: colors_1.BlackColor, children: "Unknown" });
44
- return ((0, jsx_runtime_1.jsxs)(index_1.Flex, { alignItems: "center", onClick: handleCopy, style: style, children: [children, (0, jsx_runtime_1.jsx)(SWrapperIcon, { children: !isCopied ? ((0, jsx_runtime_1.jsx)(copy_icon_new_svg_1.default, { width: 20, height: 20, style: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }) })) : ((0, jsx_runtime_1.jsx)(copied_svg_1.default, { width: 20, height: 20, style: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }) })) })] }));
45
+ return ((0, jsx_runtime_1.jsxs)(index_1.Flex, { alignItems: "center", onClick: handleCopy, style: style, children: [children, (0, jsx_runtime_1.jsx)(SWrapperIcon, { children: !isCopied ? ((0, jsx_runtime_1.jsx)(copy_icon_new_svg_1.default, { width: '100%', height: '100%' })) : ((0, jsx_runtime_1.jsx)(copied_svg_1.default, { width: '100%', height: '100%' })) })] }));
45
46
  };
46
47
  exports.CopyButton = CopyButton;
@@ -13,7 +13,8 @@ var ServerErrorType;
13
13
  ServerErrorType["INTERNAL_ERROR"] = "INTERNAL_ERROR";
14
14
  })(ServerErrorType || (exports.ServerErrorType = ServerErrorType = {}));
15
15
  const getErrorAlertProps = (error) => {
16
- const errorExtensions = error.cause?.extensions;
16
+ const err = error;
17
+ const errorExtensions = err.cause?.extensions;
17
18
  switch (errorExtensions?.classification) {
18
19
  case ServerErrorType.BAD_REQUEST:
19
20
  case ServerErrorType.UNAUTHORIZED:
@@ -21,13 +22,13 @@ const getErrorAlertProps = (error) => {
21
22
  case ServerErrorType.NOT_FOUND:
22
23
  return {
23
24
  type: type_1.alertVariants.warning,
24
- caption: error.cause?.message || error.message,
25
+ caption: err.cause?.message || error.message,
25
26
  };
26
27
  case ServerErrorType.INTERNAL_ERROR:
27
28
  default:
28
29
  return !(0, env_1.isProdFromEnvForServer)() ? {
29
30
  type: type_1.alertVariants.error,
30
- caption: error.cause?.message || error.message,
31
+ caption: err.cause?.message || error.message,
31
32
  } : {
32
33
  type: type_1.alertVariants.error,
33
34
  caption: 'Internal server error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.3.83",
3
+ "version": "2.3.85",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",