Spaces:
Running
Running
Upload 12 files
Browse files- README.md +4 -2
- config.js +3 -0
- dashboard.html +78 -68
- practice.html +72 -28
- rise-frontend.js +65 -26
- speaking.html +4 -6
- streaks.html +35 -0
README.md
CHANGED
|
@@ -10,6 +10,8 @@ pinned: false
|
|
| 10 |
|
| 11 |
# RISE
|
| 12 |
|
| 13 |
-
AI-
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# RISE
|
| 12 |
|
| 13 |
+
RISE is an AI-assisted reading practice application with guided sentence, paragraph, and story activities across five difficulty levels.
|
| 14 |
|
| 15 |
+
The static frontend is hosted on Hugging Face Spaces. The FastAPI backend runs separately in Google Colab and uses Whisper for speech recognition, MediaPipe for hand gestures, gTTS for pronunciation playback, and the RISE custom encoder-decoder Transformer for text generation.
|
| 16 |
+
|
| 17 |
+
See `README_START_HERE.txt` for the updated setup and deployment instructions.
|
config.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* RISE shared frontend configuration.
|
| 2 |
+
Update this ONE value whenever Colab creates a new Cloudflare tunnel URL. */
|
| 3 |
+
window.RISE_API_BASE = "https://dressing-cholesterol-columbus-traffic.trycloudflare.com/";
|
dashboard.html
CHANGED
|
@@ -3,85 +3,95 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
-
<nav class="
|
| 11 |
-
<
|
| 12 |
-
<div class="nav-links">
|
| 13 |
-
<a href="dashboard.html">Home</a>
|
| 14 |
-
<a href="practice.html">Practice</a>
|
| 15 |
-
<a href="#progress">Progress</a>
|
| 16 |
-
</div>
|
| 17 |
-
<a href="index.html" class="signin-btn">Log Out</a>
|
| 18 |
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
<
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
</div>
|
| 27 |
-
</section>
|
| 28 |
-
|
| 29 |
-
<section class="dashboard-section" id="practice">
|
| 30 |
-
<div class="section-heading">
|
| 31 |
-
<p>YOUR PRACTICE</p>
|
| 32 |
-
<h2>Ready to practise?</h2>
|
| 33 |
-
<p>Choose your level, read aloud, and build your fluency one step at a time.</p>
|
| 34 |
-
</div>
|
| 35 |
-
<div class="dashboard-cards" style="grid-template-columns:minmax(260px,520px);justify-content:center">
|
| 36 |
-
<div class="dashboard-card" style="text-align:center">
|
| 37 |
-
<div class="dashboard-icon">📖</div>
|
| 38 |
-
<h3>Reading Practice</h3>
|
| 39 |
-
<p>Start with a sentence, progress to a paragraph, and finish with a story. Score above 80% to advance.</p>
|
| 40 |
-
<a href="practice.html" class="primary-btn" style="display:inline-flex;justify-content:center;align-items:center;text-decoration:none;width:100%;box-sizing:border-box">Start Practice</a>
|
| 41 |
</div>
|
| 42 |
-
</
|
| 43 |
-
</section>
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
<
|
| 51 |
-
</
|
| 52 |
-
</section>
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
<script>
|
| 56 |
(() => {
|
| 57 |
-
const email
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
}
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
const names = {1:"Beginner",2:"Elementary",3:"Intermediate",4:"Upper Intermediate",5:"Advanced"};
|
| 68 |
-
const descriptions = {1:"Let's build basic reading skills.",2:"Let's strengthen familiar reading skills.",3:"Let's practise connected ideas and varied vocabulary.",4:"Let's develop more complex reading skills.",5:"Let's practise advanced vocabulary and sentence structures."};
|
| 69 |
-
document.getElementById("current-level").textContent = "Level " + profile.unlockedLevel;
|
| 70 |
-
document.getElementById("level-description").textContent = names[profile.unlockedLevel];
|
| 71 |
-
document.getElementById("level-message").textContent =
|
| 72 |
-
"Your current level is Level " + profile.unlockedLevel + " — " + names[profile.unlockedLevel] + ". " + descriptions[profile.unlockedLevel] +
|
| 73 |
-
" Levels 1–" + profile.unlockedLevel + " are available; higher levels unlock after you score at least 80% on the story at your current level.";
|
| 74 |
-
const count = document.querySelector(".progress-card:nth-child(2) .progress-number");
|
| 75 |
-
if (count) count.textContent = String(Number(profile.sessionsCompleted) || 0);
|
| 76 |
-
const scores = profile.attempts.map(a => Number(a.overall)).filter(n => Number.isFinite(n));
|
| 77 |
-
const avg = scores.length ? scores.reduce((a,b) => a+b,0) / scores.length : 0;
|
| 78 |
-
profile.averageScore = Math.round(avg * 100) / 100;
|
| 79 |
-
const confidence = document.querySelector(".progress-card:first-child .progress-fill");
|
| 80 |
-
if (confidence) confidence.style.width = Math.max(0, Math.min(100, profile.averageScore)) + "%";
|
| 81 |
-
const confidenceText = document.querySelector(".progress-card:first-child p");
|
| 82 |
-
if (confidenceText) confidenceText.textContent = scores.length ? "Average practice score: " + profile.averageScore + "%" : "No practice attempts recorded yet";
|
| 83 |
-
if (key) localStorage.setItem(key, JSON.stringify(profile));
|
| 84 |
-
document.querySelectorAll(".signin-btn").forEach(link => link.addEventListener("click", () => localStorage.removeItem("riseActiveUserEmail")));
|
| 85 |
})();
|
| 86 |
</script>
|
| 87 |
</body>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>My RISE Home</title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<style>
|
| 9 |
+
:root{--rise-ink:#24324b;--rise-muted:#68758d;--rise-blue:#dff2ff;--rise-lilac:#eee8ff;--rise-yellow:#fff3c8;--rise-pink:#ffe5ee;--rise-green:#e2f7e9;--rise-purple:#6654d9}
|
| 10 |
+
body{background:#f8faff;color:var(--rise-ink)}
|
| 11 |
+
.kid-nav{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px max(5vw,20px);background:#fff;border-bottom:1px solid #e9edf5;position:sticky;top:0;z-index:10}
|
| 12 |
+
.kid-nav .logo{font-weight:900;font-size:1.7rem;letter-spacing:.08em;color:var(--rise-purple)}
|
| 13 |
+
.kid-nav-links{display:flex;gap:18px;flex-wrap:wrap}.kid-nav a{color:var(--rise-ink);font-weight:700;text-decoration:none}.kid-nav a:hover{color:var(--rise-purple)}
|
| 14 |
+
.kid-main{max-width:1120px;margin:0 auto;padding:34px 22px 70px}
|
| 15 |
+
.welcome-card{background:linear-gradient(120deg,#e6f5ff,#f1eaff 58%,#fff0f4);border-radius:30px;padding:clamp(26px,5vw,54px);display:grid;grid-template-columns:1.4fr .8fr;gap:25px;align-items:center;box-shadow:0 12px 35px #465b8a12}
|
| 16 |
+
.eyebrow{font-size:.78rem;font-weight:900;letter-spacing:.14em;color:#6654d9;text-transform:uppercase}.welcome-card h1{font-size:clamp(2rem,5vw,3.4rem);line-height:1.1;margin:10px 0}.welcome-card p{color:var(--rise-muted);font-size:1.05rem;line-height:1.65;max-width:590px}
|
| 17 |
+
.welcome-art{min-height:190px;border-radius:26px;background:radial-gradient(circle at 50% 30%,#fff 0 12%,transparent 13%),linear-gradient(145deg,#d4f1ff,#e7e0ff);display:grid;place-items:center;font-size:5rem}
|
| 18 |
+
.kid-btn{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:16px;padding:15px 24px;background:var(--rise-purple);color:#fff;text-decoration:none;font-weight:850;font-size:1rem;box-shadow:0 7px 0 #493bb4;cursor:pointer}.kid-btn:active{transform:translateY(3px);box-shadow:0 4px 0 #493bb4}
|
| 19 |
+
.section-title{margin:38px 0 18px}.section-title h2{font-size:1.7rem;margin:4px 0}.section-title p{color:var(--rise-muted);margin:0}
|
| 20 |
+
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.stat-card{border-radius:24px;padding:22px;background:#fff;box-shadow:0 8px 26px #465b8a0d;border:1px solid #edf0f6}.stat-card:nth-child(1){background:var(--rise-yellow)}.stat-card:nth-child(2){background:var(--rise-pink)}.stat-card:nth-child(3){background:var(--rise-green)}.stat-label{font-size:.9rem;font-weight:800;color:#58657b}.stat-number{font-size:2.3rem;font-weight:950;margin:8px 0}.stat-card p{margin:0;color:#59667a}
|
| 21 |
+
.action-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.action-card{background:#fff;border:1px solid #edf0f6;border-radius:24px;padding:24px;display:flex;gap:18px;align-items:flex-start;box-shadow:0 8px 26px #465b8a0d}.action-icon{width:58px;height:58px;flex:0 0 58px;border-radius:18px;display:grid;place-items:center;font-size:1.7rem;background:var(--rise-blue)}.action-card:nth-child(2) .action-icon{background:var(--rise-lilac)}.action-card h3{margin:2px 0 7px}.action-card p{color:var(--rise-muted);line-height:1.5;margin:0 0 14px}.text-link{color:var(--rise-purple);font-weight:850;text-decoration:none}
|
| 22 |
+
.progress-track{height:12px;border-radius:99px;background:#e8eaf2;overflow:hidden;margin:14px 0 8px}.progress-fill{height:100%;width:0;background:linear-gradient(90deg,#7c6cf0,#49b9dc);border-radius:99px;transition:width .3s}
|
| 23 |
+
.kid-footer{text-align:center;padding:24px;color:var(--rise-muted)}
|
| 24 |
+
@media(max-width:760px){.welcome-card{grid-template-columns:1fr}.welcome-art{min-height:130px}.stat-grid{grid-template-columns:1fr}.action-grid{grid-template-columns:1fr}.kid-nav{align-items:flex-start;flex-direction:column}}
|
| 25 |
+
</style>
|
| 26 |
</head>
|
| 27 |
<body>
|
| 28 |
+
<nav class="kid-nav">
|
| 29 |
+
<a class="logo" href="dashboard.html">RISE</a>
|
| 30 |
+
<div class="kid-nav-links"><a href="dashboard.html">Home</a><a href="practice.html">Reading Practice</a><a href="streaks.html">My Streaks</a><a href="index.html" id="logout-link">Log Out</a></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
</nav>
|
| 32 |
+
<main class="kid-main">
|
| 33 |
+
<section class="welcome-card">
|
| 34 |
+
<div>
|
| 35 |
+
<div class="eyebrow">A little practice makes big progress</div>
|
| 36 |
+
<h1 id="welcome-title">Hello, reader!</h1>
|
| 37 |
+
<p>Welcome to your RISE reading garden. Read a little, practise your words, and watch your skills grow one step at a time.</p>
|
| 38 |
+
<a class="kid-btn" href="practice.html">Start Reading</a>
|
| 39 |
+
</div>
|
| 40 |
+
<div class="welcome-art" aria-hidden="true">📚</div>
|
| 41 |
+
</section>
|
| 42 |
|
| 43 |
+
<section>
|
| 44 |
+
<div class="section-title"><div class="eyebrow">Your journey</div><h2>Look how far you have come!</h2><p>Every practice session is a step forward.</p></div>
|
| 45 |
+
<div class="stat-grid">
|
| 46 |
+
<article class="stat-card"><div class="stat-label">CURRENT STREAK</div><div class="stat-number"><span id="current-streak">0</span> days</div><p>Keep your reading habit going.</p></article>
|
| 47 |
+
<article class="stat-card"><div class="stat-label">SESSIONS COMPLETED</div><div class="stat-number" id="sessions-completed">0</div><p>Every session counts.</p></article>
|
| 48 |
+
<article class="stat-card"><div class="stat-label">YOUR READING LEVEL</div><div class="stat-number" id="current-level">Level 1</div><p id="level-name">Beginner</p></article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
</div>
|
| 50 |
+
</section>
|
|
|
|
| 51 |
|
| 52 |
+
<section>
|
| 53 |
+
<div class="section-title"><div class="eyebrow">Choose your next step</div><h2>What would you like to do?</h2></div>
|
| 54 |
+
<div class="action-grid">
|
| 55 |
+
<article class="action-card"><div class="action-icon">A</div><div><h3>Reading Practice</h3><p>Read sentences, paragraphs, and stories. Earn your way to the next level.</p><a class="text-link" href="practice.html">Choose a level →</a></div></article>
|
| 56 |
+
<article class="action-card"><div class="action-icon">★</div><div><h3>My Streaks</h3><p>See your current streak, your best streak, and the days you practised.</p><a class="text-link" href="streaks.html">View my streaks →</a></div></article>
|
| 57 |
+
</div>
|
| 58 |
+
</section>
|
|
|
|
| 59 |
|
| 60 |
+
<section>
|
| 61 |
+
<div class="section-title"><div class="eyebrow">Keep growing</div><h2>Your practice progress</h2><p id="progress-caption">Complete a practice session to start filling your progress bar.</p></div>
|
| 62 |
+
<div class="stat-card" style="background:#fff"><div style="display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-weight:850"><span>Average reading score</span><span id="average-score">0%</span></div><div class="progress-track"><div class="progress-fill" id="score-fill"></div></div><p style="color:#68758d;margin:0">Your scores help you see how your reading is improving.</p></div>
|
| 63 |
+
</section>
|
| 64 |
+
</main>
|
| 65 |
+
<footer class="kid-footer">RISE · Read, Improve, Shine, Every day</footer>
|
| 66 |
+
<script src="config.js"></script>
|
| 67 |
<script>
|
| 68 |
(() => {
|
| 69 |
+
const email=(localStorage.getItem("riseActiveUserEmail")||"").trim().toLowerCase();
|
| 70 |
+
if(!email){window.location.href="signin.html";return;}
|
| 71 |
+
const key="riseUser:"+email;
|
| 72 |
+
let profile=JSON.parse(localStorage.getItem(key)||"null")||{};
|
| 73 |
+
const firstName=(profile.name||email.split("@")[0]||"reader").split(/[ ._-]/)[0];
|
| 74 |
+
document.getElementById("welcome-title").textContent="Hello, "+firstName+"!";
|
| 75 |
+
const api=(window.RISE_API_BASE||"").replace(/\/+$/,"");
|
| 76 |
+
const names={1:"Beginner",2:"Elementary",3:"Intermediate",4:"Upper Intermediate",5:"Advanced"};
|
| 77 |
+
function render(p){
|
| 78 |
+
const level=Math.min(5,Math.max(1,Number(p.unlocked_level??p.unlockedLevel)||1));
|
| 79 |
+
document.getElementById("current-streak").textContent=Number(p.current_streak??p.currentStreak)||0;
|
| 80 |
+
document.getElementById("sessions-completed").textContent=Number(p.sessions_completed??p.sessionsCompleted)||0;
|
| 81 |
+
document.getElementById("current-level").textContent="Level "+level;
|
| 82 |
+
document.getElementById("level-name").textContent=names[level];
|
| 83 |
+
const attempts=Array.isArray(p.attempts)?p.attempts:(Array.isArray(profile.attempts)?profile.attempts:[]);
|
| 84 |
+
const scores=attempts.map(a=>Number(a.metrics?.overall??a.overall)).filter(Number.isFinite);
|
| 85 |
+
const avg=scores.length?scores.reduce((a,b)=>a+b,0)/scores.length:0;
|
| 86 |
+
document.getElementById("average-score").textContent=avg.toFixed(1)+"%";
|
| 87 |
+
document.getElementById("score-fill").style.width=Math.max(0,Math.min(100,avg))+"%";
|
| 88 |
+
document.getElementById("progress-caption").textContent=scores.length?"You have completed "+scores.length+" reading evaluations. Keep practising!":"Complete a practice session to start filling your progress bar.";
|
| 89 |
+
profile={...profile,unlockedLevel:level,sessionsCompleted:Number(p.sessions_completed??p.sessionsCompleted)||0,currentStreak:Number(p.current_streak??p.currentStreak)||0,longestStreak:Number(p.longest_streak??p.longestStreak)||0,lastCompletedDate:p.last_completed_date??p.lastCompletedDate??null,attempts};
|
| 90 |
+
localStorage.setItem(key,JSON.stringify(profile));
|
| 91 |
}
|
| 92 |
+
render(profile);
|
| 93 |
+
fetch(api+"/api/progress/"+encodeURIComponent(email)).then(r=>{if(!r.ok)throw new Error("Progress unavailable");return r.json();}).then(render).catch(e=>console.warn(e));
|
| 94 |
+
document.getElementById("logout-link").addEventListener("click",()=>localStorage.removeItem("riseActiveUserEmail"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
})();
|
| 96 |
</script>
|
| 97 |
</body>
|
practice.html
CHANGED
|
@@ -6,25 +6,30 @@
|
|
| 6 |
<title>Choose a Level - RISE</title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
<style>
|
| 9 |
-
|
| 10 |
-
.level-
|
|
|
|
|
|
|
|
|
|
| 11 |
.level-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:18px}
|
| 12 |
-
.level-card{background:#
|
|
|
|
| 13 |
.level-card h2{margin:0;font-size:1.25rem}.level-card p{color:#626b7e;line-height:1.55;flex:1}
|
| 14 |
-
.level-card button{width:100%;cursor:pointer;border:0;border-radius:
|
| 15 |
.level-card button:hover{filter:brightness(.95)}
|
| 16 |
#reading-area{max-width:980px;margin:0 auto 50px;padding:0 18px;display:none}
|
| 17 |
.back-link{display:inline-block;margin-bottom:20px}
|
| 18 |
.level-number{font-size:2rem}
|
| 19 |
-
.level-card.locked{opacity:.
|
| 20 |
.level-card button:disabled{cursor:not-allowed;background:#7c8495;filter:none}
|
| 21 |
-
.lock-note{font-size:.9rem;color:#
|
|
|
|
| 22 |
</style>
|
| 23 |
</head>
|
| 24 |
<body>
|
| 25 |
<nav class="navbar">
|
| 26 |
<div class="logo">RISE</div>
|
| 27 |
-
<div class="nav-links"><a href="dashboard.html">Home</a><a href="practice.html">Practice</a><a href="
|
| 28 |
<a href="index.html" class="signin-btn">Log Out</a>
|
| 29 |
</nav>
|
| 30 |
|
|
@@ -51,8 +56,8 @@
|
|
| 51 |
</main>
|
| 52 |
|
| 53 |
<footer><div class="logo">RISE</div><p>AI-powered reading and communication assistance.</p><p class="copyright">© 2026 RISE. All rights reserved.</p></footer>
|
|
|
|
| 54 |
<script>
|
| 55 |
-
window.RISE_API_BASE = "https://lately-wow-deal-arise.trycloudflare.com/";
|
| 56 |
const picker = document.getElementById("level-picker");
|
| 57 |
const readingArea = document.getElementById("reading-area");
|
| 58 |
const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
|
|
@@ -62,29 +67,68 @@
|
|
| 62 |
const starting = 1;
|
| 63 |
profile = { startingLevel: starting, unlockedLevel: starting, attempts: [], sessionsCompleted: 0 };
|
| 64 |
}
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
card.
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
document.querySelectorAll("[data-level]").forEach(button => {
|
| 84 |
-
button.addEventListener("click", () => {
|
| 85 |
const requested = Number(button.dataset.levelNumber);
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
if (requested > latestUnlocked) {
|
| 89 |
alert("This level is locked. Score at least 80% on the previous level's story to unlock it.");
|
| 90 |
return;
|
|
|
|
| 6 |
<title>Choose a Level - RISE</title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
<style>
|
| 9 |
+
body{background:#f8faff;color:#24324b}
|
| 10 |
+
.level-wrap{max-width:1100px;margin:42px auto;padding:0 22px}
|
| 11 |
+
.level-heading{text-align:center;margin-bottom:34px;background:linear-gradient(120deg,#e5f4ff,#f0eaff,#fff0f4);border-radius:28px;padding:34px 22px}
|
| 12 |
+
.level-heading h1{font-size:clamp(2rem,5vw,3rem);color:#283653;margin:8px 0}
|
| 13 |
+
.level-heading p{color:#66738a;line-height:1.6;max-width:720px;margin:8px auto}
|
| 14 |
.level-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:18px}
|
| 15 |
+
.level-card{background:#fff;border:2px solid #e8eaf4;border-radius:24px;padding:24px;text-align:left;display:flex;flex-direction:column;gap:12px;box-shadow:0 8px 24px #465b8a0d;transition:transform .18s,box-shadow .18s}
|
| 16 |
+
.level-card:not(.locked):hover{transform:translateY(-4px);box-shadow:0 14px 28px #465b8a18}
|
| 17 |
.level-card h2{margin:0;font-size:1.25rem}.level-card p{color:#626b7e;line-height:1.55;flex:1}
|
| 18 |
+
.level-card button{width:100%;min-height:52px;cursor:pointer;border:0;border-radius:16px;padding:14px 18px;background:#6654d9;color:white;font-weight:850;font-size:1rem;box-shadow:0 5px 0 #493bb4}
|
| 19 |
.level-card button:hover{filter:brightness(.95)}
|
| 20 |
#reading-area{max-width:980px;margin:0 auto 50px;padding:0 18px;display:none}
|
| 21 |
.back-link{display:inline-block;margin-bottom:20px}
|
| 22 |
.level-number{font-size:2rem}
|
| 23 |
+
.level-card.locked{opacity:.62;background:#f2f3f8;box-shadow:none}
|
| 24 |
.level-card button:disabled{cursor:not-allowed;background:#7c8495;filter:none}
|
| 25 |
+
.lock-note{font-size:.9rem;color:#8b4c60;font-weight:700;line-height:1.4}
|
| 26 |
+
#level-lock-message{background:#fff7d9;border-radius:14px;padding:14px 18px;color:#69562a;font-weight:700;text-align:center;margin:0 auto 20px;max-width:800px}
|
| 27 |
</style>
|
| 28 |
</head>
|
| 29 |
<body>
|
| 30 |
<nav class="navbar">
|
| 31 |
<div class="logo">RISE</div>
|
| 32 |
+
<div class="nav-links"><a href="dashboard.html">Home</a><a href="practice.html">Practice</a><a href="streaks.html">Streaks</a></div>
|
| 33 |
<a href="index.html" class="signin-btn">Log Out</a>
|
| 34 |
</nav>
|
| 35 |
|
|
|
|
| 56 |
</main>
|
| 57 |
|
| 58 |
<footer><div class="logo">RISE</div><p>AI-powered reading and communication assistance.</p><p class="copyright">© 2026 RISE. All rights reserved.</p></footer>
|
| 59 |
+
<script src="config.js"></script>
|
| 60 |
<script>
|
|
|
|
| 61 |
const picker = document.getElementById("level-picker");
|
| 62 |
const readingArea = document.getElementById("reading-area");
|
| 63 |
const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
|
|
|
|
| 67 |
const starting = 1;
|
| 68 |
profile = { startingLevel: starting, unlockedLevel: starting, attempts: [], sessionsCompleted: 0 };
|
| 69 |
}
|
| 70 |
+
let unlockedLevel = Math.min(5, Math.max(1, Number(profile.unlockedLevel) || Number(profile.startingLevel) || 1));
|
| 71 |
+
|
| 72 |
+
function renderLevelLocks() {
|
| 73 |
+
document.getElementById("level-lock-message").textContent =
|
| 74 |
+
"Your current level is Level " + unlockedLevel + ". You can access this level and all earlier levels. Score at least 80% on the story to unlock the next level.";
|
| 75 |
+
document.querySelectorAll("[data-level-card]").forEach(card => {
|
| 76 |
+
const n = Number(card.dataset.levelCard);
|
| 77 |
+
const button = card.querySelector("button[data-level]");
|
| 78 |
+
const note = card.querySelector(".lock-note");
|
| 79 |
+
if (n > unlockedLevel) {
|
| 80 |
+
card.classList.add("locked");
|
| 81 |
+
button.disabled = true;
|
| 82 |
+
button.textContent = "🔒 Level Locked";
|
| 83 |
+
note.hidden = false;
|
| 84 |
+
note.textContent = "Score 80% or above on Level " + (n - 1) + " story to unlock.";
|
| 85 |
+
} else {
|
| 86 |
+
card.classList.remove("locked");
|
| 87 |
+
button.disabled = false;
|
| 88 |
+
button.textContent = "Start Level " + n;
|
| 89 |
+
note.hidden = true;
|
| 90 |
+
}
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// The backend is the source of truth. Browser storage is only a display cache.
|
| 95 |
+
async function loadAuthoritativeProgress() {
|
| 96 |
+
if (!activeEmail) return;
|
| 97 |
+
try {
|
| 98 |
+
const response = await fetch(window.RISE_API_BASE.replace(/\/+$/, "") + "/api/progress/" + encodeURIComponent(activeEmail));
|
| 99 |
+
if (!response.ok) throw new Error("Progress service returned " + response.status);
|
| 100 |
+
const progress = await response.json();
|
| 101 |
+
unlockedLevel = Math.min(5, Math.max(1, Number(progress.unlocked_level) || 1));
|
| 102 |
+
profile.unlockedLevel = unlockedLevel;
|
| 103 |
+
profile.sessionsCompleted = Number(progress.sessions_completed) || 0;
|
| 104 |
+
profile.currentStreak = Number(progress.current_streak) || 0;
|
| 105 |
+
profile.longestStreak = Number(progress.longest_streak) || 0;
|
| 106 |
+
profile.lastCompletedDate = progress.last_completed_date || null;
|
| 107 |
+
profile.activeDates = Array.isArray(progress.active_dates) ? progress.active_dates : [];
|
| 108 |
+
if (profileKey) localStorage.setItem(profileKey, JSON.stringify(profile));
|
| 109 |
+
} catch (error) {
|
| 110 |
+
console.warn("Could not load server progress; showing cached progress only:", error);
|
| 111 |
}
|
| 112 |
+
renderLevelLocks();
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
renderLevelLocks();
|
| 116 |
+
loadAuthoritativeProgress();
|
| 117 |
document.querySelectorAll("[data-level]").forEach(button => {
|
| 118 |
+
button.addEventListener("click", async () => {
|
| 119 |
const requested = Number(button.dataset.levelNumber);
|
| 120 |
+
let latestUnlocked = unlockedLevel;
|
| 121 |
+
try {
|
| 122 |
+
const response = await fetch(window.RISE_API_BASE.replace(/\/+$/, "") + "/api/progress/" + encodeURIComponent(activeEmail));
|
| 123 |
+
if (response.ok) {
|
| 124 |
+
const latest = await response.json();
|
| 125 |
+
latestUnlocked = Math.min(5, Math.max(1, Number(latest.unlocked_level) || 1));
|
| 126 |
+
unlockedLevel = latestUnlocked;
|
| 127 |
+
renderLevelLocks();
|
| 128 |
+
}
|
| 129 |
+
} catch (error) {
|
| 130 |
+
console.warn("Could not verify level access with backend:", error);
|
| 131 |
+
}
|
| 132 |
if (requested > latestUnlocked) {
|
| 133 |
alert("This level is locked. Score at least 80% on the previous level's story to unlock it.");
|
| 134 |
return;
|
rise-frontend.js
CHANGED
|
@@ -43,18 +43,19 @@
|
|
| 43 |
<style>
|
| 44 |
#rise-reading-app {
|
| 45 |
font-family: system-ui, sans-serif;
|
| 46 |
-
color: #
|
| 47 |
-
max-width:
|
| 48 |
-
margin:
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
#rise-reading-app .rise-card {
|
| 52 |
-
border: 1px solid #
|
| 53 |
-
border-radius:
|
| 54 |
-
padding:
|
| 55 |
-
margin:
|
| 56 |
background: #fff;
|
| 57 |
-
box-shadow: 0
|
| 58 |
}
|
| 59 |
|
| 60 |
#rise-reading-app .rise-row {
|
|
@@ -66,20 +67,25 @@
|
|
| 66 |
|
| 67 |
#rise-reading-app button {
|
| 68 |
border: 0;
|
| 69 |
-
border-radius:
|
| 70 |
-
|
| 71 |
-
|
|
|
|
| 72 |
color: white;
|
| 73 |
-
font-weight:
|
|
|
|
| 74 |
cursor: pointer;
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
#rise-reading-app button.secondary {
|
| 78 |
-
background: #
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
#rise-reading-app button.danger {
|
| 82 |
-
background: #
|
|
|
|
| 83 |
}
|
| 84 |
|
| 85 |
#rise-reading-app button:disabled {
|
|
@@ -92,9 +98,10 @@
|
|
| 92 |
line-height: 1.9;
|
| 93 |
white-space: pre-wrap;
|
| 94 |
overflow-wrap: anywhere;
|
| 95 |
-
background: #
|
| 96 |
-
padding:
|
| 97 |
-
border-radius:
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
#rise-reading-app .rise-muted {
|
|
@@ -112,9 +119,9 @@
|
|
| 112 |
}
|
| 113 |
|
| 114 |
#rise-reading-app .rise-metric {
|
| 115 |
-
background: #
|
| 116 |
-
border-radius:
|
| 117 |
-
padding:
|
| 118 |
overflow-wrap: anywhere;
|
| 119 |
}
|
| 120 |
|
|
@@ -135,8 +142,14 @@
|
|
| 135 |
color: #15803d;
|
| 136 |
}
|
| 137 |
|
| 138 |
-
#rise-reading-app video {
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
}
|
| 141 |
</style>
|
| 142 |
|
|
@@ -229,6 +242,11 @@
|
|
| 229 |
const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
|
| 230 |
const profileKey = activeEmail ? "riseUser:" + activeEmail : null;
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
function loadUserProfile() {
|
| 233 |
let profile = profileKey ? JSON.parse(localStorage.getItem(profileKey) || "null") : null;
|
| 234 |
if (!profile) {
|
|
@@ -269,10 +287,23 @@
|
|
| 269 |
return profile;
|
| 270 |
}
|
| 271 |
|
| 272 |
-
function
|
|
|
|
| 273 |
const profile = loadUserProfile();
|
| 274 |
-
profile.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
if (profileKey) localStorage.setItem(profileKey, JSON.stringify(profile));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
}
|
| 277 |
|
| 278 |
const setStatus = (message, isError = false) => {
|
|
@@ -356,6 +387,7 @@
|
|
| 356 |
"Content-Type": "application/json"
|
| 357 |
},
|
| 358 |
body: JSON.stringify({
|
|
|
|
| 359 |
level: selectedLevel,
|
| 360 |
part: "sentence"
|
| 361 |
})
|
|
@@ -366,6 +398,7 @@
|
|
| 366 |
}
|
| 367 |
|
| 368 |
sessionId = data.session_id;
|
|
|
|
| 369 |
|
| 370 |
showPassage(data);
|
| 371 |
|
|
@@ -564,6 +597,7 @@
|
|
| 564 |
|
| 565 |
const passed = Boolean(data.passed);
|
| 566 |
saveEvaluationProgress(data);
|
|
|
|
| 567 |
|
| 568 |
$("rise-feedback").textContent =
|
| 569 |
`${passed ? "✅ Passed! " : "🔁 Try again. "}` +
|
|
@@ -619,6 +653,7 @@
|
|
| 619 |
|
| 620 |
// Handle progression returned by the backend.
|
| 621 |
if (data.completed) {
|
|
|
|
| 622 |
setStatus(
|
| 623 |
data.message ||
|
| 624 |
"Congratulations! You completed the reading levels."
|
|
@@ -705,7 +740,7 @@
|
|
| 705 |
}
|
| 706 |
);
|
| 707 |
|
| 708 |
-
|
| 709 |
setStatus(
|
| 710 |
`Session finished. Attempts: ${data.attempts ?? "N/A"}; ` +
|
| 711 |
`average overall score: ${data.average_overall ?? "N/A"}%; ` +
|
|
@@ -821,6 +856,10 @@
|
|
| 821 |
`Detected: ${data.gesture || "unknown"} · ` +
|
| 822 |
`Action: ${data.action || "none"}`;
|
| 823 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
if (data.passage) {
|
| 825 |
showPassage({
|
| 826 |
level: data.level,
|
|
@@ -837,7 +876,7 @@
|
|
| 837 |
$("rise-start").disabled = false;
|
| 838 |
setSessionControls(false);
|
| 839 |
|
| 840 |
-
} else if (data.action && data.action !== "none") {
|
| 841 |
setStatus(`Gesture applied: ${data.action}.`);
|
| 842 |
}
|
| 843 |
|
|
|
|
| 43 |
<style>
|
| 44 |
#rise-reading-app {
|
| 45 |
font-family: system-ui, sans-serif;
|
| 46 |
+
color: #24324b;
|
| 47 |
+
max-width: 960px;
|
| 48 |
+
margin: 26px auto;
|
| 49 |
+
padding: 0 10px;
|
| 50 |
}
|
| 51 |
|
| 52 |
#rise-reading-app .rise-card {
|
| 53 |
+
border: 1px solid #e5e9f3;
|
| 54 |
+
border-radius: 24px;
|
| 55 |
+
padding: 24px;
|
| 56 |
+
margin: 16px 0;
|
| 57 |
background: #fff;
|
| 58 |
+
box-shadow: 0 8px 26px #465b8a10;
|
| 59 |
}
|
| 60 |
|
| 61 |
#rise-reading-app .rise-row {
|
|
|
|
| 67 |
|
| 68 |
#rise-reading-app button {
|
| 69 |
border: 0;
|
| 70 |
+
border-radius: 15px;
|
| 71 |
+
min-height: 48px;
|
| 72 |
+
padding: 12px 18px;
|
| 73 |
+
background: #6654d9;
|
| 74 |
color: white;
|
| 75 |
+
font-weight: 800;
|
| 76 |
+
font-size: 0.98rem;
|
| 77 |
cursor: pointer;
|
| 78 |
+
box-shadow: 0 4px 0 #493bb4;
|
| 79 |
}
|
| 80 |
|
| 81 |
#rise-reading-app button.secondary {
|
| 82 |
+
background: #52728c;
|
| 83 |
+
box-shadow: 0 4px 0 #36536a;
|
| 84 |
}
|
| 85 |
|
| 86 |
#rise-reading-app button.danger {
|
| 87 |
+
background: #d35d72;
|
| 88 |
+
box-shadow: 0 4px 0 #a33d51;
|
| 89 |
}
|
| 90 |
|
| 91 |
#rise-reading-app button:disabled {
|
|
|
|
| 98 |
line-height: 1.9;
|
| 99 |
white-space: pre-wrap;
|
| 100 |
overflow-wrap: anywhere;
|
| 101 |
+
background: #f0f7ff;
|
| 102 |
+
padding: 22px;
|
| 103 |
+
border-radius: 18px;
|
| 104 |
+
border: 1px solid #e0edfa;
|
| 105 |
}
|
| 106 |
|
| 107 |
#rise-reading-app .rise-muted {
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
#rise-reading-app .rise-metric {
|
| 122 |
+
background: #f2efff;
|
| 123 |
+
border-radius: 14px;
|
| 124 |
+
padding: 14px;
|
| 125 |
overflow-wrap: anywhere;
|
| 126 |
}
|
| 127 |
|
|
|
|
| 142 |
color: #15803d;
|
| 143 |
}
|
| 144 |
|
| 145 |
+
#rise-reading-app video { max-width: 100%; border-radius: 16px; }
|
| 146 |
+
#rise-reading-app button:focus-visible { outline: 3px solid #f0bf4c; outline-offset: 3px; }
|
| 147 |
+
#rise-reading-app h2, #rise-reading-app h3 { color: #283653; }
|
| 148 |
+
#rise-reading-app .rise-muted { line-height: 1.6; }
|
| 149 |
+
@media (max-width: 600px) {
|
| 150 |
+
#rise-reading-app .rise-card { padding: 18px; }
|
| 151 |
+
#rise-reading-app #rise-passage { font-size: 1.12rem; }
|
| 152 |
+
#rise-reading-app button { width: 100%; }
|
| 153 |
}
|
| 154 |
</style>
|
| 155 |
|
|
|
|
| 242 |
const activeEmail = (localStorage.getItem("riseActiveUserEmail") || "").trim().toLowerCase();
|
| 243 |
const profileKey = activeEmail ? "riseUser:" + activeEmail : null;
|
| 244 |
|
| 245 |
+
if (!activeEmail) {
|
| 246 |
+
root.innerHTML = "<section class='rise-card'><h2>Please sign in first</h2><p>Sign in to save your reading progress and streak.</p><a href='signin.html'>Go to sign in</a></section>";
|
| 247 |
+
return;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
function loadUserProfile() {
|
| 251 |
let profile = profileKey ? JSON.parse(localStorage.getItem(profileKey) || "null") : null;
|
| 252 |
if (!profile) {
|
|
|
|
| 287 |
return profile;
|
| 288 |
}
|
| 289 |
|
| 290 |
+
function syncServerProgress(progress) {
|
| 291 |
+
if (!progress) return;
|
| 292 |
const profile = loadUserProfile();
|
| 293 |
+
profile.unlockedLevel = Math.max(1, Math.min(5, Number(progress.unlocked_level) || 1));
|
| 294 |
+
profile.sessionsCompleted = Number(progress.sessions_completed) || 0;
|
| 295 |
+
profile.currentStreak = Number(progress.current_streak) || 0;
|
| 296 |
+
profile.longestStreak = Number(progress.longest_streak) || 0;
|
| 297 |
+
profile.lastCompletedDate = progress.last_completed_date || null;
|
| 298 |
+
profile.activeDates = Array.isArray(progress.active_dates) ? progress.active_dates : (profile.activeDates || []);
|
| 299 |
+
profile.attempts = Array.isArray(progress.attempts) ? progress.attempts : profile.attempts;
|
| 300 |
if (profileKey) localStorage.setItem(profileKey, JSON.stringify(profile));
|
| 301 |
+
return profile;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
async function refreshServerProgress() {
|
| 305 |
+
const progress = await api(`/api/progress/${encodeURIComponent(activeEmail)}`);
|
| 306 |
+
return syncServerProgress(progress);
|
| 307 |
}
|
| 308 |
|
| 309 |
const setStatus = (message, isError = false) => {
|
|
|
|
| 387 |
"Content-Type": "application/json"
|
| 388 |
},
|
| 389 |
body: JSON.stringify({
|
| 390 |
+
user_id: activeEmail,
|
| 391 |
level: selectedLevel,
|
| 392 |
part: "sentence"
|
| 393 |
})
|
|
|
|
| 398 |
}
|
| 399 |
|
| 400 |
sessionId = data.session_id;
|
| 401 |
+
if (data.progress) syncServerProgress(data.progress);
|
| 402 |
|
| 403 |
showPassage(data);
|
| 404 |
|
|
|
|
| 597 |
|
| 598 |
const passed = Boolean(data.passed);
|
| 599 |
saveEvaluationProgress(data);
|
| 600 |
+
try { await refreshServerProgress(); } catch (progressError) { console.warn("Could not refresh server progress:", progressError); }
|
| 601 |
|
| 602 |
$("rise-feedback").textContent =
|
| 603 |
`${passed ? "✅ Passed! " : "🔁 Try again. "}` +
|
|
|
|
| 653 |
|
| 654 |
// Handle progression returned by the backend.
|
| 655 |
if (data.completed) {
|
| 656 |
+
if (data.progress) syncServerProgress(data.progress);
|
| 657 |
setStatus(
|
| 658 |
data.message ||
|
| 659 |
"Congratulations! You completed the reading levels."
|
|
|
|
| 740 |
}
|
| 741 |
);
|
| 742 |
|
| 743 |
+
if (data.progress) syncServerProgress(data.progress);
|
| 744 |
setStatus(
|
| 745 |
`Session finished. Attempts: ${data.attempts ?? "N/A"}; ` +
|
| 746 |
`average overall score: ${data.average_overall ?? "N/A"}%; ` +
|
|
|
|
| 856 |
`Detected: ${data.gesture || "unknown"} · ` +
|
| 857 |
`Action: ${data.action || "none"}`;
|
| 858 |
|
| 859 |
+
if (data.action === "level_locked") {
|
| 860 |
+
setStatus(data.message || "That level is locked. Complete the previous level's story with 80% or above.", true);
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
if (data.passage) {
|
| 864 |
showPassage({
|
| 865 |
level: data.level,
|
|
|
|
| 876 |
$("rise-start").disabled = false;
|
| 877 |
setSessionControls(false);
|
| 878 |
|
| 879 |
+
} else if (data.action && data.action !== "none" && data.action !== "level_locked") {
|
| 880 |
setStatus(`Gesture applied: ${data.action}.`);
|
| 881 |
}
|
| 882 |
|
speaking.html
CHANGED
|
@@ -20,10 +20,10 @@
|
|
| 20 |
</div>
|
| 21 |
|
| 22 |
<div class="nav-links">
|
| 23 |
-
<a href="dashboard.html">
|
| 24 |
<a href="speaking.html">Speaking</a>
|
| 25 |
-
<a href="
|
| 26 |
-
<a href="
|
| 27 |
</div>
|
| 28 |
|
| 29 |
<a href="index.html" class="signin-btn">
|
|
@@ -134,9 +134,7 @@
|
|
| 134 |
</p>
|
| 135 |
|
| 136 |
</footer>
|
| 137 |
-
<script>
|
| 138 |
-
window.RISE_API_BASE = "https://lately-wow-deal-arise.trycloudflare.com/";
|
| 139 |
-
</script>
|
| 140 |
<script src="rise-frontend.js"></script>
|
| 141 |
</body>
|
| 142 |
|
|
|
|
| 20 |
</div>
|
| 21 |
|
| 22 |
<div class="nav-links">
|
| 23 |
+
<a href="dashboard.html">Home</a>
|
| 24 |
<a href="speaking.html">Speaking</a>
|
| 25 |
+
<a href="practice.html">Reading</a>
|
| 26 |
+
<a href="streaks.html">Streaks</a>
|
| 27 |
</div>
|
| 28 |
|
| 29 |
<a href="index.html" class="signin-btn">
|
|
|
|
| 134 |
</p>
|
| 135 |
|
| 136 |
</footer>
|
| 137 |
+
<script src="config.js"></script>
|
|
|
|
|
|
|
| 138 |
<script src="rise-frontend.js"></script>
|
| 139 |
</body>
|
| 140 |
|
streaks.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 5 |
+
<title>My Streaks - RISE</title><link rel="stylesheet" href="style.css">
|
| 6 |
+
<style>
|
| 7 |
+
body{background:#f8faff;color:#24324b}.streak-nav{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:18px max(5vw,20px);background:#fff;border-bottom:1px solid #e9edf5}.streak-nav .logo{font-size:1.7rem;font-weight:900;letter-spacing:.08em;color:#6654d9}.streak-nav a{color:#24324b;text-decoration:none;font-weight:750}.streak-links{display:flex;gap:18px;flex-wrap:wrap}.streak-main{max-width:900px;margin:0 auto;padding:40px 22px 70px}.streak-hero{background:linear-gradient(130deg,#fff1c9,#ffe5ef 55%,#e9e5ff);border-radius:30px;padding:clamp(26px,5vw,48px);text-align:center}.streak-hero .flame{font-size:4rem}.streak-hero h1{font-size:clamp(2rem,5vw,3rem);margin:8px 0}.streak-hero p{color:#68758d;line-height:1.6}.streak-number{font-size:4rem;font-weight:950;color:#6654d9;line-height:1.1}.streak-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:22px 0}.streak-stat{background:#fff;border:1px solid #edf0f6;border-radius:24px;padding:24px;text-align:center}.streak-stat h2{font-size:2.3rem;margin:8px 0}.streak-stat p{color:#68758d;margin:0}.week-card{background:#fff;border:1px solid #edf0f6;border-radius:24px;padding:24px}.week-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;margin-top:18px}.day{text-align:center;color:#68758d;font-size:.8rem;font-weight:800}.day-dot{height:44px;width:44px;border-radius:50%;margin:8px auto;background:#f0f1f6;display:grid;place-items:center;font-weight:900;color:#9aa3b4}.day-dot.done{background:#dff5e7;color:#247447}.streak-note{background:#eaf5ff;border-radius:18px;padding:18px;margin-top:18px;color:#52647d;line-height:1.6}.streak-btn{display:inline-block;margin-top:20px;background:#6654d9;color:#fff!important;text-decoration:none;border-radius:15px;padding:14px 22px;font-weight:850}.streak-footer{text-align:center;color:#68758d;padding:24px}@media(max-width:600px){.streak-nav{align-items:flex-start;flex-direction:column}.streak-grid{grid-template-columns:1fr}.day-dot{height:34px;width:34px}}
|
| 8 |
+
</style>
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<nav class="streak-nav"><a class="logo" href="dashboard.html">RISE</a><div class="streak-links"><a href="dashboard.html">Home</a><a href="practice.html">Reading Practice</a><a href="streaks.html">My Streaks</a><a href="index.html" id="logout-link">Log Out</a></div></nav>
|
| 12 |
+
<main class="streak-main">
|
| 13 |
+
<section class="streak-hero"><div class="flame" aria-hidden="true">✦</div><div class="eyebrow">Your daily reading habit</div><h1>Keep your streak growing!</h1><p>Finish at least one reading practice session each day to keep your streak alive. More practice on the same day will not add extra streak days.</p><div class="streak-number" id="current-streak">0</div><strong>day current streak</strong></section>
|
| 14 |
+
<section class="streak-grid"><article class="streak-stat"><div class="eyebrow">Your best</div><h2 id="longest-streak">0 days</h2><p>Your longest streak so far</p></article><article class="streak-stat"><div class="eyebrow">Your effort</div><h2 id="sessions-completed">0</h2><p>Completed reading sessions</p></article></section>
|
| 15 |
+
<section class="week-card"><div class="eyebrow">This week</div><h2>Days you completed a session</h2><p style="color:#68758d">A day lights up when you finish at least one reading session.</p><div class="week-grid" id="week-grid"></div><div class="streak-note" id="streak-message">Your streak will start after you finish your first reading practice session.</div></section>
|
| 16 |
+
<div style="text-align:center"><a class="streak-btn" href="practice.html">Start a reading session</a></div>
|
| 17 |
+
</main>
|
| 18 |
+
<footer class="streak-footer">RISE · Every little step counts</footer>
|
| 19 |
+
<script src="config.js"></script>
|
| 20 |
+
<script>
|
| 21 |
+
(()=>{
|
| 22 |
+
const email=(localStorage.getItem("riseActiveUserEmail")||"").trim().toLowerCase();if(!email){location.href="signin.html";return;}
|
| 23 |
+
const api=(window.RISE_API_BASE||"").replace(/\/+$/,"");
|
| 24 |
+
const key="riseUser:"+email;const cached=JSON.parse(localStorage.getItem(key)||"null")||{};
|
| 25 |
+
const today=new Date();const last=cached.lastCompletedDate?new Date(cached.lastCompletedDate+"T00:00:00"):null;
|
| 26 |
+
let completedDates=new Set(cached.activeDates||[]);
|
| 27 |
+
const grid=document.getElementById("week-grid");const labels=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
|
| 28 |
+
function drawWeek(){grid.innerHTML="";const monday=new Date(today);monday.setDate(today.getDate()-((today.getDay()+6)%7));for(let i=0;i<7;i++){const d=new Date(monday);d.setDate(monday.getDate()+i);const iso=d.getFullYear()+"-"+String(d.getMonth()+1).padStart(2,"0")+"-"+String(d.getDate()).padStart(2,"0");const done=completedDates.has(iso)||(cached.lastCompletedDate===iso);const el=document.createElement("div");el.className="day";el.innerHTML="<div>"+labels[i]+"</div><div class='day-dot "+(done?"done":"")+"'>"+(done?"✓":d.getDate())+"</div>";grid.appendChild(el);}}
|
| 29 |
+
function render(p){const current=Number(p.current_streak??p.currentStreak)||0;const longest=Number(p.longest_streak??p.longestStreak)||0;document.getElementById("current-streak").textContent=current;document.getElementById("longest-streak").textContent=longest+" days";document.getElementById("sessions-completed").textContent=Number(p.sessions_completed??p.sessionsCompleted)||0;cached.currentStreak=current;cached.longestStreak=longest;cached.sessionsCompleted=Number(p.sessions_completed??p.sessionsCompleted)||0;cached.lastCompletedDate=p.last_completed_date??p.lastCompletedDate??null;cached.activeDates=Array.isArray(p.active_dates)?p.active_dates:(cached.activeDates||[]);completedDates=new Set(cached.activeDates);cached.attempts=Array.isArray(p.attempts)?p.attempts:(cached.attempts||[]);localStorage.setItem(key,JSON.stringify(cached));const msg=current>0?"Great work! You have practised on consecutive days. Come back tomorrow to keep it going.":"Your current streak is 0. Complete one reading practice session today to start a new streak.";document.getElementById("streak-message").textContent=msg;drawWeek();}
|
| 30 |
+
render(cached);fetch(api+"/api/progress/"+encodeURIComponent(email)).then(r=>{if(!r.ok)throw new Error("Could not load streak data");return r.json();}).then(render).catch(e=>console.warn(e));
|
| 31 |
+
document.getElementById("logout-link").addEventListener("click",()=>localStorage.removeItem("riseActiveUserEmail"));
|
| 32 |
+
})();
|
| 33 |
+
</script>
|
| 34 |
+
</body>
|
| 35 |
+
</html>
|