@ludo.ninja/components 2.4.2 → 2.4.4

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.
@@ -108,18 +108,18 @@ const useSidebarData = () => {
108
108
  icon: (0, jsx_runtime_1.jsx)(icons_1.RewardsIcon, {}),
109
109
  isExternalUrl: false,
110
110
  },
111
- {
112
- href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]}/referrals`,
113
- title: "Referral Dashboard",
114
- icon: (0, jsx_runtime_1.jsx)(icons_1.ReferralDashboardIcon, {}),
115
- isExternalUrl: false,
116
- },
117
- {
118
- href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/invite-codes`,
119
- title: "My invites",
120
- icon: (0, jsx_runtime_1.jsx)(icons_1.MyInvitesIcon, {}),
121
- isExternalUrl: false,
122
- },
111
+ // {
112
+ // href: `${ludoDomains[NEXT_PUBLIC_ENV_VALUE as TEnvValue]["account"]}/referrals`,
113
+ // title: "Referral Dashboard",
114
+ // icon: <ReferralDashboardIcon />,
115
+ // isExternalUrl: false,
116
+ // },
117
+ // {
118
+ // href: `${ludoDomains[NEXT_PUBLIC_ENV_VALUE as TEnvValue]["app"]}/invite-codes`,
119
+ // title: "My invites",
120
+ // icon: <MyInvitesIcon />,
121
+ // isExternalUrl: false,
122
+ // },
123
123
  ]
124
124
  : []),
125
125
  ];
@@ -7,8 +7,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const data_1 = require("./data");
8
8
  const sidebarInviteCodeLabel_1 = __importDefault(require("./sidebarInviteCodeLabel"));
9
9
  const useExtension_1 = __importDefault(require("../../hooks/extension/useExtension"));
10
+ const useRefCode_1 = require("../../hooks/refCode/useRefCode");
10
11
  const useSignOut_1 = require("../../modules/user/auth/useSignOut");
11
12
  const store_1 = require("../../modules/user/store");
13
+ const env_1 = require("../../store/env");
12
14
  const ui_1 = require("../../store/ui");
13
15
  const ScreenWidth_1 = require("../../styles/ScreenWidth");
14
16
  const Userpic_1 = __importDefault(require("../../system/Img/Userpic"));
@@ -21,7 +23,6 @@ const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Button
21
23
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
22
24
  const link_1 = __importDefault(require("next/link"));
23
25
  const styled_components_1 = __importDefault(require("styled-components"));
24
- const useRefCode_1 = require("../../hooks/refCode/useRefCode");
25
26
  const MenuItem = styled_components_1.default.div `
26
27
  font-size: 15px;
27
28
  font-weight: 500;
@@ -101,6 +102,7 @@ const Sidebar = () => {
101
102
  const closeSidebar = (0, ui_1.useUiStore)((state) => state.closeSidebar);
102
103
  const isSidebarOpen = (0, ui_1.useUiStore)((state) => state.isSidebarOpen);
103
104
  const isAuthorized = (0, store_1.useUserStore)((state) => state.isSignedIn);
105
+ const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
104
106
  const getUser = (0, store_1.useUserStore)((state) => state.user);
105
107
  const signOut = (0, useSignOut_1.useSignOut)();
106
108
  const { deviceType } = (0, screen_1.useWindowDimensions)();
@@ -121,7 +123,7 @@ const Sidebar = () => {
121
123
  menu: sideBarData.map(({ title, href, icon, isExternalUrl }) => ((0, jsx_runtime_1.jsxs)(SLink, { href: href, target: isExternalUrl ? "_blank" : "_self", onClick: closeSidebar, passHref: isExternalUrl, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), children: [(0, jsx_runtime_1.jsx)("span", { className: "icon-wrapper", children: icon }), title] }, title))),
122
124
  userPicture: ({ children, height, width, isNeedBoxTransform }) => ((0, jsx_runtime_1.jsx)(Userpic_1.default, { width: width, height: height, userId: userId, isNeedBoxTransform: isNeedBoxTransform, children: children })),
123
125
  inviteCode: (0, jsx_runtime_1.jsx)(sidebarInviteCodeLabel_1.default, {}),
124
- ...(deviceType == "isDesktop" && isAuthorized
126
+ ...(deviceType == "isDesktop" && isAuthorized && !isProd()
125
127
  ? {
126
128
  beforeMenu: ((0, jsx_runtime_1.jsx)(BeforeMenuContainer, { children: isExtensionInstalled ? ((0, jsx_runtime_1.jsxs)(MenuItem, { onClick: () => {
127
129
  closeSidebar();
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const styled_components_1 = __importDefault(require("styled-components"));
8
- const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
9
7
  const store_1 = require("../../../modules/user/store");
8
+ const env_1 = require("../../../store/env");
10
9
  const ScreenWidth_1 = require("../../../styles/ScreenWidth");
11
10
  const ExperienceLabel_1 = __importDefault(require("../../../system/Labels/ExperienceLabel"));
12
11
  const InviteLabel_1 = __importDefault(require("../../../system/Labels/InviteLabel"));
13
- const env_1 = require("../../../store/env");
14
12
  const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
13
+ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
14
+ const styled_components_1 = __importDefault(require("styled-components"));
15
15
  // import UserStreak from "@/components/base/UserStreak";
16
16
  // Styles
17
17
  const StyledSidebarInviteCodeLabel = styled_components_1.default.div `
