diff --git a/public/streak-animation.html b/public/streak-animation.html index de9a93b..3b3dbd8 100644 --- a/public/streak-animation.html +++ b/public/streak-animation.html @@ -153,6 +153,20 @@ .stage.play .count{animation:none; opacity:1; transform:none} .stage.play.tier3 .scene,.stage.play.tier3 .flash{animation:none} } + + body { + background: transparent !important; + } + body.sad { + background: transparent !important; + } + body::after { + display: none !important; + } + #stage, .hint { + display: none !important; + } + @@ -169,13 +183,16 @@
GROWTH SCORE
- -
- +
+ + + +
-
- +
+ under 5 = sad ยท higher = bigger celebration +
diff --git a/scratch/port_streak_clean.py b/scratch/port_streak_clean.py new file mode 100644 index 0000000..907938a --- /dev/null +++ b/scratch/port_streak_clean.py @@ -0,0 +1,47 @@ +import os +import re + +def port_html(): + source_path = r"C:\Users\naman\OneDrive\Desktop\pragativeer-v2\pragativeer-celebration_1.html" + dest_path = r"C:\Users\naman\OneDrive\Desktop\pragativeer-v2\public\streak-animation.html" + + with open(source_path, 'r', encoding='utf-8') as f: + html = f.read() + + # 1. Inject CSS to make background transparent and hide stage layout + hide_css = """ + body { + background: transparent !important; + } + body.sad { + background: transparent !important; + } + body::after { + display: none !important; + } + #stage, .hint { + display: none !important; + } + """ + + # Insert hide_css inside " + html = html.replace(style_tag, hide_css + "\n", 1) + + # 2. Replace parseTarget to read from URL search params + parse_target_replacement = """ + const parseTarget=()=>{ + const params = new URLSearchParams(window.location.search); + const s = params.get('streak'); + const v=parseFloat(s); + return isFinite(v)?v:0; + }; + """ + html = re.sub(r"const parseTarget=\(\)=>\{.*?\};", parse_target_replacement, html, flags=re.DOTALL) + + with open(dest_path, 'w', encoding='utf-8') as f: + f.write(html) + print("Ported successfully to public/streak-animation.html") + +if __name__ == "__main__": + port_html() diff --git a/src/components/Dashboard/StreakOnboardingModal.tsx b/src/components/Dashboard/StreakOnboardingModal.tsx index bea9dbf..4919f26 100644 --- a/src/components/Dashboard/StreakOnboardingModal.tsx +++ b/src/components/Dashboard/StreakOnboardingModal.tsx @@ -1,6 +1,8 @@ "use client"; import { useEffect, useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Flame, Trophy, Sparkles } from "lucide-react"; import { useActiveUser } from "@/hooks/useActiveUser"; export function StreakOnboardingModal() { @@ -17,31 +19,99 @@ export function StreakOnboardingModal() { } }, [user, loading]); - useEffect(() => { - const handleMessage = (event: MessageEvent) => { - if (event.data === 'close-streak-modal') { - if (user) { - sessionStorage.setItem(`hasSeenStreakPopup_${user.id}`, "true"); - } - setIsOpen(false); - } - }; - - window.addEventListener("message", handleMessage); - return () => window.removeEventListener("message", handleMessage); - }, [user]); - if (!isOpen || !user) return null; const streak = user.streak_count; + const targetExam = user.target_exam?.replace("_", " ") || "JEE/NEET"; + + // Streak-based wishes and titles + let wishTitle = "Welcome to PragatiVeer! ๐ŸŒŸ"; + let wishMessage = `Prepare yourself to conquer ${targetExam}. Your daily practice starts here!`; + let badgeBorderColor = "border-[#00F0FF]/30"; + let badgeShadow = "shadow-[0_0_25px_rgba(0,240,255,0.25)]"; + + if (streak === 0) { + wishTitle = "Start Your Streak Today! ๐Ÿš€"; + wishMessage = "Today is Day 1 of your journey. Establish your streak now and build the consistency needed for IIT/AIIMS!"; + badgeBorderColor = "border-blue-500/30"; + badgeShadow = "shadow-[0_0_20px_rgba(59,130,246,0.2)]"; + } else if (streak < 4) { + wishTitle = "Keep the Fire Burning! ๐Ÿ”ฅ"; + wishMessage = `Great job! You have maintained a ${streak}-day study streak. Keep practicing daily to build solid muscle memory!`; + badgeBorderColor = "border-orange-500/30"; + badgeShadow = "shadow-[0_0_20px_rgba(249,115,22,0.25)]"; + } else { + wishTitle = "Unstoppable Dedication! โšก"; + wishMessage = `Incredible! A ${streak}-day streak shows true championship discipline. You are outperforming the competition. Let's make today count!`; + badgeBorderColor = "border-[#D1FF4D]/30"; + badgeShadow = "shadow-[0_0_25px_rgba(209,255,77,0.25)]"; + } + + const handleEnter = () => { + sessionStorage.setItem(`hasSeenStreakPopup_${user.id}`, "true"); + setIsOpen(false); + }; return ( -
+
+ + {/* Celebration Animation Canvas Overlay */}