Skip to content

Commit 3f626c7

Browse files
committed
changes_made
1 parent 342dec5 commit 3f626c7

File tree

2 files changed

+362
-66
lines changed

2 files changed

+362
-66
lines changed

src/pages/activities/RandomIdentity.js

Lines changed: 91 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,104 @@
11
import { useState } from "react";
22
import "../../styles/pages/activities/RandomIdentity.css";
33

4-
const identities = [
5-
"🦊 Sly Fox — clever, quick, slightly chaotic",
6-
"🐢 Chill Turtle — slow today, still winning",
7-
"🐼 Cozy Panda — productivity is optional",
8-
"🐧 Focused Penguin — cute but on task",
9-
"🐱 Curious Cat — click everything, learn everything",
10-
"🐯 Tiger Mode — roar through your to-do list",
11-
"🦄 Rainbow Unicorn — unique, unbothered, magical",
12-
"🦥 Lazy Sloth — rest is a feature, not a bug",
13-
"🐝 Busy Bee — buzzing with ideas",
14-
"🦋 Glow Butterfly — transformation era",
15-
"🦚 Peacock Vibes — you look good today",
16-
"🐸 Frog Jumper — hop over problems",
17-
"🐕 Loyal Doggo — supportive teammate energy",
18-
"🌊 Ocean Brain — calm but deep",
19-
"🔥 Hot Streak — everything is working today",
20-
"🌙 Night Coder — 2 AM productivity unlocked",
21-
"🧋 Boba Thinker — sweet, but overthinks sometimes",
22-
"🍕 Pizza Brain — full of ideas (and cheese)",
23-
"🎧 Chill DJ — vibing through chaos",
24-
"📚 Wise Owl — silent but deadly (with notes)"
25-
];
4+
const zodiacData = {
5+
aries: { name: "Aries ♈", traits: ["Bold", "Energetic", "Starter"], message: "Start the thing. Your fire is useful today." },
6+
taurus: { name: "Taurus ♉", traits: ["Grounded", "Patient", "Steady"], message: "Go slow and solid. Comfort-first is okay." },
7+
gemini: { name: "Gemini ♊", traits: ["Curious", "Expressive", "Adaptable"], message: "Talk it out. A convo will unlock clarity." },
8+
cancer: { name: "Cancer ♋", traits: ["Caring", "Intuitive", "Protective"], message: "Nurture your circle. Your care will be noticed." },
9+
leo: { name: "Leo ♌", traits: ["Confident", "Creative", "Warm"], message: "Show your light. You’re the main character today." },
10+
virgo: { name: "Virgo ♍", traits: ["Detail-loving", "Helpful", "Practical"], message: "Fix one tiny thing. You’ll feel aligned right away." },
11+
libra: { name: "Libra ♎", traits: ["Balanced", "Charming", "Fair"], message: "Choose harmony, not speed. People will support you." },
12+
scorpio: { name: "Scorpio ♏", traits: ["Intense", "Loyal", "Deep"], message: "Go deeper, not wider. Depth will give you power." },
13+
sagittarius: { name: "Sagittarius ♐", traits: ["Adventurous", "Optimistic", "Honest"], message: "Say yes to something new — expansion wants you." },
14+
capricorn: { name: "Capricorn ♑", traits: ["Ambitious", "Disciplined", "Patient"], message: "Keep building. Quiet consistency will pay off." },
15+
aquarius: { name: "Aquarius ♒", traits: ["Original", "Big-picture", "Humanitarian"], message: "Share the weird idea. That’s the one people need." },
16+
pisces: { name: "Pisces ♓", traits: ["Empathic", "Dreamy", "Creative"], message: "Create from what you feel. Soft does not mean weak." },
17+
};
18+
19+
function getZodiac(month, day) {
20+
if ((month === 3 && day >= 21) || (month === 4 && day <= 19)) return "aries";
21+
if ((month === 4 && day >= 20) || (month === 5 && day <= 20)) return "taurus";
22+
if ((month === 5 && day >= 21) || (month === 6 && day <= 20)) return "gemini";
23+
if ((month === 6 && day >= 21) || (month === 7 && day <= 22)) return "cancer";
24+
if ((month === 7 && day >= 23) || (month === 8 && day <= 22)) return "leo";
25+
if ((month === 8 && day >= 23) || (month === 9 && day <= 22)) return "virgo";
26+
if ((month === 9 && day >= 23) || (month === 10 && day <= 22)) return "libra";
27+
if ((month === 10 && day >= 23) || (month === 11 && day <= 21)) return "scorpio";
28+
if ((month === 11 && day >= 22) || (month === 12 && day <= 21)) return "sagittarius";
29+
if ((month === 12 && day >= 22) || (month === 1 && day <= 19)) return "capricorn";
30+
if ((month === 1 && day >= 20) || (month === 2 && day <= 18)) return "aquarius";
31+
return "pisces";
32+
}
2633

