Spaces:
Running
Running
Download streaks.html from RISEFinalYear/RISE: direct link, hf CLI and curl.
- Browser
- Download file 6.59 kB
-
https://huggingface.co/spaces/RISEFinalYear/RISE/resolve/main/streaks.html
- Command line
-
hf download hf://spaces/RISEFinalYear/RISE/streaks.html
-
curl -L -o streaks.html https://huggingface.co/spaces/RISEFinalYear/RISE/resolve/main/streaks.html
6.59 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>My Streaks - RISE</title><link rel="stylesheet" href="style.css"> | |
| <style> | |
| 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}} | |
| </style> | |
| </head> | |
| <body> | |
| <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> | |
| <main class="streak-main"> | |
| <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> | |
| <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> | |
| <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> | |
| <div style="text-align:center"><a class="streak-btn" href="practice.html">Start a reading session</a></div> | |
| </main> | |
| <footer class="streak-footer">RISE · Every little step counts</footer> | |
| <script src="config.js"></script> | |
| <script> | |
| (()=>{ | |
| const email=(localStorage.getItem("riseActiveUserEmail")||"").trim().toLowerCase();if(!email){location.href="signin.html";return;} | |
| const api=(window.RISE_API_BASE||"").replace(/\/+$/,""); | |
| const key="riseUser:"+email;const cached=JSON.parse(localStorage.getItem(key)||"null")||{}; | |
| const today=new Date();const last=cached.lastCompletedDate?new Date(cached.lastCompletedDate+"T00:00:00"):null; | |
| let completedDates=new Set(cached.activeDates||[]); | |
| const grid=document.getElementById("week-grid");const labels=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]; | |
| 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);}} | |
| 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();} | |
| 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)); | |
| document.getElementById("logout-link").addEventListener("click",()=>localStorage.removeItem("riseActiveUserEmail")); | |
| })(); | |
| </script> | |
| </body> | |
| </html> | |