@ludo.ninja/components 2.4.32 → 2.4.34

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.
@@ -27,10 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const jsx_runtime_1 = require("react/jsx-runtime");
30
- const ambassadorBadge_1 = __importDefault(require("../../userBadges/ambassadorBadge"));
31
- const curatorBadge_1 = __importDefault(require("../../userBadges/curatorBadge"));
32
- const educatorBadge_1 = __importDefault(require("../../userBadges/educatorBadge"));
33
- const pioneerBadge_1 = __importDefault(require("../../userBadges/pioneerBadge"));
30
+ const boostBadge_1 = __importDefault(require("../../userBadges/boostBadge"));
34
31
  const store_1 = require("../../../modules/user/store");
35
32
  const env_1 = require("../../../store/env");
36
33
  const ScreenWidth_1 = require("../../../styles/ScreenWidth");
@@ -65,16 +62,7 @@ const BadgeStyles = (0, styled_components_1.css) `
65
62
  ${typography_1.FH5}
66
63
  }
67
64
  `;
68
- const SidebarEducatorBadge = (0, styled_components_1.default)(educatorBadge_1.default) `
69
- ${BadgeStyles};
70
- `;
71
- const SidebarPioneerBadge = (0, styled_components_1.default)(pioneerBadge_1.default) `
72
- ${BadgeStyles};
73
- `;
74
- const SidebarCuratorBadge = (0, styled_components_1.default)(curatorBadge_1.default) `
75
- ${BadgeStyles};
76
- `;
77
- const SidebarAmbassadorBadge = (0, styled_components_1.default)(ambassadorBadge_1.default) `
65
+ const SidebarBoostBadge = (0, styled_components_1.default)(boostBadge_1.default) `
78
66
  ${BadgeStyles};
