diff --git a/app/(main)/(lottery)/lottery/page.tsx b/app/(main)/(lottery)/lottery/page.tsx
index 9c7d4cc..8a103b5 100644
--- a/app/(main)/(lottery)/lottery/page.tsx
+++ b/app/(main)/(lottery)/lottery/page.tsx
@@ -1,6 +1,7 @@
-import CountDown from '@/components/lottery/countDown/CountDown';
-import Image from 'next/image';
-import React from 'react';
+import CountDown from "@/components/lottery/countDown/CountDown";
+import SpinWheel from "@/components/lottery/spinWheel/SpinWheel";
+import Image from "next/image";
+import React from "react";
const page = () => {
return (
@@ -31,19 +32,25 @@ const page = () => {
Results
-
The results after each stage will be shown here.
+
+ The results after each stage will be shown here.
+
{[...Array(5)].map((item, index) => (
-
The winner of the {index + 1} stage:
+
+ The winner of the {index + 1} stage:
+
8 XX XX-XX-XX
))}
{/* Sping the wheel */}
-
+
+
+
@@ -57,10 +64,11 @@ const page = () => {
Umumy düzgünler:
{Array(5)
- .fill(' ')
+ .fill(" ")
.map((item) => (
-
- Ilkinji we dogry jogap beren sanawda ilkinji ýeri eýelýär
+ Ilkinji we dogry jogap beren sanawda ilkinji ýeri
+ eýelýär
))}
@@ -70,7 +78,7 @@ const page = () => {
Üns beriň:
{Array(1)
- .fill(' ')
+ .fill(" ")
.map((item) => (
- SMS = 1 manat
))}
diff --git a/app/globals.css b/app/globals.css
index 8aa308e..eb692d4 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -93,7 +93,8 @@ html {
}
.text-stroke {
- text-shadow: -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white, 1px 1px 0 white;
+ text-shadow: -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white,
+ 1px 1px 0 white;
}
.big-swiper .swiper-pagination-bullet {
@@ -121,20 +122,20 @@ html {
.small-swiper .swiper-button-next:after {
color: white;
- content: url('/arrow-right-small.svg');
+ content: url("/arrow-right-small.svg");
}
.small-swiper .swiper-button-prev:after {
color: white;
- content: url('/arrow-left-small.svg');
+ content: url("/arrow-left-small.svg");
}
.big-swiper .swiper-button-next:after {
color: white;
- content: url('/arrow-right-big.svg');
+ content: url("/arrow-right-big.svg");
}
.big-swiper .swiper-button-prev:after {
color: white;
- content: url('/arrow-left-big.svg');
+ content: url("/arrow-left-big.svg");
}
video {
@@ -187,15 +188,15 @@ big {
@apply bg-[#E6E6FA] rounded-xl py-3 px-4 placeholder:text-[#BCBCD6] outline-none;
}
- .calendar [aria-label='Go to next month'] {
+ .calendar [aria-label="Go to next month"] {
@apply shadow-sm transition-all;
}
- .calendar [aria-label='Go to previous month'] {
+ .calendar [aria-label="Go to previous month"] {
@apply shadow-sm transition-all;
}
- .day-styles [name='day'] {
+ .day-styles [name="day"] {
@apply p-4 text-textDarkt leading-[140%] bg-purple-600 rounded-full;
}
@@ -234,3 +235,7 @@ big {
.font-small-regular {
@apply -tracking-[1%] text-[14px] leading-[20px];
}
+
+.text-countdown {
+ @apply font-roboto text-[60px] leading-[70px] -tracking-[1%];
+}
diff --git a/components/lottery/spinWheel/SpinWheel.tsx b/components/lottery/spinWheel/SpinWheel.tsx
new file mode 100644
index 0000000..35915b8
--- /dev/null
+++ b/components/lottery/spinWheel/SpinWheel.tsx
@@ -0,0 +1,267 @@
+"use client";
+
+// import React, { useRef, useState, useEffect } from "react";
+
+// const SpinWheel: React.FC = () => {
+// const canvasRef = useRef(null);
+// const [isSpinning, setIsSpinning] = useState(false);
+// const [countdown, setCountdown] = useState(5);
+
+// const totalSize = 554; // Total size including borders
+// const outerBorderWidth = 12; // Outer border width
+// const innerBorderWidth = 15; // Inner border width
+// const wheelSize = totalSize - outerBorderWidth - innerBorderWidth; // Inner wheel size
+
+// const drawWheel = (angleOffset: number = 0): void => {
+// const canvas = canvasRef.current;
+// if (!canvas) return;
+// const ctx = canvas.getContext("2d");
+// if (!ctx) return;
+
+// const radius = wheelSize / 2;
+
+// // Clear the canvas and set background color
+// ctx.fillStyle = "#FFF";
+// ctx.fillRect(0, 0, totalSize, totalSize);
+
+// // Draw the outermost border
+// ctx.beginPath();
+// ctx.arc(totalSize / 2, totalSize / 2, totalSize / 2, 0, 2 * Math.PI);
+// ctx.fillStyle = "#5D5D72"; // Outer border color
+// ctx.fill();
+// ctx.closePath();
+
+// // Draw the inner border
+// ctx.beginPath();
+// ctx.arc(
+// totalSize / 2,
+// totalSize / 2,
+// (totalSize - outerBorderWidth) / 2,
+// 0,
+// 2 * Math.PI
+// );
+// ctx.fillStyle = "#8589DE"; // Inner border color
+// ctx.fill();
+// ctx.closePath();
+
+// // Draw the wheel
+// const segmentAngle = (2 * Math.PI) / 24; // 24 segments
+// for (let i = 0; i < 24; i++) {
+// ctx.beginPath();
+// ctx.moveTo(totalSize / 2, totalSize / 2);
+// ctx.arc(
+// totalSize / 2,
+// totalSize / 2,
+// radius,
+// segmentAngle * i + angleOffset,
+// segmentAngle * (i + 1) + angleOffset
+// );
+// ctx.fillStyle = i % 2 === 0 ? "#E1E0FF" : "#575992"; // Alternate colors
+// ctx.fill();
+// ctx.stroke();
+// ctx.closePath();
+// }
+
+// // Draw central ellipse
+// ctx.beginPath();
+// ctx.ellipse(
+// totalSize / 2,
+// totalSize / 2,
+// 105 / 2,
+// 105 / 2,
+// 0,
+// 0,
+// 2 * Math.PI
+// );
+// ctx.fillStyle = "#FFF";
+// ctx.fill();
+// ctx.stroke();
+
+// // Add countdown text in the ellipse
+// ctx.fillStyle = "#79536A"; // Text color
+// ctx.font = "60px Roboto";
+// ctx.textAlign = "center";
+// ctx.textBaseline = "middle";
+// ctx.fillText(countdown.toString(), totalSize / 2, totalSize / 2);
+// };
+
+// const spinWheel = (): void => {
+// if (isSpinning) return;
+
+// setIsSpinning(true);
+// setCountdown(5); // Reset countdown
+
+// let currentAngle = 0;
+// const spinDuration = 5000; // Spin for 5 seconds
+// const spinStartTime = Date.now();
+
+// // Countdown Timer Logic
+// const countdownInterval = setInterval(() => {
+// setCountdown((prev) => {
+// if (prev === 0) {
+// clearInterval(countdownInterval);
+// return 0;
+// }
+// return prev - 1;
+// });
+// }, 1000);
+
+// // Spinning Logic
+// const spin = () => {
+// const elapsedTime = Date.now() - spinStartTime;
+
+// if (elapsedTime >= spinDuration) {
+// setIsSpinning(false);
+// return;
+// }
+
+// // Update angle
+// const progress = elapsedTime / spinDuration;
+// const easedProgress = easeOutCubic(progress); // Easing for smooth deceleration
+// currentAngle = easedProgress * 10 * Math.PI; // Spin multiple times
+
+// drawWheel(currentAngle);
+// requestAnimationFrame(spin);
+// };
+
+// spin();
+// };
+
+// // Easing function for smooth deceleration
+// const easeOutCubic = (t: number): number => 1 - Math.pow(1 - t, 3);
+
+// // Initial draw
+// useEffect(() => {
+// drawWheel();
+// }, [countdown]);
+
+// return (
+//
+//
+//
+//
+// );
+// };
+
+// export default SpinWheel;
+
+import { useState } from "react";
+
+const SpinWheel: React.FC = () => {
+ const [isSpinning, setIsSpinning] = useState(false);
+ const [countdown, setCountdown] = useState(5);
+ const [rotation, setRotation] = useState(0);
+
+ const spinWheel = () => {
+ if (isSpinning) return;
+
+ setIsSpinning(true);
+ setCountdown(5); // Reset countdown
+ const totalSpin = rotation + 360 * 10 + Math.random() * 360; // 10 full rotations + random offset
+ setRotation(totalSpin); // Update rotation to a new value
+
+ // Countdown logic
+ const countdownInterval = setInterval(() => {
+ setCountdown((prev) => {
+ if (prev === 1) {
+ clearInterval(countdownInterval);
+ return 0;
+ }
+ return prev - 1;
+ });
+ }, 1000);
+
+ // Reset everything after the spin duration
+ setTimeout(() => {
+ setIsSpinning(false);
+ setRotation((prev) => prev % 360); // Normalize the rotation
+ setCountdown(5); // Reset countdown for the next spin
+ }, 5000); // Spin duration
+ };
+
+ return (
+
+ {/* Outer Border */}
+
+ {/* Inner Border */}
+
+ {/* Wheel Segments */}
+
+
+
+ {/* Countdown Display */}
+
+
+ {countdown}
+
+
+
+
+ {/* Spin Button */}
+
+
+ );
+};
+
+export default SpinWheel;