Make Dashboard explainer always accessible via help icon
Adds a HelpCircle toggle button in the Dashboard header so users can re-open the platform explainer after dismissing it. The per-user dismissed state is preserved as the initial-open default. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { BookOpen, CheckSquare, Trophy, Sparkles, X } from 'lucide-react';
|
import { BookOpen, CheckSquare, Trophy, Sparkles, X, HelpCircle } from 'lucide-react';
|
||||||
import { useApp } from '../store/AppContext';
|
import { useApp } from '../store/AppContext';
|
||||||
import Card from '../components/ui/Card';
|
import Card from '../components/ui/Card';
|
||||||
import Button from '../components/ui/Button';
|
import Button from '../components/ui/Button';
|
||||||
@@ -97,11 +97,19 @@ const Dashboard = () => {
|
|||||||
setExplainerOpen(storage.get(explainerKey, false) !== true);
|
setExplainerOpen(storage.get(explainerKey, false) !== true);
|
||||||
}, [explainerKey]);
|
}, [explainerKey]);
|
||||||
|
|
||||||
const dismissExplainer = () => {
|
const closeExplainer = () => {
|
||||||
setExplainerOpen(false);
|
setExplainerOpen(false);
|
||||||
if (explainerKey) storage.set(explainerKey, true);
|
if (explainerKey) storage.set(explainerKey, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleExplainer = () => {
|
||||||
|
if (explainerOpen) {
|
||||||
|
closeExplainer();
|
||||||
|
} else {
|
||||||
|
setExplainerOpen(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const explainerSteps = [
|
const explainerSteps = [
|
||||||
{ icon: BookOpen, title: 'Learn', text: 'Each week you get one topic from the knowledge base. Work through the learning session at your own pace.' },
|
{ icon: BookOpen, title: 'Learn', text: 'Each week you get one topic from the knowledge base. Work through the learning session at your own pace.' },
|
||||||
{ icon: CheckSquare, title: 'Test', text: 'Once your learning session is done, take the 5-question test to lock in what you learned and earn points.' },
|
{ icon: CheckSquare, title: 'Test', text: 'Once your learning session is done, take the 5-question test to lock in what you learned and earn points.' },
|
||||||
@@ -111,21 +119,33 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-6 md:p-10 space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500">
|
<div className="p-6 md:p-10 space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<header>
|
<header className="flex items-start justify-between gap-4">
|
||||||
|
<div>
|
||||||
<h1 className="text-3xl md:text-5xl mb-2">Welcome, {currentUser?.name}</h1>
|
<h1 className="text-3xl md:text-5xl mb-2">Welcome, {currentUser?.name}</h1>
|
||||||
<p className="text-fg-muted text-lg">
|
<p className="text-fg-muted text-lg">
|
||||||
{curriculumActive
|
{curriculumActive
|
||||||
? `Cycle ${currentCycle} · Week ${currWeek} of 26`
|
? `Cycle ${currentCycle} · Week ${currWeek} of 26`
|
||||||
: `Here is your overview for week ${weekNumber}.`}
|
: `Here is your overview for week ${weekNumber}.`}
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleExplainer}
|
||||||
|
aria-label={explainerOpen ? 'Hide platform explainer' : 'How Respellion works'}
|
||||||
|
aria-expanded={explainerOpen}
|
||||||
|
title="How Respellion works"
|
||||||
|
className="flex-shrink-0 w-10 h-10 rounded-full border border-bg-warm bg-paper text-fg-muted hover:text-fg hover:border-teal transition-colors flex items-center justify-center"
|
||||||
|
>
|
||||||
|
<HelpCircle size={20} />
|
||||||
|
</button>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{/* Platform explainer — dismissible, per user */}
|
{/* Platform explainer — toggled via header help icon, per-user dismissed state */}
|
||||||
{explainerOpen && (
|
{explainerOpen && (
|
||||||
<Card className="relative border border-bg-warm bg-paper">
|
<Card className="relative border border-bg-warm bg-paper">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={dismissExplainer}
|
onClick={closeExplainer}
|
||||||
aria-label="Dismiss"
|
aria-label="Dismiss"
|
||||||
className="absolute top-4 right-4 text-fg-muted hover:text-fg transition-colors"
|
className="absolute top-4 right-4 text-fg-muted hover:text-fg transition-colors"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user