LokiLab's feed now carries US, French and EuroMillions results with a bonus array (Powerball, N° Chance, étoiles). Bonus balls render after a "+" in gold; the lottery strip gets icons for the new games. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import Link from "next/link"
|
|
import { NumberSequence } from "@/components/number-sequence"
|
|
import { FollowButton } from "@/components/follow-button"
|
|
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
|
|
|
export function LotteryMobileCard({
|
|
entry,
|
|
country,
|
|
isFollowing,
|
|
isAuthenticated,
|
|
}: {
|
|
entry: LotteryFeedEntry
|
|
country: string
|
|
isFollowing: boolean
|
|
isAuthenticated: boolean
|
|
}) {
|
|
const { lifetime, lastDraw } = entry
|
|
const resultSet = new Set(lastDraw?.result ?? [])
|
|
|
|
return (
|
|
<div className="space-y-2.5 border-b border-border/60 p-3 last:border-b-0">
|
|
<div className="flex items-center justify-between">
|
|
<p className="flex items-center gap-1.5 font-semibold">
|
|
{lastDraw && (
|
|
<FollowButton
|
|
lotteryId={entry.id}
|
|
country={country}
|
|
targetDrawDate={lastDraw.date}
|
|
initialFollowing={isFollowing}
|
|
isAuthenticated={isAuthenticated}
|
|
/>
|
|
)}
|
|
<Link href={`/loterie/${entry.id}`} className="hover:text-accent hover:underline">
|
|
{entry.name}
|
|
</Link>
|
|
</p>
|
|
{lifetime.picksTracked > 0 ? (
|
|
<p className="text-xs text-muted-foreground">
|
|
<span className="font-semibold text-foreground tabular-nums">
|
|
{(lifetime.winRate * 100).toFixed(0)}%
|
|
</span>{" "}
|
|
sur {lifetime.picksTracked}
|
|
</p>
|
|
) : (
|
|
<p className="text-xs text-muted-foreground">Nouveau</p>
|
|
)}
|
|
</div>
|
|
|
|
{lastDraw ? (
|
|
<>
|
|
<div>
|
|
<p className="mb-1 text-xs text-muted-foreground">
|
|
Résultat du {formatDate(lastDraw.date)}
|
|
</p>
|
|
<NumberSequence numbers={lastDraw.result} bonus={lastDraw.bonus} bonusLabel={entry.bonusLabel} />
|
|
</div>
|
|
{lastDraw.pick ? (
|
|
<div>
|
|
<p className="mb-1 text-xs text-muted-foreground">
|
|
Choix pour ce tirage —{" "}
|
|
<span className={lastDraw.won ? "font-semibold text-success" : ""}>
|
|
{lastDraw.matched} / {lastDraw.result.length}
|
|
</span>
|
|
</p>
|
|
<NumberSequence numbers={lastDraw.pick} hitSet={resultSet} />
|
|
</div>
|
|
) : (
|
|
<p className="text-xs text-muted-foreground">Aucun choix pour ce tirage.</p>
|
|
)}
|
|
</>
|
|
) : (
|
|
<p className="text-xs text-muted-foreground">Aucun tirage disponible.</p>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function formatDate(iso: string): string {
|
|
const d = new Date(iso + "T00:00:00")
|
|
return d.toLocaleDateString("fr-CA", { day: "numeric", month: "short" })
|
|
}
|