"use client" import { useState } from "react" import { useBetslipStore } from "@/lib/store/betslip-store" import { X, Save, Trash2 } from "lucide-react" import { cn } from "@/lib/utils" const quickStakes = [10, 50, 100, 1000, 2000, 5000] export function Betslip() { const { bets, removeBet, clearBets, updateStake, getPotentialWin, getTotalOdds } = useBetslipStore() const [globalStake, setGlobalStake] = useState("10") const totalOdds = getTotalOdds() const isMulti = bets.length > 1 const potentialWin = isMulti ? Number(globalStake) * totalOdds : getPotentialWin() return (
{bets.length === 0 ? (

No bet has been selected. To select a bet, please click on the respective odds

) : ( <> {/* Bet cards */}
{bets.map((bet) => (
{bet.event}
{bet.league}
{bet.market}: {bet.selection} {bet.odds.toFixed(2)}
{!isMulti && (
Odds {bet.odds.toFixed(2)}
)}
{/* Single bet: stake on card */} {!isMulti && (
updateStake(bet.id, Number(e.target.value) || 10)} className="flex-1 h-7 bg-brand-bg border border-border/40 px-2 text-[11px] text-white text-center font-bold focus:outline-none focus:border-brand-primary" min="1" />
{quickStakes.map((s) => ( ))}
)}
))}
{/* Single bet: potential winning below card */} {!isMulti && (
Potential winning {potentialWin.toFixed(2)} ETB
)} {/* Multiple bets: combined Odds, one stake, quick buttons, potential winning */} {isMulti && (
Odds {totalOdds.toFixed(2)}
setGlobalStake(e.target.value)} className="flex-1 h-7 bg-brand-bg border border-border/40 px-2 text-[11px] text-white text-center font-bold focus:outline-none focus:border-brand-primary" min="1" />
{quickStakes.map((s) => ( ))}
Potential winning {(Number(globalStake) * totalOdds).toFixed(2)} ETB
)}
You need to login to be able to place a bet.
)}
) }