Merge version_2 into main #3
@@ -7,6 +7,37 @@ import NavbarStyleApple from "@/components/navbar/NavbarStyleApple/NavbarStyleAp
|
||||
import { Heart, Sparkles } from "lucide-react";
|
||||
import React, { useState, useMemo } from "react";
|
||||
|
||||
// Helper functions for random calculations, defined outside the component
|
||||
const generateConfettiProperties = () => ({
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
width: `${Math.random() * 10 + 5}px`,
|
||||
height: `${Math.random() * 10 + 5}px`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 3 + 2}s`,
|
||||
});
|
||||
|
||||
const generateHeartProperties = () => ({
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 3 + 2}s`,
|
||||
});
|
||||
|
||||
const generateBalloonProperties = () => ({
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 4 + 3}s`,
|
||||
});
|
||||
|
||||
const generateConfettiTransform = () => {
|
||||
const translateX = Math.random() * 400 - 200;
|
||||
const translateY = Math.random() * 400 - 200;
|
||||
const rotate = Math.random() * 360;
|
||||
return `translate(${translateX}px, ${translateY}px) rotate(${rotate}deg)`;
|
||||
};
|
||||
|
||||
const noMessages = [
|
||||
"Please kar lo na 🥺", "Main tum se bohat pyar karta hoon ❤️", "Ab to yes kar do na 🥹", "Please Jully, maan jao na ❤️", "Mere liye yes kar do 💕", "Last time bol raha hoon, yes kar do ❤️"
|
||||
];
|
||||
@@ -22,12 +53,7 @@ export default function LandingPage() {
|
||||
if (!showCelebration) return [];
|
||||
return Array.from({ length: 50 }).map((_, i) => ({
|
||||
key: `confetti-${i}`,
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
width: `${Math.random() * 10 + 5}px`,
|
||||
height: `${Math.random() * 10 + 5}px`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 3 + 2}s`,
|
||||
...generateConfettiProperties(),
|
||||
}));
|
||||
}, [showCelebration]);
|
||||
|
||||
@@ -35,10 +61,7 @@ export default function LandingPage() {
|
||||
if (!showCelebration) return [];
|
||||
return Array.from({ length: 20 }).map((_, i) => ({
|
||||
key: `heart-${i}`,
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 3 + 2}s`,
|
||||
...generateHeartProperties(),
|
||||
}));
|
||||
}, [showCelebration]);
|
||||
|
||||
@@ -46,19 +69,13 @@ export default function LandingPage() {
|
||||
if (!showCelebration) return [];
|
||||
return Array.from({ length: 10 }).map((_, i) => ({
|
||||
key: `balloon-${i}`,
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 2}s`,
|
||||
animationDuration: `${Math.random() * 4 + 3}s`,
|
||||
...generateBalloonProperties(),
|
||||
}));
|
||||
}, [showCelebration]);
|
||||
|
||||
const confettiKeyframeEndTransform = useMemo(() => {
|
||||
if (!showCelebration) return `translate(0, 0) rotate(0deg)`;
|
||||
const translateX = Math.random() * 400 - 200;
|
||||
const translateY = Math.random() * 400 - 200;
|
||||
const rotate = Math.random() * 360;
|
||||
return `translate(${translateX}px, ${translateY}px) rotate(${rotate}deg)`;
|
||||
return generateConfettiTransform();
|
||||
}, [showCelebration]);
|
||||
|
||||
const handleYes = () => {
|
||||
@@ -87,9 +104,6 @@ export default function LandingPage() {
|
||||
buttons.push({ text: "Yes", onClick: handleYes });
|
||||
if (showNoButton) {
|
||||
buttons.push({ text: "No", onClick: handleNo });
|
||||
} else if (noClickCount >= noMessages.length - 1) {
|
||||
// If no button is removed, and it's past the messages, show two Yes buttons
|
||||
buttons.push({ text: "Yes!", onClick: handleYes });
|
||||
}
|
||||
return buttons;
|
||||
};
|
||||
@@ -167,7 +181,6 @@ export default function LandingPage() {
|
||||
|
||||
{showCelebration && (
|
||||
<div className="fixed inset-0 z-[100] pointer-events-none overflow-hidden">
|
||||
{/* Confetti Effect */}
|
||||
{/* Confetti Effect */}
|
||||
{confettiPieces.map((props) => (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user