79
67
  `;
80
68
  // Component
@@ -91,23 +79,7 @@ const SidebarInviteCodeLabel = () => {
91
79
  const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
92
80
  const unUsedInviteCodes = inviteCodes?.filter((code) => !code.isUsed);
93
81
  const profileData = (0, store_1.useUserStore)((state) => state.profileData);
94
- const getBadge = () => {
95
- switch (profileData?.getBoost()) {
96
- case "EDUCATOR":
97
- return (0, jsx_runtime_1.jsx)(SidebarEducatorBadge, { backgroundColor: "#ffffff" });
98
- case "AMBASSADOR":
99
- return (0, jsx_runtime_1.jsx)(SidebarAmbassadorBadge, { backgroundColor: "#ffffff" });
100
- case "CURATOR":
101
- return (0, jsx_runtime_1.jsx)(SidebarCuratorBadge, { backgroundColor: "#ffffff" });
102
- case "PIONEER":
103
- return (0, jsx_runtime_1.jsx)(SidebarPioneerBadge, { backgroundColor: "#ffffff" });
104
- case "SHOOTING_STAR":
105
- return (0, jsx_runtime_1.jsx)(SidebarEducatorBadge, { backgroundColor: "#ffffff", isShootingStar: true });
106
- default:
107
- return null;
108
- }
109
- };
110
- 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 }))] }) }));
82
+ 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 }), (0, jsx_runtime_1.jsx)(SidebarBoostBadge, { boostType: profileData?.getBoost(), previousBoostType: profileData?.getPreviousBoost(), backgroundColor: '#ffffff' }), !!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 }))] }) }));
111
83
  };
112
84
  // Export
113
85
  exports.default = SidebarInviteCodeLabel;
@@ -4,8 +4,8 @@ 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 boostBadge_1 = __importDefault(require("../boostBadge"));
7
+ const boostBadgeBase_1 = __importDefault(require("../boostBadgeBase"));
8
8
  const AmbassadorBadge = ({ className, backgroundColor = "#f3f4f9", isShootingStar }) => {
9
- return ((0, jsx_runtime_1.jsx)(boostBadge_1.default, { className: className, title: "Ambassador", colorSchema: { text: "#4357c5", gradient: { start: "#15d2ff", end: "#4c6dff" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
9
+ return ((0, jsx_runtime_1.jsx)(boostBadgeBase_1.default, { className: className, title: "Ambassador", colorSchema: { text: "#4357c5", gradient: { start: "#15d2ff", end: "#4c6dff" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
10
10
  };
11
11
  exports.default = AmbassadorBadge;
@@ -1,17 +1,9 @@
1
1
  import { FC } from "react";
2
- type ColorSchema = {
3
- text: string;
4
- gradient: {
5
- start: string;
6
- end: string;
7
- };
8
- };
9
2
  type Props = {
10
- title: string;
11
- colorSchema: ColorSchema;
3
+ boostType?: string | null;
4
+ previousBoostType?: string | null;
12
5
  className?: string;
13
6
  backgroundColor?: string;
14
- isShootingStar?: boolean;
15
7
  };
16
8
  declare const BoostBadge: FC<Props>;
17
9
  export default BoostBadge;
@@ -4,42 +4,38 @@ 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 ScreenWidth_1 = require("../../../styles/ScreenWidth");
8
- const Text_1 = require("@ludo.ninja/ui/build/system/Text");
9
- const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
10
- const styled_components_1 = __importDefault(require("styled-components"));
11
- const Wrapper = styled_components_1.default.div `
12
- display: flex;
13
- gap: 4px;
14
- padding: 3px 11px;
15
- justify-content: center;
16
- align-items: center;
17
-
18
- border-radius: 16px;
19
- border: 2px solid transparent;
20
- color: ${({ colorSchema }) => colorSchema.text};
21
- background: ${({ background, colorSchema }) => `linear-gradient(to right, ${background}, ${background}), linear-gradient(160deg,${colorSchema.gradient.start} 0%, ${colorSchema.gradient.end} 100%)`};
22
- background-clip: padding-box, border-box;
23
- background-origin: padding-box, border-box;
24
-
25
- .shootingStar {
26
- width: 16px;
27
- height: 16px;
28
- }
29
-
30
- ${ScreenWidth_1.mediaQuery.minWidthFourK} {
31
- padding: ${(0, _4k_1.adaptiveValueCalc)(3)} ${(0, _4k_1.adaptiveValueCalc)(11)};
32
- gap: ${(0, _4k_1.adaptiveValueCalc)(4)};
33
- border-radius: ${(0, _4k_1.adaptiveValueCalc)(16)};
34
- border: ${(0, _4k_1.adaptiveValueCalc)(2)} solid transparent;
35
-
36
- .shootingStar {
37
- width: ${(0, _4k_1.adaptiveValueCalc)(16)};
38
- height: ${(0, _4k_1.adaptiveValueCalc)(16)};
7
+ const ambassadorBadge_1 = __importDefault(require("../ambassadorBadge"));
8
+ const curatorBadge_1 = __importDefault(require("../curatorBadge"));
9
+ const educatorBadge_1 = __importDefault(require("../educatorBadge"));
10
+ const pioneerBadge_1 = __importDefault(require("../pioneerBadge"));
11
+ const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/identityHost/schema");
12
+ const getCommonBadge = (boostType) => {
13
+ switch (boostType) {
14
+ case schema_1.IBoostType.Educator:
15
+ return educatorBadge_1.default;
16
+ case schema_1.IBoostType.Ambassador:
17
+ return ambassadorBadge_1.default;
18
+ case schema_1.IBoostType.Curator:
19
+ return curatorBadge_1.default;
20
+ case schema_1.IBoostType.Pioneer:
21
+ return pioneerBadge_1.default;
22
+ default:
23
+ return educatorBadge_1.default;
24
+ }
25
+ };
26
+ const BoostBadge = ({ boostType, previousBoostType, backgroundColor, className }) => {
27
+ switch (boostType) {
28
+ case schema_1.IBoostType.Educator:
29
+ case schema_1.IBoostType.Ambassador:
30
+ case schema_1.IBoostType.Curator:
31
+ case schema_1.IBoostType.Pioneer:
32
+ const CommonBadgeComponent = getCommonBadge(boostType);
33
+ return CommonBadgeComponent && (0, jsx_runtime_1.jsx)(CommonBadgeComponent, { backgroundColor: backgroundColor, className: className });
34
+ case schema_1.IBoostType.ShootingStar:
35
+ const ShootingStarBadgeComponent = getCommonBadge(previousBoostType);
36
+ return (ShootingStarBadgeComponent && ((0, jsx_runtime_1.jsx)(ShootingStarBadgeComponent, { backgroundColor: backgroundColor, isShootingStar: true })));
37
+ default:
38
+ return null;
39
39
  }
40
- }
41
- `;
42
- const BoostBadge = ({ title, colorSchema, className, backgroundColor = "#f3f4f9", isShootingStar }) => {
43
- return ((0, jsx_runtime_1.jsxs)(Wrapper, { className: className, background: backgroundColor, colorSchema: colorSchema, children: [(0, jsx_runtime_1.jsx)(Text_1.H6, { children: title }), isShootingStar && ((0, jsx_runtime_1.jsx)("svg", { className: "shootingStar", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M14.9191 12.771C14.7615 11.8968 14.3666 11.0846 13.9229 10.3208C14.2409 10.9465 14.5173 11.597 14.6759 12.2805C14.8005 12.8445 14.8725 13.4934 14.594 14.0206C14.0277 15.0322 12.502 14.5841 11.6385 14.2227C8.13492 12.7302 3.84422 8.25495 2.61432 4.68106C2.44148 4.15261 2.23608 3.31291 2.49892 2.81721C2.61821 2.60082 2.84679 2.52942 3.08047 2.51074C3.46578 2.48687 3.82093 2.5688 4.21774 2.69252C5.4037 3.1064 6.53381 3.80599 7.57096 4.62179L6.53063 4.79782C6.17371 4.85819 6.0319 5.29018 6.2848 5.54655L7.76456 7.04752C7.86228 7.14651 7.90776 7.28504 7.88748 7.42219L7.58188 9.49703C7.52963 9.85162 7.90086 10.1186 8.22535 9.95989L10.125 9.03096C10.2504 8.96953 10.3976 8.96953 10.523 9.03096L12.4227 9.95989C12.7472 10.1186 13.1184 9.85162 13.0661 9.49703L12.7605 7.42219C12.7403 7.28504 12.7857 7.14651 12.8835 7.04752L14.3632 5.54655C14.6161 5.29018 14.4743 4.85818 14.1174 4.79782L12.0289 4.44444C11.8909 4.42101 11.7718 4.3354 11.7068 4.21284L10.7218 2.35621C10.5534 2.03902 10.0946 2.03902 9.92624 2.35621L9.25169 3.62763C7.35633 2.2187 4.97088 0.901879 3.07201 1.04257C2.28484 1.10621 1.58503 1.4879 1.24595 2.21543C1.0817 2.56974 1.02165 2.96654 1.03372 3.35191C1.19163 7.61026 9.03469 14.9923 13.3076 14.9676C14.0607 14.9446 14.6962 14.6151 14.9006 13.8582C14.9945 13.5049 14.9795 13.1274 14.9191 12.771Z", fill: "currentColor" }) }))] }));
44
40
  };
45
41
  exports.default = BoostBadge;
@@ -0,0 +1,17 @@
1
+ import { FC } from "react";
2
+ type ColorSchema = {
3
+ text: string;
4
+ gradient: {
5
+ start: string;
6
+ end: string;
7
+ };
8
+ };
9
+ type BoostBadgeBaseProps = {
10
+ title: string;
11
+ colorSchema: ColorSchema;
12
+ className?: string;
13
+ backgroundColor?: string;
14
+ isShootingStar?: boolean;
15
+ };
16
+ declare const BoostBadgeBase: FC<BoostBadgeBaseProps>;
17
+ export default BoostBadgeBase;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const ScreenWidth_1 = require("../../../styles/ScreenWidth");
8
+ const Text_1 = require("@ludo.ninja/ui/build/system/Text");
9
+ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
10
+ const styled_components_1 = __importDefault(require("styled-components"));
11
+ const Wrapper = styled_components_1.default.div `
12
+ display: flex;
13
+ gap: 4px;
14
+ padding: 3px 11px;
15
+ justify-content: center;
16
+ align-items: center;
17
+
18
+ border-radius: 16px;
19
+ border: 2px solid transparent;
20
+ color: ${({ colorSchema }) => colorSchema.text};
21
+ background: ${({ background, colorSchema }) => `linear-gradient(to right, ${background}, ${background}), linear-gradient(160deg,${colorSchema.gradient.start} 0%, ${colorSchema.gradient.end} 100%)`};
22
+ background-clip: padding-box, border-box;
23
+ background-origin: padding-box, border-box;
24
+
25
+ .shootingStar {
26
+ width: 16px;
27
+ height: 16px;
28
+ }
29
+
30
+ ${ScreenWidth_1.mediaQuery.minWidthFourK} {
31
+ padding: ${(0, _4k_1.adaptiveValueCalc)(3)} ${(0, _4k_1.adaptiveValueCalc)(11)};
32
+ gap: ${(0, _4k_1.adaptiveValueCalc)(4)};
33
+ border-radius: ${(0, _4k_1.adaptiveValueCalc)(16)};
34
+ border: ${(0, _4k_1.adaptiveValueCalc)(2)} solid transparent;
35
+
36
+ .shootingStar {
37
+ width: ${(0, _4k_1.adaptiveValueCalc)(16)};
38
+ height: ${(0, _4k_1.adaptiveValueCalc)(16)};
39
+ }
40
+ }
41
+ `;
42
+ const BoostBadgeBase = ({ title, colorSchema, className, backgroundColor = "#f3f4f9", isShootingStar, }) => {
43
+ return ((0, jsx_runtime_1.jsxs)(Wrapper, { className: className, background: backgroundColor, colorSchema: colorSchema, children: [(0, jsx_runtime_1.jsx)(Text_1.H6, { children: title }), isShootingStar && ((0, jsx_runtime_1.jsx)("svg", { className: "shootingStar", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M14.9191 12.771C14.7615 11.8968 14.3666 11.0846 13.9229 10.3208C14.2409 10.9465 14.5173 11.597 14.6759 12.2805C14.8005 12.8445 14.8725 13.4934 14.594 14.0206C14.0277 15.0322 12.502 14.5841 11.6385 14.2227C8.13492 12.7302 3.84422 8.25495 2.61432 4.68106C2.44148 4.15261 2.23608 3.31291 2.49892 2.81721C2.61821 2.60082 2.84679 2.52942 3.08047 2.51074C3.46578 2.48687 3.82093 2.5688 4.21774 2.69252C5.4037 3.1064 6.53381 3.80599 7.57096 4.62179L6.53063 4.79782C6.17371 4.85819 6.0319 5.29018 6.2848 5.54655L7.76456 7.04752C7.86228 7.14651 7.90776 7.28504 7.88748 7.42219L7.58188 9.49703C7.52963 9.85162 7.90086 10.1186 8.22535 9.95989L10.125 9.03096C10.2504 8.96953 10.3976 8.96953 10.523 9.03096L12.4227 9.95989C12.7472 10.1186 13.1184 9.85162 13.0661 9.49703L12.7605 7.42219C12.7403 7.28504 12.7857 7.14651 12.8835 7.04752L14.3632 5.54655C14.6161 5.29018 14.4743 4.85818 14.1174 4.79782L12.0289 4.44444C11.8909 4.42101 11.7718 4.3354 11.7068 4.21284L10.7218 2.35621C10.5534 2.03902 10.0946 2.03902 9.92624 2.35621L9.25169 3.62763C7.35633 2.2187 4.97088 0.901879 3.07201 1.04257C2.28484 1.10621 1.58503 1.4879 1.24595 2.21543C1.0817 2.56974 1.02165 2.96654 1.03372 3.35191C1.19163 7.61026 9.03469 14.9923 13.3076 14.9676C14.0607 14.9446 14.6962 14.6151 14.9006 13.8582C14.9945 13.5049 14.9795 13.1274 14.9191 12.771Z", fill: "currentColor" }) }))] }));
44
+ };
45
+ exports.default = BoostBadgeBase;
@@ -4,8 +4,8 @@ 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 boostBadge_1 = __importDefault(require("../boostBadge"));
7
+ const boostBadgeBase_1 = __importDefault(require("../boostBadgeBase"));
8
8
  const CuratorBadge = ({ className, backgroundColor, isShootingStar }) => {
9
- return ((0, jsx_runtime_1.jsx)(boostBadge_1.default, { className: className, title: "Curator", colorSchema: { text: "#32A73C", gradient: { start: "#6BEB2E", end: "#29AF33" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
9
+ return ((0, jsx_runtime_1.jsx)(boostBadgeBase_1.default, { className: className, title: "Curator", colorSchema: { text: "#32A73C", gradient: { start: "#6BEB2E", end: "#29AF33" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
10
10
  };
11
11
  exports.default = CuratorBadge;
@@ -4,8 +4,8 @@ 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 boostBadge_1 = __importDefault(require("../boostBadge"));
7
+ const boostBadgeBase_1 = __importDefault(require("../boostBadgeBase"));
8
8
  const EducatorBadge = ({ className, backgroundColor = "#f3f4f9", isShootingStar }) => {
9
- return ((0, jsx_runtime_1.jsx)(boostBadge_1.default, { className: className, title: "Educator", colorSchema: { text: "#5748bc", gradient: { start: "#e84eff", end: "#8946ff" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
9
+ return ((0, jsx_runtime_1.jsx)(boostBadgeBase_1.default, { className: className, title: "Educator", colorSchema: { text: "#5748bc", gradient: { start: "#e84eff", end: "#8946ff" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
10
10
  };
11
11
  exports.default = EducatorBadge;
@@ -4,8 +4,8 @@ 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 boostBadge_1 = __importDefault(require("../boostBadge"));
7
+ const boostBadgeBase_1 = __importDefault(require("../boostBadgeBase"));
8
8
  const PioneerBadge = ({ className, backgroundColor = "#f3f4f9", isShootingStar }) => {
9
- return ((0, jsx_runtime_1.jsx)(boostBadge_1.default, { className: className, title: "Pioneer", colorSchema: { text: "#e77d03", gradient: { start: "#ffe500", end: "#ff9419" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
9
+ return ((0, jsx_runtime_1.jsx)(boostBadgeBase_1.default, { className: className, title: "Pioneer", colorSchema: { text: "#e77d03", gradient: { start: "#ffe500", end: "#ff9419" } }, backgroundColor: backgroundColor, isShootingStar: isShootingStar }));
10
10
  };
11
11
  exports.default = PioneerBadge;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.4.32",
3
+ "version": "2.4.34",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "publish": "npm publish --access public -workspace @ludo.ninja/components"
24
24
  },
25
25
  "dependencies": {
26
- "@ludo.ninja/api": "^3.2.48",
26
+ "@ludo.ninja/api": "^3.2.56",
27
27
  "@marker.io/browser": "^0.19.0",
28
28
  "@next/third-parties": "^15.3.4",
29
29
  "@react-three/drei": "^9.68.3",