@ludo.ninja/components 2.4.4 → 2.4.5
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.
- package/build/components/sidebar/sidebarInviteCodeLabel/index.js +51 -2
- package/build/components/userBadges/ambassadorBadge/index.d.ts +1 -0
- package/build/components/userBadges/ambassadorBadge/index.js +3 -3
- package/build/components/userBadges/educatorBadge/index.d.ts +1 -0
- package/build/components/userBadges/educatorBadge/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -11,13 +34,17 @@ const ExperienceLabel_1 = __importDefault(require("../../../system/Labels/Experi
|
|
|
11
34
|
const InviteLabel_1 = __importDefault(require("../../../system/Labels/InviteLabel"));
|
|
12
35
|
const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
|
|
13
36
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
14
|
-
const styled_components_1 =
|
|
37
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
38
|
+
const educatorBadge_1 = __importDefault(require("../../userBadges/educatorBadge"));
|
|
39
|
+
const ambassadorBadge_1 = __importDefault(require("../../userBadges/ambassadorBadge"));
|
|
40
|
+
const typography_1 = require("@ludo.ninja/ui/build/styles/typography");
|
|
15
41
|
// import UserStreak from "@/components/base/UserStreak";
|
|
16
42
|
// Styles
|
|
17
43
|
const StyledSidebarInviteCodeLabel = styled_components_1.default.div `
|
|
18
44
|
display: flex;
|
|
19
45
|
gap: 16px;
|
|
20
46
|
margin-top: 16px;
|
|
47
|
+
flex-wrap: wrap;
|
|
21
48
|
|
|
22
49
|
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
23
50
|
gap: ${(0, _4k_1.adaptiveValueCalc)(16)};
|
|
@@ -31,6 +58,17 @@ const StyledSidebarInviteCodeLabel = styled_components_1.default.div `
|
|
|
31
58
|
// margin-top: ${adaptiveValueCalc(16)};
|
|
32
59
|
// }
|
|
33
60
|
// `;
|
|
61
|
+
const BadgeStyles = (0, styled_components_1.css) `
|
|
62
|
+
h6 {
|
|
63
|
+
${typography_1.FH5}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const SidebarEducatorBadge = (0, styled_components_1.default)(educatorBadge_1.default) `
|
|
67
|
+
${BadgeStyles};
|
|
68
|
+
`;
|
|
69
|
+
const SidebarAmbassadorBadge = (0, styled_components_1.default)(ambassadorBadge_1.default) `
|
|
70
|
+
${BadgeStyles};
|
|
71
|
+
`;
|
|
34
72
|
// Component
|
|
35
73
|
const SidebarInviteCodeLabel = () => {
|
|
36
74
|
const { getUser, userExp, isLoadingExp, errorExp, isLoadingProfileData, inviteCodes } = (0, store_1.useUserStore)((state) => ({
|
|
@@ -44,7 +82,18 @@ const SidebarInviteCodeLabel = () => {
|
|
|
44
82
|
const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
|
|
45
83
|
const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
|
|
46
84
|
const unUsedInviteCodes = inviteCodes?.filter((code) => !code.isUsed);
|
|
47
|
-
|
|
85
|
+
const profileData = (0, store_1.useUserStore)((state) => state.profileData);
|
|
86
|
+
const getBadge = () => {
|
|
87
|
+
switch (profileData?.getBoost()) {
|
|
88
|
+
case 'EDUCATOR':
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(SidebarEducatorBadge, { backgroundColor: '#ffffff' });
|
|
90
|
+
case 'AMBASSADOR':
|
|
91
|
+
return (0, jsx_runtime_1.jsx)(SidebarAmbassadorBadge, { backgroundColor: '#ffffff' });
|
|
92
|
+
default:
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
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 }), getBadge(), !!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 }))] }) }));
|
|
48
97
|
};
|
|
49
98
|
// Export
|
|
50
99
|
exports.default = SidebarInviteCodeLabel;
|
|
@@ -17,7 +17,7 @@ const Wrapper = styled_components_1.default.div `
|
|
|
17
17
|
border-radius: 16px;
|
|
18
18
|
border: 2px solid transparent;
|
|
19
19
|
color: #4357C5;
|
|
20
|
-
background: linear-gradient(to right,
|
|
20
|
+
background: ${({ background }) => `linear-gradient(to right, ${background}, ${background})`} ,
|
|
21
21
|
linear-gradient(160deg, #15D2FF 0%, #4C6DFF 100%);
|
|
22
22
|
background-clip: padding-box, border-box;
|
|
23
23
|
background-origin: padding-box, border-box;
|
|
@@ -28,7 +28,7 @@ const Wrapper = styled_components_1.default.div `
|
|
|
28
28
|
border: ${(0, _4k_1.adaptiveValueCalc)(2)} solid transparent;
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
|
-
const AmbassadorBadge = ({ className }) => {
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(Wrapper, { className: className, children: (0, jsx_runtime_1.jsx)(index_1.H6, { children: "Ambassador" }) }));
|
|
31
|
+
const AmbassadorBadge = ({ className, backgroundColor = '#f3f4f9' }) => {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, { className: className, background: backgroundColor, children: (0, jsx_runtime_1.jsx)(index_1.H6, { children: "Ambassador" }) }));
|
|
33
33
|
};
|
|
34
34
|
exports.default = AmbassadorBadge;
|
|
@@ -17,7 +17,7 @@ const Wrapper = styled_components_1.default.div `
|
|
|
17
17
|
border-radius: 16px;
|
|
18
18
|
border: 2px solid transparent;
|
|
19
19
|
color: #5748bc;
|
|
20
|
-
background: linear-gradient(to right,
|
|
20
|
+
background: ${({ background }) => `linear-gradient(to right, ${background}, ${background})`},
|
|
21
21
|
linear-gradient(160deg, #e84eff 0%, #8946ff 100%);
|
|
22
22
|
background-clip: padding-box, border-box;
|
|
23
23
|
background-origin: padding-box, border-box;
|
|
@@ -28,7 +28,7 @@ const Wrapper = styled_components_1.default.div `
|
|
|
28
28
|
border: ${(0, _4k_1.adaptiveValueCalc)(2)} solid transparent;
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
|
-
const EducatorBadge = ({ className }) => {
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(Wrapper, { className: className, children: (0, jsx_runtime_1.jsx)(index_1.H6, { children: "Educator" }) }));
|
|
31
|
+
const EducatorBadge = ({ className, backgroundColor = '#f3f4f9' }) => {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, { className: className, background: backgroundColor, children: (0, jsx_runtime_1.jsx)(index_1.H6, { children: "Educator" }) }));
|
|
33
33
|
};
|
|
34
34
|
exports.default = EducatorBadge;
|