Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 124 additions & 130 deletions packages/nextjs/app/dapp/buy-tickets/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ArrowLeft } from "lucide-react";
import { motion } from "framer-motion";

import { useRouter } from "next/navigation";
import Image from "next/image";
import { Abi, useContract } from "@starknet-react/core";
import { useTransactor } from "~~/hooks/scaffold-stark/useTransactor";
import { LOTT_CONTRACT_NAME } from "~~/utils/Constants";
Expand Down Expand Up @@ -397,149 +396,144 @@ export default function BuyTicketsPage() {
return (
<div className="pb-8 px-4">
<div className="max-w-7xl mx-auto">
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
{/* Left Column - Main Content */}
<div className="lg:col-span-2 space-y-6">
<div className="flex justify-center">
{/* Main Content - Centered */}
<div className="w-full max-w-4xl space-y-6">
<motion.div
className="bg-[#1a2234] rounded-xl p-6"
className="relative overflow-hidden rounded-2xl border border-white/10 bg-white/5 backdrop-blur-md p-6"
style={{ boxShadow: "0 10px 25px rgba(255,214,0,0.1)" }}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
>
<h1 className="text-3xl font-bold text-purple-400 mb-6">
{t("buyTickets.title")}
</h1>

{/* Next Draw */}
<div className="mb-6">
<p className="text-gray-300 mb-1">{t("buyTickets.nextDraw")}</p>
<motion.p
className="text-[#4ade80] text-4xl font-bold"
initial={{ scale: 0.9 }}
animate={{ scale: 1 }}
>
{jackpotAmount}
</motion.p>

{/* Countdown - Nuevo componente basado en bloques */}
<div className="mt-4">
<BlockBasedCountdownTimer
blocksRemaining={blocksRemaining}
currentBlock={currentBlock}
timeRemaining={countdownFromBlocks}
/>
{/* Gradient Background Overlay */}
<div className="absolute inset-0 bg-gradient-to-br from-starkYellow/5 via-transparent to-purple-500/5 pointer-events-none" />

{/* Animated Background Glow */}
<div className="absolute -inset-1 bg-gradient-to-r from-starkYellow/10 via-purple-500/10 to-starkYellow/10 rounded-2xl blur-xl opacity-30 animate-pulse" />

<div className="relative z-10">
<h1 className="text-3xl font-bold bg-gradient-to-r from-starkYellow to-white bg-clip-text text-transparent mb-6">
{t("buyTickets.title")}
</h1>

{/* Next Draw */}
<div className="mb-6">
<p className="text-white/70 mb-1">
{t("buyTickets.nextDraw")}
</p>
<motion.p
className="text-starkYellow text-4xl font-bold"
initial={{ scale: 0.9 }}
animate={{ scale: 1 }}
>
{jackpotAmount}
</motion.p>

{/* Countdown - Nuevo componente basado en bloques */}
<div className="mt-4">
<BlockBasedCountdownTimer
blocksRemaining={blocksRemaining}
currentBlock={currentBlock}
timeRemaining={countdownFromBlocks}
/>
</div>
</div>
</div>

{/* User Balance Display */}
<div className="bg-[#232b3b] rounded-lg p-4 mb-6">
<div className="flex justify-between items-center">
<div className="flex items-center gap-2">
<div className="text-[#4ade80]">
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect
x="2"
y="6"
width="20"
height="12"
rx="2"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M6 10H10"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
/>
</svg>
{/* User Balance Display */}
<div className="bg-white/5 border border-white/10 rounded-lg p-4 mb-6">
<div className="flex justify-between items-center">
<div className="flex items-center gap-2">
<div className="text-starkYellow">
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect
x="2"
y="6"
width="20"
height="12"
rx="2"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M6 10H10"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
/>
</svg>
</div>
<p className="text-white font-medium">
{t("buyTickets.yourBalance")}
</p>
</div>
<p className="text-white font-medium">
{t("buyTickets.yourBalance")}
<p className="text-starkYellow font-bold text-lg">
{userBalanceFormatted} $TRKP
</p>
</div>
<p className="text-[#4ade80] font-bold text-lg">
{userBalanceFormatted} $TRKP
</p>
{!isDrawActive && (
<p className="text-red-400 text-sm mt-2">
⚠️ {t("buyTickets.drawNotActive")}
</p>
)}
{!contractsReady && (
<p className="text-starkYellow text-sm mt-2">
⚠️ {t("buyTickets.contractsNotReady")}
</p>
)}
</div>
{!isDrawActive && (
<p className="text-red-400 text-sm mt-2">
⚠️ {t("buyTickets.drawNotActive")}
</p>
)}
{!contractsReady && (
<p className="text-yellow-400 text-sm mt-2">
⚠️ {t("buyTickets.contractsNotReady")}
</p>
)}
</div>

{/* Ticket Controls */}
<TicketControls
ticketCount={ticketCount}
onIncreaseTickets={increaseTickets}
onDecreaseTickets={decreaseTickets}
onGenerateRandomForAll={generateRandomForAll}
/>

{/* Ticket Selection */}
<div className="space-y-4">
{Array.from({ length: ticketCount }).map((_, idx) => {
const ticketId = idx + 1;
return (
<TicketSelector
key={ticketId}
ticketId={ticketId}
selectedNumbers={selectedNumbers[ticketId] || []}
animatingNumbers={animatingNumbers}
onNumberSelect={selectNumber}
onGenerateRandom={generateRandom}
numberAnimationVariants={numberAnimationVariants}
lotteryRevealVariants={lotteryRevealVariants}
ticketVariants={ticketVariants}
idx={idx}
/>
);
})}
</div>
{/* Ticket Controls */}
<TicketControls
ticketCount={ticketCount}
onIncreaseTickets={increaseTickets}
onDecreaseTickets={decreaseTickets}
onGenerateRandomForAll={generateRandomForAll}
/>

{/* Ticket Selection */}
<div className="space-y-4">
{Array.from({ length: ticketCount }).map((_, idx) => {
const ticketId = idx + 1;
return (
<TicketSelector
key={ticketId}
ticketId={ticketId}
selectedNumbers={selectedNumbers[ticketId] || []}
animatingNumbers={animatingNumbers}
onNumberSelect={selectNumber}
onGenerateRandom={generateRandom}
numberAnimationVariants={numberAnimationVariants}
lotteryRevealVariants={lotteryRevealVariants}
ticketVariants={ticketVariants}
idx={idx}
/>
);
})}
</div>

{/* Purchase Summary (usa precio on-chain) */}
{/* Purchase Summary (usa precio on-chain) */}
<PurchaseSummary
unitPriceFormatted={unitPriceFormatted}
totalCostFormatted={totalFormatted}
isPriceLoading={priceLoading}
priceError={priceError?.message ?? null}
isLoading={isLoading}
txError={buyError}
txSuccess={buySuccess}
onPurchase={handlePurchase}
isDrawActive={isDrawActive}
contractsReady={contractsReady}
/>
{/* Purchase Summary (usa precio on-chain) */}
{/* Purchase Summary (usa precio on-chain) */}
<PurchaseSummary
unitPriceFormatted={unitPriceFormatted}
totalCostFormatted={totalFormatted}
isPriceLoading={priceLoading}
priceError={priceError?.message ?? null}
isLoading={isLoading}
txError={buyError}
txSuccess={buySuccess}
onPurchase={handlePurchase}
isDrawActive={isDrawActive}
contractsReady={contractsReady}
/>
</div>
</motion.div>
</div>

{/* Right Column - Illustration */}
<div className="hidden lg:block">
<div className="flex flex-col items-center justify-center h-full">
<Image
src="/jackpot.svg"
alt="Jackpot Illustration"
width={320}
height={320}
className="mb-6"
/>
<p className="text-gray-400 text-center">
{/* Puedes agregar aquΓ­ mΓ‘s textos traducibles si lo deseas */}
</p>
</div>
</div>
</div>
</div>
</div>
Expand Down
19 changes: 12 additions & 7 deletions packages/nextjs/app/dapp/claim/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,32 @@ export default function ClaimPage() {
transition={{ duration: 0.6 }}
>
<div className="flex items-center justify-center gap-3 mb-4">
<Gift className="h-8 w-8 text-[#00FFA3]" />
<h1 className="text-4xl md:text-5xl font-bold bg-gradient-to-r from-[#00FFA3] to-[#00E5FF] bg-clip-text text-transparent">
<Gift className="h-8 w-8 text-starkYellow" />
<h1 className="text-4xl md:text-5xl font-bold bg-gradient-to-r from-starkYellow to-white bg-clip-text text-transparent">
{t("navigation.claim")}
</h1>
</div>
</motion.div>

{/* Coming Soon Message */}
<motion.div
className="bg-black/40 backdrop-blur-md border border-[#00FFA3]/20 rounded-2xl p-8"
className="relative overflow-hidden rounded-2xl border border-white/10 bg-white/5 backdrop-blur-md p-8"
style={{ boxShadow: "0 10px 25px rgba(255,214,0,0.1)" }}
initial={{ y: 30, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.6, delay: 0.2 }}
>
<div className="absolute inset-0 bg-gradient-to-r from-[#00FFA3]/10 via-transparent to-[#00E5FF]/10 rounded-2xl blur-xl" />
{/* Gradient Background Overlay */}
<div className="absolute inset-0 bg-gradient-to-br from-starkYellow/5 via-transparent to-purple-500/5 pointer-events-none" />

<div className="relative">
<p className="text-xl text-white/80">
{/* Animated Background Glow */}
<div className="absolute -inset-1 bg-gradient-to-r from-starkYellow/10 via-purple-500/10 to-starkYellow/10 rounded-2xl blur-xl opacity-30 animate-pulse" />

<div className="relative z-10">
<p className="text-xl text-white">
{t("comingSoon.message", "Coming Soon")}
</p>
<p className="text-sm text-white/60 mt-2">
<p className="text-sm text-white/70 mt-2">
{t(
"comingSoon.description",
"This feature will be available soon. Stay tuned!",
Expand Down
18 changes: 12 additions & 6 deletions packages/nextjs/app/dapp/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function DashboardPage() {
const navigate = useRouter();
const { scrollY } = useScroll();
const { status } = useAccount();
const isConnected = status === "connected";

const heroY = useTransform(scrollY, [0, 500], [0, -100]);
const prizeDistributionY = useTransform(scrollY, [0, 2000], [0, -50]);
Expand Down Expand Up @@ -79,14 +80,17 @@ export default function DashboardPage() {
<TotalPool />
</div>

<div className="space-y-4 lg:col-span-2">
<div
className={`space-y-4 ${isConnected ? "lg:col-span-2" : "lg:col-span-3"}`}
>
{/* Lottery Process */}
<StepsWizard {...data.wizard} />

<HeroSection
variant="card"
heroY={heroY}
jackpot={jackpot}
isConnected={isConnected}
showSecurityInfo={showSecurityInfo}
targetDate={targetDate}
onBuyTicket={() => handleRoute("/dapp/buy-tickets")}
Expand All @@ -101,13 +105,15 @@ export default function DashboardPage() {
useBlockBasedCountdown={true}
/>

<RecentActivityCard items={data.history} />
{isConnected && <RecentActivityCard items={data.history} />}
</div>

<div className="space-y-4">
<BalancesCard {...data.balances} />
<NotificationsCard list={data.notifications} />
</div>
{isConnected && (
<div className="space-y-4">
<BalancesCard {...data.balances} />
<NotificationsCard list={data.notifications} />
</div>
)}

<div className="lg:col-span-3">
<LastDrawResultsCard />
Expand Down
9 changes: 7 additions & 2 deletions packages/nextjs/app/dapp/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export default function DappLayout({
} | null>(null);

return (
<div className="flex min-h-screen flex-col bg-background text-foreground overflow-x-hidden">
<div className="flex min-h-screen flex-col bg-[#101326] text-white overflow-x-hidden">
{/* Fondo degradado igual que landing page */}
<div className="absolute inset-0 -z-30 bg-gradient-to-b from-heroDarker via-heroDark to-heroDark" />

<AnimatedBackground />
<FloatingCoins />
<Navbar
Expand All @@ -35,7 +38,9 @@ export default function DappLayout({
onClose={() => setNotification(null)}
/>
)}
<main className="flex-1 pt-24 relative z-10">{children}</main>
<main className="flex-1 pt-24 relative z-10 container mx-auto max-w-6xl px-4 sm:px-6">
{children}
</main>
<ScrollToTop />
</div>
);
Expand Down
Loading