Compare commits

...

1 Commits

Author SHA1 Message Date
9d181f3676 design: the window can now resize to l=380px 2026-04-22 13:03:25 +02:00
4 changed files with 331 additions and 219 deletions

View File

@ -15,8 +15,8 @@
"title": "TougliGui", "title": "TougliGui",
"width": 1100, "width": 1100,
"height": 720, "height": 720,
"minWidth": 800, "minWidth": 380,
"minHeight": 500, "minHeight": 400,
"decorations": false, "decorations": false,
"transparent": false, "transparent": false,
"backgroundColor": "#0d1117", "backgroundColor": "#0d1117",

View File

@ -1,63 +1,84 @@
import { useState } from "react";
import { openUrl } from "@tauri-apps/plugin-opener"; import { openUrl } from "@tauri-apps/plugin-opener";
import { useStore } from "../store"; import { useStore } from "../store";
import { SectionItem, QuestItem } from "../types"; import { SectionItem, QuestItem, CombatType } from "../types";
function combatIcon(name: string): string {
const l = name.toLowerCase();
if (l.includes("solo")) return "⚔️";
if (l.includes("group") || l.includes("groupe")) return "👥";
if (l.includes("boss")) return "💀";
if (l.includes("arène") || l.includes("arene")) return "🏟️";
return "⚔️";
}
export default function GuideView() { export default function GuideView() {
const { activeGuideData, completedQuests, toggleQuest } = useStore(); const { activeGuideData, completedQuests, toggleQuest } = useStore();
const [resourcesCollapsed, setResourcesCollapsed] = useState(false);
if (!activeGuideData) return null; if (!activeGuideData) return null;
const { name, effect, recommended_level, resources, sections } = activeGuideData; const { name, effect, recommended_level, resources, sections, combat_legend } = activeGuideData;
const allQuests = collectAllQuests(sections); const allQuests = collectAllQuests(sections);
const completedCount = allQuests.filter(q => completedQuests.has(q)).length; const completedCount = allQuests.filter(q => completedQuests.has(q)).length;
const pct = allQuests.length > 0 ? Math.round((completedCount / allQuests.length) * 100) : 0; const pct = allQuests.length > 0 ? Math.round((completedCount / allQuests.length) * 100) : 0;
const isDone = pct === 100;
return ( return (
<div style={{ flex: 1, display: "flex", overflow: "hidden", minHeight: 0 }}> <div style={{ flex: 1, display: "flex", overflow: "hidden", minHeight: 0 }}>
{/* Main quest list */}
<div style={{ flex: 1, overflowY: "auto", padding: "20px 24px" }}> <div style={{ flex: 1, overflowY: "auto", padding: "20px 24px" }}>
{/* Guide header */}
{/* Header */}
<div style={{ marginBottom: "20px" }}> <div style={{ marginBottom: "20px" }}>
<h1 style={{ fontSize: "20px", fontWeight: 700, color: "#f0c040", marginBottom: "4px" }}> <div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "8px", flexWrap: "wrap" }}>
{name} <div style={{ minWidth: 0 }}>
</h1> <h1 style={{ fontSize: "18px", fontWeight: 700, color: "#f0c040", marginBottom: "2px", wordBreak: "break-word" }}>{name}</h1>
<div style={{ display: "flex", gap: "16px", alignItems: "center", marginBottom: "10px" }}>
{recommended_level && ( {recommended_level && (
<span style={{ <div style={{ fontSize: "12px", color: "#94a3b8" }}>
fontSize: "11px", background: "rgba(74,158,255,0.15)", color: "#4a9eff", Niv. recommandé : <span style={{ color: "#e2e8f0", fontWeight: 600 }}>{recommended_level}</span>
border: "1px solid rgba(74,158,255,0.3)", borderRadius: "4px", padding: "2px 8px",
}}>
Niveau recommandé : {recommended_level}
</span>
)}
<span style={{ fontSize: "11px", color: "#94a3b8" }}>
{completedCount}/{allQuests.length} quêtes · {pct}%
</span>
</div> </div>
{/* Progress bar */} )}
<div style={{ height: "4px", background: "#2d3748", borderRadius: "2px", overflow: "hidden" }}> </div>
<div style={{ textAlign: "right", flexShrink: 0 }}>
<div style={{ fontSize: "13px", fontWeight: 700, color: isDone ? "#4ade80" : "#f0c040" }}>
{completedCount} / {allQuests.length}
</div>
<div style={{ fontSize: "11px", color: "#94a3b8" }}>{pct}%</div>
</div>
</div>
<div style={{ height: "4px", background: "#2d3748", borderRadius: "2px", overflow: "hidden", marginTop: "10px" }}>
<div style={{ <div style={{
height: "100%", width: `${pct}%`, height: "100%", width: `${pct}%`,
background: pct === 100 ? "#4ade80" : "linear-gradient(90deg, #4a9eff, #f0c040)", background: isDone ? "#4ade80" : "linear-gradient(90deg, #4a9eff, #f0c040)",
borderRadius: "2px", transition: "width 0.3s ease", borderRadius: "2px", transition: "width 0.3s ease",
}} /> }} />
</div> </div>
{effect && ( {effect && (
<div style={{ <div style={{
marginTop: "10px", background: "rgba(240,192,64,0.05)", marginTop: "12px", padding: "10px 14px",
border: "1px solid rgba(240,192,64,0.2)", borderRadius: "6px", background: "rgba(240,192,64,0.04)", borderRadius: "6px",
padding: "8px 12px", fontSize: "11px", color: "#94a3b8", lineHeight: 1.5, borderLeft: "3px solid rgba(240,192,64,0.4)",
fontSize: "12px", color: "#94a3b8", lineHeight: 1.6,
}}> }}>
<span style={{ color: "#f0c040", fontWeight: 600 }}>Effet : </span> <span style={{ color: "#f0c040", fontWeight: 600, fontSize: "11px", display: "block", marginBottom: "3px", textTransform: "uppercase", letterSpacing: "0.05em" }}>
Effet
</span>
{effect} {effect}
</div> </div>
)} )}
</div> </div>
{/* Légende */}
{combat_legend.length > 0 && (
<Legend legend={combat_legend} />
)}
{/* Sections */} {/* Sections */}
{sections.map((section, si) => ( {sections.map((section, si) => (
<div key={si} style={{ marginBottom: "20px" }}> <div key={si} style={{ marginBottom: "24px" }}>
<h2 style={{ <h2 style={{
fontSize: "11px", fontWeight: 600, color: "#4a5568", fontSize: "11px", fontWeight: 600, color: "#4a5568",
textTransform: "uppercase", letterSpacing: "0.1em", textTransform: "uppercase", letterSpacing: "0.1em",
@ -75,20 +96,52 @@ export default function GuideView() {
{/* Resources panel */} {/* Resources panel */}
{resources.length > 0 && ( {resources.length > 0 && (
<div style={{ <div style={{
width: "200px", flexShrink: 0, background: "#161b22", width: resourcesCollapsed ? "32px" : "190px",
borderLeft: "1px solid #2d3748", overflowY: "auto", padding: "16px 14px", flexShrink: 0, background: "#161b22",
borderLeft: "1px solid #2d3748",
display: "flex", flexDirection: "column",
overflow: "hidden",
transition: "width 0.2s ease",
}}> }}>
<h3 style={{ {/* Toggle */}
fontSize: "11px", fontWeight: 600, color: "#4a5568", <button
textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "10px", onClick={() => setResourcesCollapsed(c => !c)}
title={resourcesCollapsed ? "Afficher les ressources" : "Masquer les ressources"}
style={{
width: "100%", height: "36px", flexShrink: 0,
background: "transparent", border: "none",
borderBottom: "1px solid #2d3748",
color: "#4a5568", cursor: "pointer",
display: "flex", alignItems: "center",
justifyContent: resourcesCollapsed ? "center" : "flex-start",
padding: "0 10px", gap: "6px",
transition: "all 0.15s",
}}
onMouseEnter={e => (e.currentTarget.style.color = "#f0c040")}
onMouseLeave={e => (e.currentTarget.style.color = "#4a5568")}
>
<span style={{
fontSize: "12px",
transform: resourcesCollapsed ? "rotate(180deg)" : "rotate(0deg)",
transition: "transform 0.2s ease",
display: "inline-block",
}}> }}>
</span>
{!resourcesCollapsed && (
<span style={{ fontSize: "11px", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", whiteSpace: "nowrap" }}>
Ressources Ressources
</h3> </span>
)}
</button>
{/* List */}
{!resourcesCollapsed && (
<div style={{ flex: 1, overflowY: "auto", padding: "10px 14px", scrollbarWidth: "none" }}>
{resources.map((r, i) => ( {resources.map((r, i) => (
<div key={i} style={{ <div key={i} style={{
display: "flex", justifyContent: "space-between", alignItems: "center", display: "flex", justifyContent: "space-between", alignItems: "center",
padding: "4px 0", borderBottom: "1px solid #1f2937", padding: "5px 0", borderBottom: "1px solid #1f2937", fontSize: "12px",
fontSize: "11px",
}}> }}>
<span style={{ color: "#94a3b8", flex: 1, marginRight: "8px" }}>{r.name}</span> <span style={{ color: "#94a3b8", flex: 1, marginRight: "8px" }}>{r.name}</span>
<span style={{ color: "#f0c040", fontWeight: 700, flexShrink: 0 }}>×{r.quantity}</span> <span style={{ color: "#f0c040", fontWeight: 700, flexShrink: 0 }}>×{r.quantity}</span>
@ -97,6 +150,32 @@ export default function GuideView() {
</div> </div>
)} )}
</div> </div>
)}
</div>
);
}
function Legend({ legend }: { legend: CombatType[] }) {
return (
<div style={{
marginBottom: "20px", padding: "12px 16px",
background: "rgba(255,255,255,0.02)", border: "1px solid #2d3748", borderRadius: "8px",
}}>
<div style={{
fontSize: "11px", fontWeight: 600, color: "#4a5568",
textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "10px",
}}>
Légende
</div>
<div style={{ display: "flex", flexWrap: "wrap", gap: "16px" }}>
{legend.map((ct, i) => (
<div key={i} style={{ display: "flex", alignItems: "center", gap: "6px" }}>
<span style={{ fontSize: "15px" }}>{combatIcon(ct.name)}</span>
<span style={{ fontSize: "12px", color: "#94a3b8" }}>{ct.name}</span>
</div>
))}
</div>
</div>
); );
} }
@ -121,11 +200,16 @@ function SectionItemView({ item, completedQuests, onToggle }: {
} }
return ( return (
<div style={{ <div style={{
background: "rgba(74,158,255,0.05)", border: "1px solid rgba(74,158,255,0.15)", marginBottom: "6px", padding: "9px 14px",
borderRadius: "6px", padding: "8px 12px", marginBottom: "4px", background: "rgba(74,158,255,0.04)",
fontSize: "11px", color: "#94a3b8", lineHeight: 1.5, borderLeft: "3px solid rgba(74,158,255,0.35)",
borderRadius: "4px",
fontSize: "12px", color: "#94a3b8", lineHeight: 1.6,
}}> }}>
{item.text} <span style={{ color: "#4a9eff", fontSize: "10px", fontWeight: 600, display: "block", marginBottom: "2px", textTransform: "uppercase", letterSpacing: "0.05em" }}>
Rappel
</span>
{item.text}
</div> </div>
); );
} }
@ -137,10 +221,7 @@ function SectionItemView({ item, completedQuests, onToggle }: {
borderRadius: "6px", padding: "8px 10px", marginBottom: "6px", borderRadius: "6px", padding: "8px 10px", marginBottom: "6px",
}}> }}>
{item.note && ( {item.note && (
<div style={{ <div style={{ fontSize: "11px", color: "#4a9eff", marginBottom: "6px", fontStyle: "italic" }}>
fontSize: "10px", color: "#4a9eff", marginBottom: "6px",
fontStyle: "italic",
}}>
🔗 {item.note} 🔗 {item.note}
</div> </div>
)} )}
@ -169,18 +250,14 @@ function QuestRow({ quest, completed, onToggle, indent }: {
onClick={() => onToggle(quest.name)} onClick={() => onToggle(quest.name)}
style={{ style={{
display: "flex", alignItems: "flex-start", gap: "8px", display: "flex", alignItems: "flex-start", gap: "8px",
padding: indent ? "4px 0" : "5px 6px", padding: indent ? "3px 0" : "4px 6px",
borderRadius: "5px", cursor: "pointer", borderRadius: "5px", cursor: "pointer",
marginBottom: indent ? "2px" : "3px", marginBottom: indent ? "1px" : "2px",
opacity: completed ? 0.6 : 1, opacity: completed ? 0.5 : 1,
transition: "all 0.12s", transition: "all 0.12s",
}} }}
onMouseEnter={e => { onMouseEnter={e => { (e.currentTarget as HTMLElement).style.background = "rgba(255,255,255,0.04)"; }}
(e.currentTarget as HTMLElement).style.background = "rgba(255,255,255,0.04)"; onMouseLeave={e => { (e.currentTarget as HTMLElement).style.background = "transparent"; }}
}}
onMouseLeave={e => {
(e.currentTarget as HTMLElement).style.background = "transparent";
}}
> >
<input <input
type="checkbox" type="checkbox"
@ -190,44 +267,29 @@ function QuestRow({ quest, completed, onToggle, indent }: {
style={{ marginTop: "2px", flexShrink: 0 }} style={{ marginTop: "2px", flexShrink: 0 }}
/> />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ display: "flex", alignItems: "center", gap: "5px", flexWrap: "wrap" }}> <div style={{ display: "flex", alignItems: "baseline", flexWrap: "wrap", gap: "2px 8px" }}>
<span style={{ <span style={{
fontSize: "12px", color: completed ? "#4a5568" : "#e2e8f0", fontSize: "12px", lineHeight: 1.4,
textDecoration: completed ? "line-through" : "none", color: completed ? "#4a5568" : quest.url ? "#93c5fd" : "#e2e8f0",
lineHeight: 1.4, textDecoration: completed ? "line-through" : quest.url ? "underline" : "none",
}}> textDecorationColor: "rgba(147,197,253,0.4)",
cursor: quest.url ? "pointer" : "default",
wordBreak: "break-word",
}}
onClick={e => {
if (quest.url) { e.stopPropagation(); openUrl(quest.url); }
}}
>
{quest.name} {quest.name}
</span> </span>
{quest.url && (
<span
title="Voir sur Dofus Pour Les Noobs"
onClick={e => { e.stopPropagation(); openUrl(quest.url!); }}
style={{
fontSize: "10px", color: "#4a9eff", cursor: "pointer",
opacity: 0.7, flexShrink: 0, lineHeight: 1,
}}
onMouseEnter={e => (e.currentTarget as HTMLElement).style.opacity = "1"}
onMouseLeave={e => (e.currentTarget as HTMLElement).style.opacity = "0.7"}
>
🔗
</span>
)}
</div>
{quest.combat_indicators.length > 0 && (
<div style={{ display: "flex", flexWrap: "wrap", gap: "3px", marginTop: "3px" }}>
{quest.combat_indicators.map((ci, i) => ( {quest.combat_indicators.map((ci, i) => (
<span key={i} style={{ <span key={i} style={{ fontSize: "11px", color: "#94a3b8", whiteSpace: "nowrap", flexShrink: 0 }}>
fontSize: "9px", padding: "1px 5px", {combatIcon(ci.combat_type)} x{ci.count}
background: "rgba(74,158,255,0.15)", color: "#4a9eff",
border: "1px solid rgba(74,158,255,0.25)", borderRadius: "3px",
}}>
{ci.combat_type} {ci.count}
</span> </span>
))} ))}
</div> </div>
)}
{quest.note && ( {quest.note && (
<div style={{ fontSize: "10px", color: "#94a3b8", marginTop: "2px", fontStyle: "italic" }}> <div style={{ fontSize: "11px", color: "#4a5568", marginTop: "2px", fontStyle: "italic" }}>
{quest.note} {quest.note}
</div> </div>
)} )}
@ -236,13 +298,12 @@ function QuestRow({ quest, completed, onToggle, indent }: {
); );
} }
function collectAllQuests(sections: import("../types").Section[] | undefined): string[] { function collectAllQuests(sections: import("../types").Section[]): string[] {
if (!sections) return [];
const names: string[] = []; const names: string[] = [];
for (const section of sections) { for (const section of sections) {
for (const item of section.items) { for (const item of section.items) {
if (item.type === "Quest") names.push(item.name); if (item.type === "Quest") names.push(item.name);
else if (item.type === "Group") item.quests.forEach((q: import("../types").QuestItem) => names.push(q.name)); else if (item.type === "Group") item.quests.forEach((q: QuestItem) => names.push(q.name));
} }
} }
return names; return names;

View File

@ -4,19 +4,17 @@ export default function HomeView() {
const { guides, openGuide, profiles, activeProfileId } = useStore(); const { guides, openGuide, profiles, activeProfileId } = useStore();
const activeProfile = profiles.find(p => p.id === activeProfileId); const activeProfile = profiles.find(p => p.id === activeProfileId);
const totalQuests = guides.reduce((s, g) => s + g.total_quests, 0); const totalQuests = guides.reduce((s, g) => s + g.total_quests, 0);
const totalCompleted = guides.reduce((s, g) => s + g.completed_quests, 0); const totalCompleted = guides.reduce((s, g) => s + g.completed_quests, 0);
const globalPct = totalQuests > 0 ? Math.round((totalCompleted / totalQuests) * 100) : 0; const globalPct = totalQuests > 0 ? Math.round((totalCompleted / totalQuests) * 100) : 0;
const completedGuides = guides.filter(g => g.total_quests > 0 && g.completed_quests === g.total_quests); const completedGuides = guides.filter(g => g.total_quests > 0 && g.completed_quests === g.total_quests);
const inProgressGuides = guides.filter(g => g.completed_quests > 0 && g.completed_quests < g.total_quests); const inProgressGuides = guides.filter(g => g.completed_quests > 0 && g.completed_quests < g.total_quests);
return ( return (
<div style={{ flex: 1, overflowY: "auto", padding: "20px 24px", minHeight: 0 }}> <div style={{ flex: 1, overflowY: "auto", padding: "20px 24px", minHeight: 0 }}>
{/* Header */} {/* Header */}
<div style={{ marginBottom: "24px" }}> <div style={{ marginBottom: "20px" }}>
<h1 style={{ fontSize: "18px", fontWeight: 700, color: "#f0c040", marginBottom: "4px" }}> <h1 style={{ fontSize: "20px", fontWeight: 700, color: "#f0c040", marginBottom: "2px" }}>
Tougli Guide Dofus Tougli Guide Dofus
</h1> </h1>
{activeProfile && ( {activeProfile && (
@ -32,7 +30,7 @@ export default function HomeView() {
background: "#161b22", border: "1px solid #2d3748", borderRadius: "10px", background: "#161b22", border: "1px solid #2d3748", borderRadius: "10px",
padding: "16px 20px", marginBottom: "24px", padding: "16px 20px", marginBottom: "24px",
}}> }}>
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: "8px" }}> <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "8px" }}>
<span style={{ fontSize: "13px", color: "#94a3b8" }}>Progression globale</span> <span style={{ fontSize: "13px", color: "#94a3b8" }}>Progression globale</span>
<span style={{ fontSize: "13px", fontWeight: 700, color: "#f0c040" }}> <span style={{ fontSize: "13px", fontWeight: 700, color: "#f0c040" }}>
{totalCompleted} / {totalQuests} quêtes ({globalPct}%) {totalCompleted} / {totalQuests} quêtes ({globalPct}%)
@ -45,7 +43,7 @@ export default function HomeView() {
borderRadius: "3px", transition: "width 0.4s ease", borderRadius: "3px", transition: "width 0.4s ease",
}} /> }} />
</div> </div>
<div style={{ marginTop: "8px", display: "flex", gap: "16px" }}> <div style={{ marginTop: "10px", display: "flex", gap: "20px" }}>
<Stat label="Complétés" value={completedGuides.length} color="#4ade80" /> <Stat label="Complétés" value={completedGuides.length} color="#4ade80" />
<Stat label="En cours" value={inProgressGuides.length} color="#f0c040" /> <Stat label="En cours" value={inProgressGuides.length} color="#f0c040" />
<Stat label="Total" value={guides.length} color="#94a3b8" /> <Stat label="Total" value={guides.length} color="#94a3b8" />
@ -53,12 +51,12 @@ export default function HomeView() {
</div> </div>
)} )}
{/* In progress first */} {/* En cours */}
{inProgressGuides.length > 0 && ( {inProgressGuides.length > 0 && (
<Section title="En cours" guides={inProgressGuides} onOpen={openGuide} /> <Section title="En cours" guides={inProgressGuides} onOpen={openGuide} />
)} )}
{/* All guides grid */} {/* Tous les guides */}
<Section title="Tous les guides" guides={guides} onOpen={openGuide} /> <Section title="Tous les guides" guides={guides} onOpen={openGuide} />
</div> </div>
); );
@ -66,9 +64,9 @@ export default function HomeView() {
function Stat({ label, value, color }: { label: string; value: number; color: string }) { function Stat({ label, value, color }: { label: string; value: number; color: string }) {
return ( return (
<div style={{ display: "flex", flexDirection: "column", gap: "2px" }}> <div>
<span style={{ fontSize: "16px", fontWeight: 700, color }}>{value}</span> <span style={{ fontSize: "16px", fontWeight: 700, color }}>{value}</span>
<span style={{ fontSize: "11px", color: "#4a5568" }}>{label}</span> <span style={{ fontSize: "11px", color: "#4a5568", marginLeft: "4px" }}>{label}</span>
</div> </div>
); );
} }
@ -80,13 +78,15 @@ function Section({ title, guides, onOpen }: {
}) { }) {
return ( return (
<div style={{ marginBottom: "24px" }}> <div style={{ marginBottom: "24px" }}>
<h2 style={{ fontSize: "12px", fontWeight: 600, color: "#4a5568", textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "10px" }}> <h2 style={{
fontSize: "11px", fontWeight: 600, color: "#4a5568",
textTransform: "uppercase", letterSpacing: "0.1em",
marginBottom: "10px", borderBottom: "1px solid #2d3748", paddingBottom: "4px",
}}>
{title} {title}
</h2> </h2>
<div style={{ <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(175px, 1fr))", gap: "8px" }}>
display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))", gap: "8px", {guides.map(g => <GuideCard key={g.gid} guide={g} onOpen={onOpen} />)}
}}>
{guides.map(guide => <GuideCard key={guide.gid} guide={guide} onOpen={onOpen} />)}
</div> </div>
</div> </div>
); );
@ -96,53 +96,64 @@ function GuideCard({ guide, onOpen }: {
guide: import("../types").GuideListItem; guide: import("../types").GuideListItem;
onOpen: (gid: string) => void; onOpen: (gid: string) => void;
}) { }) {
const pct = guide.total_quests > 0 const pct = guide.total_quests > 0 ? Math.round((guide.completed_quests / guide.total_quests) * 100) : 0;
? Math.round((guide.completed_quests / guide.total_quests) * 100)
: 0;
const isDone = pct === 100 && guide.total_quests > 0; const isDone = pct === 100 && guide.total_quests > 0;
const inProgress = guide.completed_quests > 0 && !isDone;
const accentColor = isDone ? "#4ade80" : inProgress ? "#f0c040" : "#4a9eff";
return ( return (
<button <button
onClick={() => onOpen(guide.gid)} onClick={() => onOpen(guide.gid)}
style={{ style={{
background: isDone ? "rgba(74,222,128,0.05)" : "#161b22", background: "#161b22", border: `1px solid ${isDone ? "rgba(74,222,128,0.25)" : "#2d3748"}`,
border: `1px solid ${isDone ? "rgba(74,222,128,0.3)" : "#2d3748"}`,
borderRadius: "8px", padding: "12px 14px", cursor: "pointer", borderRadius: "8px", padding: "12px 14px", cursor: "pointer",
textAlign: "left", transition: "all 0.15s", textAlign: "left", transition: "all 0.15s", position: "relative", overflow: "hidden",
}} }}
onMouseEnter={e => { onMouseEnter={e => {
(e.currentTarget as HTMLElement).style.borderColor = isDone ? "rgba(74,222,128,0.6)" : "#f0c040"; (e.currentTarget as HTMLElement).style.borderColor = accentColor;
(e.currentTarget as HTMLElement).style.background = isDone ? "rgba(74,222,128,0.08)" : "#1a2233"; (e.currentTarget as HTMLElement).style.background = "#1a2233";
}} }}
onMouseLeave={e => { onMouseLeave={e => {
(e.currentTarget as HTMLElement).style.borderColor = isDone ? "rgba(74,222,128,0.3)" : "#2d3748"; (e.currentTarget as HTMLElement).style.borderColor = isDone ? "rgba(74,222,128,0.25)" : "#2d3748";
(e.currentTarget as HTMLElement).style.background = isDone ? "rgba(74,222,128,0.05)" : "#161b22"; (e.currentTarget as HTMLElement).style.background = "#161b22";
}} }}
> >
{/* Indicateur latéral */}
<div style={{
position: "absolute", left: 0, top: 0, bottom: 0, width: "3px",
background: accentColor, opacity: isDone ? 1 : inProgress ? 0.8 : 0.3,
borderRadius: "8px 0 0 8px",
}} />
<div style={{ paddingLeft: "4px" }}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: "8px" }}> <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: "8px" }}>
<span style={{ <span style={{
fontSize: "12px", fontWeight: 600, color: isDone ? "#4ade80" : "#e2e8f0", fontSize: "12px", fontWeight: 600, lineHeight: 1.3,
lineHeight: 1.3, color: isDone ? "#4ade80" : "#e2e8f0",
}}> }}>
{guide.name} {guide.name}
</span> </span>
{isDone && <span style={{ fontSize: "14px" }}></span>} {isDone && <span style={{ fontSize: "12px", flexShrink: 0 }}></span>}
</div> </div>
<div style={{ height: "3px", background: "#2d3748", borderRadius: "2px", overflow: "hidden", marginBottom: "6px" }}> <div style={{ height: "3px", background: "#2d3748", borderRadius: "2px", overflow: "hidden", marginBottom: "6px" }}>
<div style={{ <div style={{
height: "100%", width: `${pct}%`, height: "100%", width: `${pct}%`,
background: isDone ? "#4ade80" : pct > 60 ? "#f0c040" : "#4a9eff", background: accentColor,
borderRadius: "2px", borderRadius: "2px", transition: "width 0.3s ease",
}} /> }} />
</div> </div>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
<span style={{ fontSize: "10px", color: "#4a5568" }}> <span style={{ fontSize: "10px", color: "#4a5568" }}>
{guide.completed_quests}/{guide.total_quests} quêtes {guide.completed_quests}/{guide.total_quests} quêtes
</span> </span>
<span style={{ fontSize: "10px", fontWeight: 700, color: isDone ? "#4ade80" : "#94a3b8" }}> <span style={{ fontSize: "10px", fontWeight: 700, color: accentColor }}>
{pct}% {pct}%
</span> </span>
</div> </div>
</div>
</button> </button>
); );
} }

