@ludo.ninja/components 2.4.48 → 2.4.50

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.
@@ -7,9 +7,9 @@ exports.Wrapper = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const CheckListItem_1 = __importDefault(require("./CheckListItem"));
9
9
  const Congratulations_1 = __importDefault(require("./Congratulations"));
10
- const useCheckDiscordFollow_1 = require("../../api/server-identities/queries/useCheckDiscordFollow");
11
10
  const useSetEducatorBoost_1 = __importDefault(require("../../api/server-identities/mutations/useSetEducatorBoost"));
12
11
  const useSetShootingStarBoost_1 = __importDefault(require("../../api/server-identities/mutations/useSetShootingStarBoost"));
12
+ const useCheckDiscordFollow_1 = require("../../api/server-identities/queries/useCheckDiscordFollow");
13
13
  const useFetchProfile_1 = require("../../api/server-identities/queries/useFetchProfile");
14
14
  const useCheckFollow_1 = require("../../api/twitter/useCheckFollow");
15
15
  const ArrowIcon_1 = __importDefault(require("./icons/ArrowIcon"));
@@ -113,8 +113,8 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
113
113
  const twitterUserName = social?.twitter?.split("https://x.com/")?.[1] || "";
114
114
  const { followStatus, followStatusLoading } = (0, useCheckFollow_1.useCheckFollow)(twitterUserName);
115
115
  const { followDiscordStatus, followDiscordStatusLoading } = (0, useCheckDiscordFollow_1.useCheckDiscordFollow)();
116
- const { setEducatorBoost, loadingSetEducatorBoost } = (0, useSetEducatorBoost_1.default)();
117
- const { setShootingStarBoost, loadingSetShootingStarBoost } = (0, useSetShootingStarBoost_1.default)();
116
+ const { setEducatorBoost, loadingSetEducatorBoost, isSetEducatorBoost } = (0, useSetEducatorBoost_1.default)();
117
+ const { setShootingStarBoost, loadingSetShootingStarBoost, isSetShootingStarBoost } = (0, useSetShootingStarBoost_1.default)();
118
118
  const isSocialsConnected = social?.twitter && social?.telegramLink;
119
119
  const isCheckListDone = followStatus?.following && isSocialsConnected && social?.telegramId;
120
120
  const isShootingStarCheckListDone = isCheckListDone && followDiscordStatus?.following && social?.discordId;
@@ -122,18 +122,10 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
122
122
  const openModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.openModalSidebarPortal);
123
123
  const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
124
124
  const handleBecomeLudoEducator = () => {
125
- setEducatorBoost().then(() => {
126
- onBoostAdded && onBoostAdded();
127
- closeModalSidebarPortal();
128
- openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, {}));
129
- });
125
+ setEducatorBoost();
130
126
  };
131
127
  const handleBecomeLudoShootingStar = () => {
132
- setShootingStarBoost().then(() => {
133
- onBoostAdded && onBoostAdded();
134
- closeModalSidebarPortal();
135
- openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, { message: "You are now a Ludo Shooting Star! Check how you can take advantage of it." }));
136
- });
128
+ setShootingStarBoost();
137
129
  };
138
130
  const handleSubmit = () => {
139
131
  if (getSubmitButtonDisabled())
@@ -166,6 +158,20 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
166
158
  (0, react_1.useEffect)(() => {
167
159
  refetch();
168
160
  }, []);
161
+ (0, react_1.useEffect)(() => {
162
+ if (isSetEducatorBoost && !loadingSetEducatorBoost) {
163
+ onBoostAdded && onBoostAdded();
164
+ closeModalSidebarPortal();
165
+ openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, {}));
166
+ }
167
+ }, [isSetEducatorBoost, loadingSetEducatorBoost]);
168
+ (0, react_1.useEffect)(() => {
169
+ if (isSetShootingStarBoost && !loadingSetShootingStarBoost) {
170
+ onBoostAdded && onBoostAdded();
171
+ closeModalSidebarPortal();
172
+ openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, { message: "You are now a Ludo Shooting Star! Check how you can take advantage of it." }));
173
+ }
174
+ }, [isSetShootingStarBoost, loadingSetShootingStarBoost]);
169
175
  return ((0, jsx_runtime_1.jsxs)(exports.Wrapper, { className: className, style: style, children: [(0, jsx_runtime_1.jsx)(ui_2.H3, { children: "Join Ludo Educators" }), (0, jsx_runtime_1.jsxs)(CheckList, { children: [clientProfileLoading ? ((0, jsx_runtime_1.jsx)(StyledSkeleton, {})) : ((0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: !!social?.twitter, title: social?.twitter ? ("Connect Twitter") : ((0, jsx_runtime_1.jsxs)(StyledLink, { href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]}/settings`, children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Connect Twitter" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] })) })), clientProfileLoading ? ((0, jsx_runtime_1.jsx)(StyledSkeleton, {})) : ((0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: !!social?.telegramLink, title: social?.telegramLink ? ("Connect Telegram") : ((0, jsx_runtime_1.jsxs)(StyledLink, { href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]}/settings`, children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Connect Telegram" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] })) })), followStatusLoading || clientProfileLoading ? ((0, jsx_runtime_1.jsx)(StyledSkeleton, {})) : ((0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: Boolean(followStatus?.following), title: (0, jsx_runtime_1.jsx)(rc_tooltip_1.default, { placement: "top", trigger: ["hover", "click", "focus"], showArrow: false, styles: {
170
176
  root: {
171
177
  backgroundColor: "#ffffff",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.4.48",
3
+ "version": "2.4.50",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",