@@ -33,7 +33,7 @@ const StyledSidebarInviteCodeLabel = styled_components_1.default.div `
33
33
  // `;
34
34
  // Component
35
35
  const SidebarInviteCodeLabel = () => {
36
- const { getUser, userExp, isLoadingExp, errorExp, isLoadingProfileData, inviteCodes, } = (0, store_1.useUserStore)((state) => ({
36
+ const { getUser, userExp, isLoadingExp, errorExp, isLoadingProfileData, inviteCodes } = (0, store_1.useUserStore)((state) => ({
37
37
  getUser: state.user,
38
38
  userExp: state.userExp,
39
39
  isLoadingExp: state.isLoadingExp,
@@ -42,8 +42,9 @@ const SidebarInviteCodeLabel = () => {
42
42
  inviteCodes: state.inviteCodes,
43
43
  }));
44
44
  const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
45
+ const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
45
46
  const unUsedInviteCodes = inviteCodes?.filter((code) => !code.isUsed);
46
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(StyledSidebarInviteCodeLabel, { children: [(0, jsx_runtime_1.jsx)(ExperienceLabel_1.default, { value: userExp.xps, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/rewards/${getUser?.userId}`, loading: isLoadingExp || !!errorExp }), !!unUsedInviteCodes && ((0, jsx_runtime_1.jsx)(InviteLabel_1.default, { value: unUsedInviteCodes.length, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/invite-codes`, loading: isLoadingProfileData }))] }) }));
47
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(StyledSidebarInviteCodeLabel, { children: [(0, jsx_runtime_1.jsx)(ExperienceLabel_1.default, { value: userExp.xps, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/rewards/${getUser?.userId}`, loading: isLoadingExp || !!errorExp }), !!unUsedInviteCodes && !isProd() && ((0, jsx_runtime_1.jsx)(InviteLabel_1.default, { value: unUsedInviteCodes.length, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/invite-codes`, loading: isLoadingProfileData }))] }) }));
47
48
  };
48
49
  // Export
49
50
  exports.default = SidebarInviteCodeLabel;
@@ -19,6 +19,7 @@ const sidebar_1 = require("@ludo.ninja/ui/build/components/sidebar");
19
19
  const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Buttons/MainButton"));
20
20
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
21
21
  const styled_components_1 = __importDefault(require("styled-components"));
