@opexa/portal-components 0.0.19 → 0.0.20
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("lodash-es"),n=require("next/image"),s=require("react"),l=require("tailwind-merge");require("@opexa/portal-sdk-core");require("@tanstack/react-query");require("tiny-invariant");require("../../constants/index.js");require("../../utils/capitalize.js");const q=require("../../utils/formatNumber.js");require("../../utils/getLocaleInfo.js");require("../../utils/getQueryClient.js");require("../../utils/isMobile.js");require("../../utils/parseDecimal.js");require("../../client/services/getSession.js");require("@opexa/portal-sdk-core/object-id");require("../../client/hooks/useGlobalStore.js");require("../../client/hooks/useInfiniteQueryHelper.js");const C=require("../../client/hooks/useLocaleInfo.js");require("usehooks-ts");const I=require("../../icons/ChevronRightIcon.js"),M=require("../../icons/StarIcon.js"),S=require("../../icons/Trophy01Icon.js"),P=require("../../icons/Award01Icon.js"),T=require("../../images/first-place.png.js"),z=require("../../images/trophy-two.png.js"),u=require("../../images/trophy.png.js"),k=require("next/link"),D=require("../JackpotCounter/JackpotCounterItem.module.css.js");function R({jackpot:d,className:f,viewAllUrl:b}){const y=C.useLocaleInfo(),[a,x]=s.useState({days:0,hours:0,minutes:0,seconds:0,isPast:!1}),o=s.useMemo(()=>{const t=new Date;return new Date(t.setSeconds(t.getSeconds()+2*24*60*60))},[]),c=s.useCallback(()=>{const t=new Date,r=o.getTime()-t.getTime();if(r<=0){x({days:0,hours:0,minutes:0,seconds:0,isPast:!0});return}const i=Math.floor(r/1e3),g=Math.floor(i/(3600*24)),j=Math.floor(i%(3600*24)/3600),p=Math.floor(i%3600/60),N=i%60,v=w.pick({days:g,hours:j,minutes:p,seconds:N,isPast:!1},["days","hours","minutes","seconds","isPast"]);x(v)},[o]);s.useEffect(()=>{c();const t=setInterval(c,1e3);return()=>clearInterval(t)},[o,c]);const m=[{label:"Day",value:a.days},{label:"Hour",value:a.hours},{label:"Min",value:a.minutes},{label:"Sec",value:a.seconds}];return e.jsxs("div",{className:l.twMerge("bg-bg-tertiary border-border-primary relative flex shrink-0 rounded-2xl border p-3 text-center lg:gap-6 lg:p-5",f),children:[e.jsx("div",{className:"z-1 relative flex flex-1 flex-col",children:e.jsx("div",{className:"flex h-full flex-col justify-between",children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex w-full flex-col",children:[e.jsxs("div",{className:"relative flex w-full justify-between",children:[e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full justify-between",children:[e.jsxs("div",{className:"border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",children:[e.jsx(P.Award01Icon,{className:"text-utility-brand-500 size-3.5"}),"Multiplier"]}),e.jsx("div",{className:"flex h-fit",children:m.map((t,r)=>e.jsxs(s.Fragment,{children:[e.jsxs("div",{className:l.twMerge("bg-bg-primary text-text-primary-900 flex h-fit w-8 flex-col items-center rounded-[4px] pb-1.5"),children:[e.jsx("span",{className:"text-base font-medium",children:String(t.value).padStart(2,"0")}),e.jsx("span",{className:"text-[8px]",children:t.label})]}),r<m.length-1&&e.jsxs("div",{className:"flex flex-col justify-center gap-[6px] px-[6px]",children:[e.jsx("div",{className:"bg-bg-primary h-1 w-1 rounded-full"}),e.jsx("div",{className:"bg-bg-primary h-1 w-1 rounded-full"})]})]},t.label))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-text-primary-900 mt-2.5 text-left text-lg font-medium lg:mt-5 lg:text-2xl",children:d.name}),e.jsx("div",{className:"bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl",children:q.formatNumber(d.pool,{currency:y.currency.code,minDecimalPlaces:2,maxDecimalPlaces:2})}),e.jsx("div",{className:"text-text-primary-900 mt-4 block text-left text-base lg:hidden",children:"Play and Win!"})]}),e.jsx("div",{className:"flex items-end lg:hidden",children:e.jsx(n,{src:u,alt:"trophy",quality:100,className:"h-23 w-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("lodash-es"),n=require("next/image"),s=require("react"),l=require("tailwind-merge");require("@opexa/portal-sdk-core");require("@tanstack/react-query");require("tiny-invariant");require("../../constants/index.js");require("../../utils/capitalize.js");const q=require("../../utils/formatNumber.js");require("../../utils/getLocaleInfo.js");require("../../utils/getQueryClient.js");require("../../utils/isMobile.js");require("../../utils/parseDecimal.js");require("../../client/services/getSession.js");require("@opexa/portal-sdk-core/object-id");require("../../client/hooks/useGlobalStore.js");require("../../client/hooks/useInfiniteQueryHelper.js");const C=require("../../client/hooks/useLocaleInfo.js");require("usehooks-ts");const I=require("../../icons/ChevronRightIcon.js"),M=require("../../icons/StarIcon.js"),S=require("../../icons/Trophy01Icon.js"),P=require("../../icons/Award01Icon.js"),T=require("../../images/first-place.png.js"),z=require("../../images/trophy-two.png.js"),u=require("../../images/trophy.png.js"),k=require("next/link"),D=require("../JackpotCounter/JackpotCounterItem.module.css.js");function R({jackpot:d,className:f,viewAllUrl:b}){const y=C.useLocaleInfo(),[a,x]=s.useState({days:0,hours:0,minutes:0,seconds:0,isPast:!1}),o=s.useMemo(()=>{const t=new Date;return new Date(t.setSeconds(t.getSeconds()+2*24*60*60))},[]),c=s.useCallback(()=>{const t=new Date,r=o.getTime()-t.getTime();if(r<=0){x({days:0,hours:0,minutes:0,seconds:0,isPast:!0});return}const i=Math.floor(r/1e3),g=Math.floor(i/(3600*24)),j=Math.floor(i%(3600*24)/3600),p=Math.floor(i%3600/60),N=i%60,v=w.pick({days:g,hours:j,minutes:p,seconds:N,isPast:!1},["days","hours","minutes","seconds","isPast"]);x(v)},[o]);s.useEffect(()=>{c();const t=setInterval(c,1e3);return()=>clearInterval(t)},[o,c]);const m=[{label:"Day",value:a.days},{label:"Hour",value:a.hours},{label:"Min",value:a.minutes},{label:"Sec",value:a.seconds}];return e.jsxs("div",{className:l.twMerge("bg-bg-tertiary border-border-primary relative flex shrink-0 rounded-2xl border p-3 text-center lg:gap-6 lg:p-5",f),children:[e.jsx("div",{className:"z-1 relative flex flex-1 flex-col",children:e.jsx("div",{className:"flex h-full flex-col justify-between",children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex w-full flex-col",children:[e.jsxs("div",{className:"relative flex w-full justify-between",children:[e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full justify-between",children:[e.jsxs("div",{className:"border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",children:[e.jsx(P.Award01Icon,{className:"text-utility-brand-500 size-3.5"}),"Multiplier"]}),e.jsx("div",{className:"flex h-fit",children:m.map((t,r)=>e.jsxs(s.Fragment,{children:[e.jsxs("div",{className:l.twMerge("bg-bg-primary text-text-primary-900 flex h-fit w-8 flex-col items-center rounded-[4px] pb-1.5"),children:[e.jsx("span",{className:"text-base font-medium",children:String(t.value).padStart(2,"0")}),e.jsx("span",{className:"text-[8px]",children:t.label})]}),r<m.length-1&&e.jsxs("div",{className:"flex flex-col justify-center gap-[6px] px-[6px]",children:[e.jsx("div",{className:"bg-bg-primary h-1 w-1 rounded-full"}),e.jsx("div",{className:"bg-bg-primary h-1 w-1 rounded-full"})]})]},t.label))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-text-primary-900 mt-2.5 text-left text-lg font-medium lg:mt-5 lg:text-2xl",children:d.name}),e.jsx("div",{className:"bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl",children:q.formatNumber(d.pool,{currency:y.currency.code,minDecimalPlaces:2,maxDecimalPlaces:2})}),e.jsx("div",{className:"text-text-primary-900 mt-4 block text-left text-base lg:hidden",children:"Play and Win!"})]}),e.jsx("div",{className:"flex items-end lg:hidden",children:e.jsx(n,{src:u,alt:"trophy",quality:100,width:155,height:155,className:"h-23 w-auto"})})]})]}),e.jsx("div",{className:"z-1 absolute -bottom-16 right-0 hidden lg:block",children:e.jsx(n,{quality:100,width:155,height:155,src:u,alt:"trophy",className:"px-6 py-2.5"})})]}),e.jsxs("div",{className:"bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex",children:[e.jsx(n,{width:66,height:87,src:T,alt:"closeChest",className:"size-full h-auto w-[66px] mix-blend-luminosity"}),e.jsxs("div",{className:"flex flex-col gap-1 text-left",children:[e.jsxs("div",{className:"border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium",children:[e.jsx(S.Trophy01Icon,{className:"text-utility-brand-600 size-3.5"}),"Top Payout"]}),e.jsx("div",{className:"font-semibold",children:"No winners yet"}),e.jsx("div",{className:"text-text-secondary-700 text-xs",children:"You could be the first to win the tournament!"})]})]})]})})})}),e.jsxs("div",{className:"z-1 hidden flex-1 space-y-4 lg:block",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{width:24,height:24,src:z,quality:100,alt:"leaderboardIcon",className:"size-full w-6"}),e.jsx("div",{className:"text-text-primary-900 text-lg font-semibold",children:"Starting soon!"})]}),e.jsxs(k,{className:"text-button-tertiary-fg flex text-sm font-semibold",href:b??"/tournaments",children:["See details",e.jsx(I.ChevronRightIcon,{className:"size-5"})]})]}),e.jsx("div",{className:l.twMerge("max-h-[272px] overflow-y-scroll",D.default.scrollArea),children:e.jsx("div",{className:"border-gray-200 overflow-hidden rounded-xl",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary text-text-tertiary-600 h-8 text-xs font-medium",children:[e.jsx("th",{className:"w-[52px]",children:"#"}),e.jsx("th",{children:"Player"}),e.jsx("th",{children:"Multiplier"}),e.jsx("th",{children:"Prize"})]})}),e.jsx("tbody",{children:Array.from({length:10}).map((t,r)=>e.jsxs("tr",{className:"bg-bg-primary text-text-secondary-700 text-sm",children:[e.jsx("td",{className:"border-border-secondary h-12 w-[52px] border-t-2",children:r+1<6?e.jsxs("div",{className:"relative",children:[e.jsx(M.StarIcon,{className:l.twMerge("mx-auto size-6.5",h[r].starColor)}),e.jsx("span",{className:l.twMerge("absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold",h[r].numberColor),children:r+1})]}):"-"}),e.jsx("td",{className:"border-border-secondary h-12 border-t-2",children:"-"}),e.jsx("td",{className:"border-border-secondary h-12 border-t-2",children:"-"}),e.jsx("td",{className:"border-border-secondary h-12 border-t-2",children:"-"})]},r))})]})})})]})]})}const h=[{starColor:"text-yellow-400",numberColor:"text-bg-primary"},{starColor:"text-utility-gray-700",numberColor:"text-bg-primary"},{starColor:"text-yellow-700",numberColor:"text-bg-primary"},{starColor:"text-bg-quaternary",numberColor:"text-text-primary-900"},{starColor:"text-bg-quaternary",numberColor:"text-text-primary-900"}];exports.TournamentCounterItem=R;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { pick as P } from "lodash-es";
|
|
4
4
|
import o from "next/image";
|
|
5
|
-
import
|
|
5
|
+
import f, { useState as I, useMemo as S, useEffect as z } from "react";
|
|
6
6
|
import { twMerge as a } from "tailwind-merge";
|
|
7
7
|
import "@opexa/portal-sdk-core";
|
|
8
8
|
import "@tanstack/react-query";
|
|
@@ -26,10 +26,10 @@ import { Trophy01Icon as k } from "../../icons/Trophy01Icon.mjs";
|
|
|
26
26
|
import { Award01Icon as q } from "../../icons/Award01Icon.mjs";
|
|
27
27
|
import R from "../../images/first-place.png.mjs";
|
|
28
28
|
import A from "../../images/trophy-two.png.mjs";
|
|
29
|
-
import
|
|
29
|
+
import x from "../../images/trophy.png.mjs";
|
|
30
30
|
import _ from "next/link";
|
|
31
31
|
import E from "../JackpotCounter/JackpotCounterItem.module.css.mjs";
|
|
32
|
-
function
|
|
32
|
+
function xe({
|
|
33
33
|
jackpot: m,
|
|
34
34
|
className: b,
|
|
35
35
|
viewAllUrl: p
|
|
@@ -43,7 +43,7 @@ function he({
|
|
|
43
43
|
}), n = S(() => {
|
|
44
44
|
const r = /* @__PURE__ */ new Date();
|
|
45
45
|
return new Date(r.setSeconds(r.getSeconds() + 2 * 24 * 60 * 60));
|
|
46
|
-
}, []), d =
|
|
46
|
+
}, []), d = f.useCallback(() => {
|
|
47
47
|
const r = /* @__PURE__ */ new Date(), l = n.getTime() - r.getTime();
|
|
48
48
|
if (l <= 0) {
|
|
49
49
|
c({
|
|
@@ -69,7 +69,7 @@ function he({
|
|
|
69
69
|
const r = setInterval(d, 1e3);
|
|
70
70
|
return () => clearInterval(r);
|
|
71
71
|
}, [n, d]);
|
|
72
|
-
const
|
|
72
|
+
const h = [
|
|
73
73
|
{ label: "Day", value: i.days },
|
|
74
74
|
{ label: "Hour", value: i.hours },
|
|
75
75
|
{ label: "Min", value: i.minutes },
|
|
@@ -91,7 +91,7 @@ function he({
|
|
|
91
91
|
/* @__PURE__ */ e(q, { className: "text-utility-brand-500 size-3.5" }),
|
|
92
92
|
"Multiplier"
|
|
93
93
|
] }),
|
|
94
|
-
/* @__PURE__ */ e("div", { className: "flex h-fit", children:
|
|
94
|
+
/* @__PURE__ */ e("div", { className: "flex h-fit", children: h.map((r, l) => /* @__PURE__ */ t(f.Fragment, { children: [
|
|
95
95
|
/* @__PURE__ */ t(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
@@ -104,7 +104,7 @@ function he({
|
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
l <
|
|
107
|
+
l < h.length - 1 && /* @__PURE__ */ t("div", { className: "flex flex-col justify-center gap-[6px] px-[6px]", children: [
|
|
108
108
|
/* @__PURE__ */ e("div", { className: "bg-bg-primary h-1 w-1 rounded-full" }),
|
|
109
109
|
/* @__PURE__ */ e("div", { className: "bg-bg-primary h-1 w-1 rounded-full" })
|
|
110
110
|
] })
|
|
@@ -123,21 +123,23 @@ function he({
|
|
|
123
123
|
/* @__PURE__ */ e("div", { className: "flex items-end lg:hidden", children: /* @__PURE__ */ e(
|
|
124
124
|
o,
|
|
125
125
|
{
|
|
126
|
-
src:
|
|
126
|
+
src: x,
|
|
127
127
|
alt: "trophy",
|
|
128
128
|
quality: 100,
|
|
129
|
-
|
|
129
|
+
width: 155,
|
|
130
|
+
height: 155,
|
|
131
|
+
className: "h-23 w-auto"
|
|
130
132
|
}
|
|
131
133
|
) })
|
|
132
134
|
] })
|
|
133
135
|
] }),
|
|
134
|
-
/* @__PURE__ */ e("div", { className: "z-1 absolute bottom-
|
|
136
|
+
/* @__PURE__ */ e("div", { className: "z-1 absolute -bottom-16 right-0 hidden lg:block", children: /* @__PURE__ */ e(
|
|
135
137
|
o,
|
|
136
138
|
{
|
|
137
139
|
quality: 100,
|
|
138
140
|
width: 155,
|
|
139
141
|
height: 155,
|
|
140
|
-
src:
|
|
142
|
+
src: x,
|
|
141
143
|
alt: "trophy",
|
|
142
144
|
className: "px-6 py-2.5"
|
|
143
145
|
}
|
|
@@ -270,5 +272,5 @@ const u = [
|
|
|
270
272
|
}
|
|
271
273
|
];
|
|
272
274
|
export {
|
|
273
|
-
|
|
275
|
+
xe as TournamentCounterItem
|
|
274
276
|
};
|