Files
InkFlow/frontend/src/App.jsx

45 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React, { useState } from "react";
import Library from "./Library.jsx";
import BookView from "./BookView.jsx";
import Settings from "./Settings.jsx";
export default function App() {
// Permet d'ouvrir un livre directement via #slug (deep-link).
const [slug, setSlug] = useState(
() => (location.hash ? decodeURIComponent(location.hash.slice(1)) : null)
);
const [showSettings, setShowSettings] = useState(false);
const goHome = () => { setShowSettings(false); setSlug(null); };
return (
<div className="min-h-screen bg-ink-bg text-ink-text">
<header className="border-b border-ink-edge">
<div className="mx-auto flex max-w-6xl items-center gap-3 px-6 py-4">
<button onClick={goHome} className="flex items-center gap-2">
<span className="text-2xl">🖋</span>
<span className="font-serif text-xl tracking-wide">
Ink<span className="text-ink-accent">Flow</span>
</span>
</button>
<span className="ml-2 hidden text-sm text-ink-muted sm:inline">
EPUB livre audio · local · MLX
</span>
<button onClick={() => setShowSettings(true)} title="Réglages techniques"
className="ml-auto text-xl text-ink-muted hover:text-ink-text"></button>
</div>
</header>
<main className="mx-auto max-w-6xl px-6 py-8">
{showSettings ? (
<Settings onBack={goHome} />
) : slug ? (
<BookView slug={slug} onBack={() => setSlug(null)} />
) : (
<Library onOpen={setSlug} />
)}
</main>
</div>
);
}