22
+ const env_1 = require("../../store/env");
22
23
  const MenuItem = styled_components_1.default.div `
23
24
  font-size: 15px;
24
25
  font-weight: 500;
@@ -98,6 +99,7 @@ const SidebarSpa = ({ SLink, UserPic, SidebarInviteCodeLabel, }) => {
98
99
  const closeSidebar = (0, ui_1.useUiStore)((state) => state.closeSidebar);
99
100
  const isSidebarOpen = (0, ui_1.useUiStore)((state) => state.isSidebarOpen);
100
101
  const isAuthorized = (0, store_1.useUserStore)((state) => state.isSignedIn);
102
+ const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
101
103
  const getUser = (0, store_1.useUserStore)((state) => state.user);
102
104
  const signOut = (0, useSignOut_1.useSignOut)();
103
105
  const { deviceType } = (0, screen_1.useWindowDimensions)();
@@ -118,7 +120,7 @@ const SidebarSpa = ({ SLink, UserPic, SidebarInviteCodeLabel, }) => {
118
120
  menu: sideBarData.map(({ title, href, icon, isExternalUrl }) => ((0, jsx_runtime_1.jsxs)(SLink, { href: href, target: isExternalUrl ? "_blank" : "_self", onClick: closeSidebar, passHref: isExternalUrl, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), children: [(0, jsx_runtime_1.jsx)("span", { className: "icon-wrapper", children: icon }), title] }, title))),
119
121
  userPicture: ({ children, height, width, isNeedBoxTransform }) => ((0, jsx_runtime_1.jsx)(UserPic, { width: width, height: height, userId: userId, isNeedBoxTransform: isNeedBoxTransform, children: children })),
120
122
  inviteCode: (0, jsx_runtime_1.jsx)(SidebarInviteCodeLabel, {}),
121
- ...(deviceType == "isDesktop" && isAuthorized
123
+ ...(deviceType == "isDesktop" && isAuthorized && !isProd()
122
124
  ? {
123
125
  beforeMenu: ((0, jsx_runtime_1.jsx)(BeforeMenuContainer, { children: isExtensionInstalled ? ((0, jsx_runtime_1.jsxs)(MenuItem, { onClick: () => {
124
126
  closeSidebar();
@@ -6,6 +6,7 @@ interface Props {
6
6
  onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
7
7
  name: string;
8
8
  isError: boolean;
9
+ disabled?: boolean;
9
10
  menuPortalTarget?: HTMLElement;
10
11
  }
11
12
  declare const BlockChainSelect: React.FC<Props>;
@@ -155,9 +155,10 @@ const Option = (props) => {
155
155
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_select_1.components.Option, { ...props, children: (0, jsx_runtime_1.jsxs)(OptionWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.label }), props.label] }) }) }));
156
156
  };
157
157
  const SingleValue = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)(react_select_1.components.SingleValue, { ...props, children: (0, jsx_runtime_1.jsxs)(SingleValueWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.data.label }), children] }) }));
158
- const BlockChainSelect = ({ menuPortalTarget, isLoading, isError, onChangeHandler, defaultOptionValue, name, }) => {
158
+ const BlockChainSelect = ({ menuPortalTarget, isLoading, isError, disabled, onChangeHandler, defaultOptionValue, name, }) => {
159
159
  const getStaticENVDomain = (0, env_1.useEnvStore)((state) => state.getStaticDomain);
160
- return ((0, jsx_runtime_1.jsx)(StyledSelect, { isError: isError, options: getBlockchainOptions(getStaticENVDomain()), isLoading: isLoading, isSearchable: true, onChangeHandler: onChangeHandler, name: name, customComponents: { Option, SingleValue }, ...(menuPortalTarget
160
+ const options = getBlockchainOptions(getStaticENVDomain());
161
+ return ((0, jsx_runtime_1.jsx)(StyledSelect, { disabled: disabled, isError: isError, options: options, isLoading: isLoading, isSearchable: true, onChangeHandler: onChangeHandler, name: name, customComponents: { Option, SingleValue }, ...(menuPortalTarget
161
162
  ? {
162
163
  styles: {
163
164
  menuPortal: (base) => ({
@@ -1,5 +1,6 @@
1
- declare const SubmitNewProjectForm: ({ blockchain, contractAddress }: {
1
+ declare const SubmitNewProjectForm: ({ blockchain, contractAddress, disabledBlockchainSelect }: {
2
2
  blockchain?: string;
3
3
  contractAddress?: string;
4
+ disabledBlockchainSelect?: boolean;
4
5
  }) => import("react/jsx-runtime").JSX.Element;
5
6
  export default SubmitNewProjectForm;
@@ -105,7 +105,7 @@ const StyledCreateForm = styled_components_1.default.div `
105
105
  }
106
106
  }