View File

@ -4,6 +4,7 @@ import { useStore } from "../store";
export default function Sidebar() { export default function Sidebar() {
const { guides, openGuide, activeGuideGid, view } = useStore(); const { guides, openGuide, activeGuideGid, view } = useStore();
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [collapsed, setCollapsed] = useState(false);
const filtered = guides.filter(g => const filtered = guides.filter(g =>
g.name.toLowerCase().includes(search.toLowerCase()) g.name.toLowerCase().includes(search.toLowerCase())
@ -11,10 +12,45 @@ export default function Sidebar() {
return ( return (
<aside style={{ <aside style={{
width: "220px", flexShrink: 0, width: collapsed ? "32px" : "220px",
background: "#161b22", borderRight: "1px solid #2d3748", flexShrink: 0,
display: "flex", flexDirection: "column", overflow: "hidden", background: "#161b22",
borderRight: "1px solid #2d3748",
display: "flex",
flexDirection: "column",
overflow: "hidden",
transition: "width 0.2s ease",
}}> }}>
{/* Toggle button */}
<button
onClick={() => setCollapsed(c => !c)}
title={collapsed ? "Ouvrir le menu" : "Réduire le menu"}
style={{
width: "100%", height: "36px", flexShrink: 0,
background: "transparent", border: "none",
borderBottom: "1px solid #2d3748",
color: "#4a5568", cursor: "pointer",
display: "flex", alignItems: "center",
justifyContent: collapsed ? "center" : "flex-end",
padding: "0 10px",
transition: "all 0.15s",
}}
onMouseEnter={e => (e.currentTarget.style.color = "#f0c040")}
onMouseLeave={e => (e.currentTarget.style.color = "#4a5568")}
>
<span style={{
fontSize: "12px",
transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
transition: "transform 0.2s ease",
display: "inline-block",
}}>
</span>
</button>
{!collapsed && (
<>
{/* Search */}
<div style={{ padding: "10px 12px", borderBottom: "1px solid #2d3748" }}> <div style={{ padding: "10px 12px", borderBottom: "1px solid #2d3748" }}>
<input <input
value={search} value={search}
@ -30,6 +66,7 @@ export default function Sidebar() {
/> />
</div> </div>
{/* Guide list */}
<div style={{ flex: 1, overflowY: "auto", padding: "8px 0", scrollbarWidth: "none" }}> <div style={{ flex: 1, overflowY: "auto", padding: "8px 0", scrollbarWidth: "none" }}>
{filtered.length === 0 ? ( {filtered.length === 0 ? (
<div style={{ padding: "16px 12px", color: "#4a5568", fontSize: "12px", textAlign: "center" }}> <div style={{ padding: "16px 12px", color: "#4a5568", fontSize: "12px", textAlign: "center" }}>
@ -47,7 +84,8 @@ export default function Sidebar() {
key={guide.gid} key={guide.gid}
onClick={() => openGuide(guide.gid)} onClick={() => openGuide(guide.gid)}
style={{ style={{
width: "100%", textAlign: "left", background: isActive ? "rgba(240,192,64,0.08)" : "transparent", width: "100%", textAlign: "left",
background: isActive ? "rgba(240,192,64,0.08)" : "transparent",
border: "none", borderLeft: isActive ? "2px solid #f0c040" : "2px solid transparent", border: "none", borderLeft: isActive ? "2px solid #f0c040" : "2px solid transparent",
padding: "8px 12px", cursor: "pointer", transition: "all 0.12s", padding: "8px 12px", cursor: "pointer", transition: "all 0.12s",
}} }}
@ -89,6 +127,8 @@ export default function Sidebar() {
}) })
)} )}
</div> </div>
</>
)}
</aside> </aside>
); );
} }