Spaces:
Running
Running
File size: 4,554 Bytes
222a43c ab4dabf 222a43c 756e899 222a43c 756e899 222a43c 756e899 222a43c 756e899 222a43c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | import { useState } from "react";
const STEPS = [
{
emoji: "π£οΈ",
title: "Welcome to Vaakify!",
text: "This is a fun place to practice saying words with a friend by your side. Let's see how it works!",
},
{
emoji: "π€",
title: "Pick a friend",
text: "You picked a character friend to practice with β you can always switch to a different one from the side menu.",
},
{
emoji: "π",
title: "Listen first",
text: "Your friend will say the word out loud. You can listen as many times as you like β even slowly!",
},
{
emoji: "π€",
title: "Now you try!",
text: "Tap the microphone and say the word yourself. Don't worry about getting it perfect β just give it a try!",
},
{
emoji: "β",
title: "See how you did",
text: "Your friend will cheer you on and show you your score. Every try helps you get better!",
},
{
emoji: "πͺ",
title: "Extra practice",
text: "If a sound needs a bit more work, we'll do some extra practice together to help you master it.",
},
];
export default function Tutorial({ onClose, darkMode }) {
const [step, setStep] = useState(0);
const isLast = step === STEPS.length - 1;
const current = STEPS[step];
return (
<div style={{
position: "fixed", inset: 0, zIndex: 200,
background: "rgba(0,0,0,0.45)", backdropFilter: "blur(4px)",
display: "flex", alignItems: "center", justifyContent: "center",
padding: "20px",
}}>
<div style={{
width: "100%", maxWidth: "380px",
background: darkMode ? "#241D19" : "#fff", borderRadius: "24px",
padding: "32px 28px 24px 28px",
boxShadow: "0 12px 48px rgba(0,0,0,0.25)",
position: "relative",
}}>
<button
onClick={onClose}
style={{
position: "absolute", top: "16px", right: "16px",
background: "rgba(0,0,0,0.06)", border: "none", borderRadius: "50%",
width: "30px", height: "30px", cursor: "pointer", fontSize: "0.9rem",
color: "#888",
}}
>
β
</button>
<div style={{ textAlign: "center", marginBottom: "8px" }}>
<div style={{ fontSize: "3.2rem", marginBottom: "12px" }}>{current.emoji}</div>
<h2 style={{ fontFamily: "Nunito, sans-serif", fontSize: "1.3rem", fontWeight: 900, color: darkMode ? "#F0DCCF" : "#2C2C2A", margin: "0 0 10px 0" }}>
{current.title}
</h2>
<p style={{ fontFamily: "Nunito, sans-serif", fontSize: "0.9rem", color: darkMode ? "#C4A896" : "#666", lineHeight: 1.6, margin: 0 }}>
{current.text}
</p>
</div>
<div style={{ display: "flex", justifyContent: "center", gap: "6px", margin: "22px 0" }}>
{STEPS.map((_, i) => (
<div key={i} style={{
width: i === step ? "20px" : "7px", height: "7px", borderRadius: "4px",
background: i === step ? "#E8825A" : "rgba(0,0,0,0.12)",
transition: "all 0.3s",
}} />
))}
</div>
<div style={{ display: "flex", gap: "10px" }}>
{step > 0 && (
<button
onClick={() => setStep((s) => s - 1)}
style={{
flex: 1, padding: "14px", background: "transparent",
border: "1.5px solid rgba(0,0,0,0.1)", borderRadius: "14px",
fontFamily: "Nunito, sans-serif", fontWeight: 700, fontSize: "0.9rem",
color: "#888", cursor: "pointer",
}}
>
Back
</button>
)}
<button
onClick={() => (isLast ? onClose() : setStep((s) => s + 1))}
style={{
flex: 2, padding: "14px", background: "#E8825A", color: "#fff",
border: "none", borderRadius: "14px", fontFamily: "Nunito, sans-serif",
fontWeight: 900, fontSize: "0.9rem", cursor: "pointer",
}}
>
{isLast ? "Let's start! π" : "Next"}
</button>
</div>
{!isLast && (
<button
onClick={onClose}
style={{
display: "block", margin: "14px auto 0 auto", background: "none",
border: "none", color: "#aaa", fontSize: "0.75rem",
fontFamily: "Nunito, sans-serif", cursor: "pointer", textDecoration: "underline",
}}
>
Skip tutorial
</button>
)}
</div>
</div>
);
}
|