107
107
  `;
108
- const SubmitNewProjectForm = ({ blockchain, contractAddress }) => {
108
+ const SubmitNewProjectForm = ({ blockchain, contractAddress, disabledBlockchainSelect }) => {
109
109
  const { control, register, handleSubmit, formState: { errors }, setError, setFocus, watch, } = (0, react_hook_form_1.useForm)({
110
110
  mode: 'all',
111
111
  defaultValues: {
@@ -171,7 +171,7 @@ const SubmitNewProjectForm = ({ blockchain, contractAddress }) => {
171
171
  };
172
172
  return ((0, jsx_runtime_1.jsxs)(StyledCreateForm, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'head', children: [(0, jsx_runtime_1.jsx)("h3", { className: 'tittle', children: 'Submit New Project' }), (0, jsx_runtime_1.jsx)(Text_1.MainText, { color: colors_1.TextGrayColor, children: "Add your favorite project to follow up it on Ludo" })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsxs)("div", { className: 'content', children: [(0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(Forms_1.Input, { register: registerContract, error: errorContract, data: dataForContract }) }), (0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: "blockchain", control: control, rules: {
173
173
  required: { message: 'Blockchain is required', value: true },
174
- }, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(blockchainSelect_1.default, { isError: Boolean(errors.blockchain), isLoading: false, onChangeHandler: async (fieldName, fieldValue) => field.onChange(fieldValue), name: field.name }), errors.blockchain && ((0, jsx_runtime_1.jsx)(Forms_1.BasicErrorLabel, { children: errors.blockchain.message }))] })) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add', type: 'submit', variant: "primaryM", disabled: loading, onClick: () => null }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Cancel', variant: "outline", onClick: () => {
174
+ }, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(blockchainSelect_1.default, { defaultOptionValue: blockchain, disabled: disabledBlockchainSelect, isError: Boolean(errors.blockchain), isLoading: false, onChangeHandler: async (fieldName, fieldValue) => field.onChange(fieldValue), name: field.name }), errors.blockchain && ((0, jsx_runtime_1.jsx)(Forms_1.BasicErrorLabel, { children: errors.blockchain.message }))] })) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add', type: 'submit', variant: "primaryM", disabled: loading, onClick: () => null }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Cancel', variant: "outline", onClick: () => {
175
175
  closeModalSidebarPortal();
176
176
  } })] })] })] }));
177
177
  };
@@ -8,6 +8,7 @@ interface Props {
8
8
  defaultOptionValue?: string;
9
9
  isLoading?: boolean;
10
10
  isSearchable?: boolean;
11
+ disabled?: boolean;
11
12
  onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
12
13
  name: string;
13
14
  customComponents?: Partial<SelectComponents<unknown, boolean, GroupBase<unknown>>>;
@@ -51,6 +51,7 @@ const SelectElement = (0, styled_components_1.default)(react_select_1.default) `
51
51
  border-radius: 6px;
52
52
  box-shadow: none;
53
53
  min-height: ${(props) => `${props.minHeight}px`};
54
+ opacity: ${(props) => props.isDisabled ? 0.5 : 1};
54
55
  cursor: pointer;
55
56
 
56
57
  &:hover,
@@ -108,7 +109,7 @@ const SelectElement = (0, styled_components_1.default)(react_select_1.default) `
108
109
  cursor: pointer;
109
110
  }
110
111
 
111
- ${ScreenWidth_1.mediaQuery.minWidthFourK} {
112
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
112
113
  .react-select__value-container {
113
114
  padding: 0 0 0 ${(0, _4k_1.adaptiveValueCalc)(20)};
114
115
  }
@@ -149,7 +150,7 @@ const DropdownIndicator = (props) => {
149
150
  transform: props.selectProps.menuIsOpen ? "rotate(180deg)" : "rotate(0)",
150
151
  }, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M16 11L12 15L8 11", stroke: "#696F91", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
151
152
  };
152
- const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, customComponents, isSearchable, ...props }) => {
153
+ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, customComponents, isSearchable, disabled, ...props }) => {
153
154
  const [selectedOption, setSelectedOption] = (0, react_1.useState)(options.find((option) => {
154
155
  return defaultOptionValue === option.id;
155
156
  }) || null);
@@ -158,7 +159,7 @@ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue
158
159
  return defaultOptionValue === option.id;
159
160
  });
160
161
  setSelectedOption(findOption || null);
161
- }, [defaultOptionValue]);
162
+ }, [defaultOptionValue, options]);
162
163
  const handleChangeOption = async (option) => {
163
164
  await onChangeHandler(name, option.id);
164
165
  setSelectedOption(option);
@@ -172,7 +173,7 @@ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue
172
173
  const { windowDimensions } = (0, screen_1.useWindowDimensionsWithServerInitial)();
173
174
  if (isLoading)
174
175
  return (0, jsx_runtime_1.jsx)(react_loading_skeleton_1.default, { height: `${minHeight}px`, width: "154px" });
175
- return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable: isSearchable, components: {
176
+ return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable: isSearchable, isDisabled: disabled, components: {
176
177
  DropdownIndicator,
177
178
  IndicatorSeparator: () => null,
178
179
  ...customComponents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",