@devrongx/games 0.4.25 → 0.4.27
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/package.json
CHANGED
|
@@ -462,6 +462,7 @@ export const PreMatchBetsPopup = ({ poolId, matchId: _matchId, match: matchProp
|
|
|
462
462
|
editSubmitting={editSubmitting}
|
|
463
463
|
savedBetSummary={savedBetSummary}
|
|
464
464
|
hasUnsavedEdits={hasUnsavedEdits}
|
|
465
|
+
onGoToIntro={() => setUserFlowState("intro")}
|
|
465
466
|
/>
|
|
466
467
|
)}
|
|
467
468
|
|
|
@@ -56,6 +56,7 @@ interface PreMatchGameProps {
|
|
|
56
56
|
editSubmitting?: number | null;
|
|
57
57
|
savedBetSummary?: IBetSummary | null;
|
|
58
58
|
hasUnsavedEdits?: boolean;
|
|
59
|
+
onGoToIntro?: () => void;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
// ─── Component ───────────────────────────────────────────────────────────────
|
|
@@ -66,7 +67,7 @@ export const PreMatchGame = ({
|
|
|
66
67
|
parlayEnabled = false, submitting = false,
|
|
67
68
|
ignoredMarkets: _ignoredMarkets, onToggleIgnore, editingMarkets: _editingMarkets,
|
|
68
69
|
dirtyMarkets: _dirtyMarkets, onEditMarket, onConfirmMarketEdit, onCancelMarketEdit,
|
|
69
|
-
editSubmitting, savedBetSummary, hasUnsavedEdits = false,
|
|
70
|
+
editSubmitting, savedBetSummary, hasUnsavedEdits = false, onGoToIntro,
|
|
70
71
|
}: PreMatchGameProps) => {
|
|
71
72
|
const ignoredMarkets = _ignoredMarkets ?? EMPTY_SET;
|
|
72
73
|
const editingMarkets = _editingMarkets ?? EMPTY_SET;
|
|
@@ -77,11 +78,6 @@ export const PreMatchGame = ({
|
|
|
77
78
|
// Whether bets have been submitted to the server at least once
|
|
78
79
|
const hasSubmitted = !!submittedBets && Object.keys(submittedBets).length > 0;
|
|
79
80
|
|
|
80
|
-
// Button state for initial submit flow (fresh = never submitted)
|
|
81
|
-
const buttonState = useMemo<"fresh" | "submitted">(() => {
|
|
82
|
-
return hasSubmitted ? "submitted" : "fresh";
|
|
83
|
-
}, [hasSubmitted]);
|
|
84
|
-
|
|
85
81
|
const goTo = useGamePopupStore(s => s.goTo);
|
|
86
82
|
|
|
87
83
|
// ── Onboarding — visible whenever no points have been bet yet ─────────────
|
|
@@ -144,11 +140,6 @@ export const PreMatchGame = ({
|
|
|
144
140
|
});
|
|
145
141
|
}, []);
|
|
146
142
|
|
|
147
|
-
const handleExpandAll = useCallback(() => setCollapsedMarkets(new Set()), []);
|
|
148
|
-
const handleCollapseAll = useCallback(() => {
|
|
149
|
-
setCollapsedMarkets(new Set(config.markets.map((_, i) => i)));
|
|
150
|
-
}, [config.markets]);
|
|
151
|
-
|
|
152
143
|
// ── Computed: filtered/sorted market indices ─────────────────────────────
|
|
153
144
|
const sortActive = activeFilters.has("bets_first") || activeFilters.has("unanswered_first");
|
|
154
145
|
|
|
@@ -165,17 +156,29 @@ export const PreMatchGame = ({
|
|
|
165
156
|
});
|
|
166
157
|
} else if (activeFilters.has("unanswered_first")) {
|
|
167
158
|
indices.sort((a, b) => {
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
return
|
|
159
|
+
const aHasAmount = (bets[a]?.amount ?? 0) > 0 ? 1 : 0;
|
|
160
|
+
const bHasAmount = (bets[b]?.amount ?? 0) > 0 ? 1 : 0;
|
|
161
|
+
return aHasAmount - bHasAmount || a - b;
|
|
171
162
|
});
|
|
172
163
|
}
|
|
173
164
|
return indices;
|
|
174
165
|
}, [config.markets, activeFilters, ignoredMarkets, bets]);
|
|
175
166
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
167
|
+
const handleExpandAll = useCallback(() => {
|
|
168
|
+
setCollapsedMarkets(prev => {
|
|
169
|
+
const next = new Set(prev);
|
|
170
|
+
for (const i of visibleMarketIndices) next.delete(i);
|
|
171
|
+
return next;
|
|
172
|
+
});
|
|
173
|
+
}, [visibleMarketIndices]);
|
|
174
|
+
|
|
175
|
+
const handleCollapseAll = useCallback(() => {
|
|
176
|
+
setCollapsedMarkets(prev => {
|
|
177
|
+
const next = new Set(prev);
|
|
178
|
+
for (const i of visibleMarketIndices) next.add(i);
|
|
179
|
+
return next;
|
|
180
|
+
});
|
|
181
|
+
}, [visibleMarketIndices]);
|
|
179
182
|
|
|
180
183
|
// Category headers — only shown when no sort is active
|
|
181
184
|
const categoryForIndex = useMemo(() => {
|
|
@@ -249,7 +252,7 @@ export const PreMatchGame = ({
|
|
|
249
252
|
{/* How to Play + Filter pills */}
|
|
250
253
|
<div className="pt-2 flex items-center gap-2 overflow-x-auto scrollbar-hide">
|
|
251
254
|
<button
|
|
252
|
-
onClick={() => goTo("intro")}
|
|
255
|
+
onClick={() => { onGoToIntro ? onGoToIntro() : goTo("intro"); }}
|
|
253
256
|
className="flex-shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-[#22E3E8]/20 bg-[#22E3E8]/[0.06]"
|
|
254
257
|
>
|
|
255
258
|
<Play size={10} fill="#22E3E8" strokeWidth={0} className="text-[#22E3E8]" />
|
|
@@ -259,8 +262,8 @@ export const PreMatchGame = ({
|
|
|
259
262
|
<FilterPill label="Bets first" active={activeFilters.has("bets_first")} onClick={() => toggleFilter("bets_first")} />
|
|
260
263
|
<FilterPill label="Unanswered first" active={activeFilters.has("unanswered_first")} onClick={() => toggleFilter("unanswered_first")} />
|
|
261
264
|
<FilterPill label="Hide ignored" active={activeFilters.has("hide_ignored")} onClick={() => toggleFilter("hide_ignored")} />
|
|
262
|
-
<FilterPill label="Expand all" active={
|
|
263
|
-
<FilterPill label="Collapse all" active={
|
|
265
|
+
<FilterPill label="Expand all" active={false} onClick={handleExpandAll} />
|
|
266
|
+
<FilterPill label="Collapse all" active={false} onClick={handleCollapseAll} />
|
|
264
267
|
</div>
|
|
265
268
|
</>
|
|
266
269
|
)}
|
|
@@ -277,7 +280,6 @@ export const PreMatchGame = ({
|
|
|
277
280
|
{/* Markets */}
|
|
278
281
|
<div className="w-full">
|
|
279
282
|
<div className="flex flex-col gap-3">
|
|
280
|
-
<AnimatePresence initial={false}>
|
|
281
283
|
{visibleMarketIndices.map((mIdx) => {
|
|
282
284
|
const market = config.markets[mIdx];
|
|
283
285
|
const selection = bets[mIdx];
|
|
@@ -300,14 +302,7 @@ export const PreMatchGame = ({
|
|
|
300
302
|
const hasSubmittedBet = !!submittedBets?.[mIdx];
|
|
301
303
|
|
|
302
304
|
return (
|
|
303
|
-
<
|
|
304
|
-
key={market.id}
|
|
305
|
-
layout="position"
|
|
306
|
-
initial={{ opacity: 0, height: 0 }}
|
|
307
|
-
animate={{ opacity: 1, height: "auto" }}
|
|
308
|
-
exit={{ opacity: 0, height: 0 }}
|
|
309
|
-
transition={{ layout: { type: "spring", stiffness: 300, damping: 30 }, opacity: { duration: 0.2 } }}
|
|
310
|
-
>
|
|
305
|
+
<div key={market.id}>
|
|
311
306
|
{/* Category header */}
|
|
312
307
|
{showCategoryHeader && (
|
|
313
308
|
<div className="px-1 pt-1 pb-1.5">
|
|
@@ -558,10 +553,9 @@ export const PreMatchGame = ({
|
|
|
558
553
|
</motion.div>
|
|
559
554
|
)}
|
|
560
555
|
</AnimatePresence>
|
|
561
|
-
</
|
|
556
|
+
</div>
|
|
562
557
|
);
|
|
563
558
|
})}
|
|
564
|
-
</AnimatePresence>
|
|
565
559
|
</div>
|
|
566
560
|
</div>
|
|
567
561
|
|
|
@@ -588,9 +582,9 @@ export const PreMatchGame = ({
|
|
|
588
582
|
)}
|
|
589
583
|
</AnimatePresence>
|
|
590
584
|
|
|
591
|
-
{/* Saved max outcome */}
|
|
585
|
+
{/* Saved max outcome — only visible when editing creates a diff */}
|
|
592
586
|
<AnimatePresence>
|
|
593
|
-
{savedBetSummary && savedBetSummary.totalEntry > 0 && (
|
|
587
|
+
{savedBetSummary && hasUnsavedEdits && savedBetSummary.totalEntry > 0 && (
|
|
594
588
|
<motion.div className="overflow-hidden" initial={{ height: 0, opacity: 0 }} animate={{ height: "auto", opacity: 1 }} exit={{ height: 0, opacity: 0 }}
|
|
595
589
|
transition={{ height: { duration: 0.35, ease: "easeOut" }, opacity: { duration: 0.3, delay: 0.1 } }}>
|
|
596
590
|
<div className="flex items-baseline gap-1 flex-nowrap">
|
|
@@ -605,14 +599,14 @@ export const PreMatchGame = ({
|
|
|
605
599
|
)}
|
|
606
600
|
</AnimatePresence>
|
|
607
601
|
|
|
608
|
-
{/*
|
|
602
|
+
{/* Max outcome — always visible when there are bets */}
|
|
609
603
|
<AnimatePresence>
|
|
610
|
-
{totalEntry > 0 && (
|
|
604
|
+
{totalEntry > 0 && (
|
|
611
605
|
<motion.div className="overflow-hidden" initial={{ height: 0, opacity: 0 }} animate={{ height: "auto", opacity: 1 }} exit={{ height: 0, opacity: 0 }}
|
|
612
606
|
transition={{ height: { duration: 0.35, ease: "easeOut" }, opacity: { duration: 0.3, delay: 0.1 } }}>
|
|
613
607
|
<div className="flex items-baseline gap-1 flex-nowrap">
|
|
614
608
|
<span className="text-[13px] text-white font-medium leading-none flex-shrink-0" style={OUTFIT}>
|
|
615
|
-
{hasSubmitted ? "Pending" : "Max outcome"}
|
|
609
|
+
{hasSubmitted && hasUnsavedEdits ? "Pending" : "Max outcome"}
|
|
616
610
|
</span>
|
|
617
611
|
<Image src="/iamgame_square_logo.jpg" alt="" width={18} height={18} className="rounded-[2px] flex-shrink-0" />
|
|
618
612
|
<AnimatedNumber value={totalEntry} className="text-[22px] text-white font-bold leading-none" style={OUTFIT} />
|
|
@@ -644,9 +638,9 @@ export const PreMatchGame = ({
|
|
|
644
638
|
</AnimatePresence>
|
|
645
639
|
</div>
|
|
646
640
|
|
|
647
|
-
{/* Right —
|
|
641
|
+
{/* Right — play button (fresh only) */}
|
|
648
642
|
<AnimatePresence>
|
|
649
|
-
{
|
|
643
|
+
{!hasSubmitted && totalEntry > 0 && (
|
|
650
644
|
<motion.button
|
|
651
645
|
onClick={onSubmit ? onSubmit : undefined}
|
|
652
646
|
disabled={submitting}
|
|
@@ -665,18 +659,6 @@ export const PreMatchGame = ({
|
|
|
665
659
|
: <Play size={26} fill="white" strokeWidth={0} className="relative z-10" />}
|
|
666
660
|
</motion.button>
|
|
667
661
|
)}
|
|
668
|
-
{buttonState === "submitted" && (
|
|
669
|
-
<motion.div
|
|
670
|
-
className="w-[54px] min-h-[54px] rounded-xl flex-shrink-0 flex items-center justify-center"
|
|
671
|
-
style={{ background: "rgba(34,197,94,0.12)", border: "1px solid rgba(34,197,94,0.3)" }}
|
|
672
|
-
initial={{ opacity: 0, scale: 0.8 }}
|
|
673
|
-
animate={{ opacity: 1, scale: 1 }}
|
|
674
|
-
transition={{ type: "spring", stiffness: 300, damping: 20 }}>
|
|
675
|
-
<div className="w-[28px] h-[28px] rounded-full flex items-center justify-center" style={{ background: "rgba(34,197,94,0.25)" }}>
|
|
676
|
-
<Check size={16} className="text-green-400" />
|
|
677
|
-
</div>
|
|
678
|
-
</motion.div>
|
|
679
|
-
)}
|
|
680
662
|
</AnimatePresence>
|
|
681
663
|
</div>
|
|
682
664
|
|