feat: add onboarding

This commit is contained in:
2026-04-25 10:28:35 +02:00
parent 8358fcb230
commit b6fca292c2
7 changed files with 822 additions and 55 deletions

View File

@ -1,7 +1,7 @@
import { useStore } from "../store";
export default function HomeView() {
const { guides, openGuide, profiles, activeProfileId } = useStore();
export default function HomeView({ needsSync, onSync }: { needsSync?: boolean; onSync?: () => void }) {
const { guides, openGuide, profiles, activeProfileId, syncing } = useStore();
const activeProfile = profiles.find(p => p.id === activeProfileId);
const totalQuests = guides.reduce((s, g) => s + g.total_quests, 0);
@ -24,6 +24,39 @@ export default function HomeView() {
)}
</div>
{/* First-time sync CTA */}
{needsSync && (
<div style={{
background: "rgba(240,192,64,0.06)", border: "1px solid rgba(240,192,64,0.35)",
borderRadius: "10px", padding: "20px 24px", marginBottom: "24px",
display: "flex", flexDirection: "column", alignItems: "center", gap: "12px",
textAlign: "center",
}}>
<div style={{ fontSize: "11px", fontWeight: 600, color: "#f0c040", textTransform: "uppercase", letterSpacing: "0.1em" }}>
Première utilisation
</div>
<p style={{ fontSize: "13px", color: "#94a3b8", lineHeight: 1.6, margin: 0 }}>
Aucun guide chargé. Synchronisez pour récupérer les données depuis Google Sheets.
</p>
<button
onClick={onSync}
disabled={!onSync || syncing}
style={{
background: "#f0c040", color: "#0d1117", border: "none",
padding: "9px 24px", borderRadius: "8px", fontWeight: 700,
fontSize: "13px", cursor: onSync && !syncing ? "pointer" : "default",
display: "flex", alignItems: "center", gap: "8px",
opacity: onSync && !syncing ? 1 : 0.5,
}}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>
</svg>
Synchroniser les guides
</button>
</div>
)}
{/* Global progress */}
{guides.length > 0 && (
<div style={{