2734
export default function RandomIdentity() {
28-
const [identity, setIdentity] = useState(identities[0]);
35+
const [date, setDate] = useState("");
36+
const [zodiac, setZodiac] = useState(null);
37+
const [showResult, setShowResult] = useState(false);
38+
const [confettiKey, setConfettiKey] = useState(0);
2939

30-
function handleClick() {
31-
const random = Math.floor(Math.random() * identities.length);
32-
setIdentity(identities[random]);
40+
function handleSubmit(e) {
41+
e.preventDefault();
42+
if (!date) return;
43+
const d = new Date(date);
44+
const month = d.getMonth() + 1;
45+
const day = d.getDate();
46+
const zKey = getZodiac(month, day);
47+
setZodiac(zodiacData[zKey]);
48+
setShowResult(false);
49+
setConfettiKey((k) => k + 1);
50+
setTimeout(() => setShowResult(true), 15);
3351
}
3452

3553
return (
36-
<div className="identity-light-container">
54+
<div className="identity-light-container with-anim">
55+
<div className="id-bubble id-b1"></div>
56+
<div className="id-bubble id-b2"></div>
57+
<div className="id-bubble id-b3"></div>
58+
59+
{showResult && (
60+
<div key={confettiKey} className="party-layer">
61+
<div className="party-bomber left-bomber"></div>
62+
<div className="party-bomber right-bomber"></div>
63+
<div className="party-confetti c1"></div>
64+
<div className="party-confetti c2"></div>
65+
<div className="party-confetti c3"></div>
66+
<div className="party-confetti c4"></div>
67+
</div>
68+
)}
69+
3770
<div className="identity-card-light">
38-
<h2 className="identity-title-light">Today’s Random Identity ✨</h2>
39-
<p className="identity-text-light">{identity}</p>
40-
<button onClick={handleClick} className="identity-btn-light">
41-
Give me another
42-
</button>
71+
<h2 className="identity-title-light">Your Zodiac Vibe ✨</h2>
72+
<p className="identity-sub-light">Enter your birth date to see your sign, traits, and today’s message.</p>
73+
74+
<form className="identity-form" onSubmit={handleSubmit}>
75+
<input
76+
type="date"
77+
className="identity-date-input"
78+
value={date}
79+
onChange={(e) => setDate(e.target.value)}
80+
max={new Date().toISOString().split("T")[0]}
81+
required
82+
/>
83+
<button type="submit" className="identity-btn-rect">
84+
Reveal
85+
</button>
86+
</form>
87+
88+
{showResult && zodiac && (
89+
<div className="identity-result pop-in glow">
90+
<p className="identity-label">Your zodiac sign</p>
91+
<h3 className="identity-zodiac-name">{zodiac.name}</h3>
92+
<div className="identity-traits">
93+
{zodiac.traits.map((t) => (
94+
<span key={t} className="identity-pill">
95+
{t}
96+
</span>
97+
))}
98+
</div>
99+
<p className="identity-message">{zodiac.message}</p>
100+
</div>
101+
)}
43102
</div>
44103
</div>
45104
);

0 commit comments

Comments
 (0)