diff --git a/src/App.tsx b/src/App.tsx
index 313d258..c82fec8 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,35 +1,29 @@
import { useState } from "react";
-
-const CHAPTERS = [
- { n: "1", title: "The Lighthouse" },
- { n: "2", title: "Salt and Iron" },
- { n: "3", title: "What the Tide Left" },
- { n: "4", title: "Homecoming" },
-];
-
-const BODY = [
- "The lamp had not been lit in thirty years, and yet the islanders still set their clocks by a light that no longer came. Mara climbed the iron stair each evening out of a habit older than memory, and each evening she found the same dark glass waiting, patient as the sea.",
- "Her grandfather had kept the flame. Her mother had let it die. Between those two facts lay the whole of the family's quarrel with the water, and Mara had inherited both the quarrel and the key that opened the lantern room.",
- "She did not light it that night either. She only stood at the gallery rail and counted the boats coming in, the way she had been taught to count them, as though arithmetic alone could keep them safe until morning.",
-];
-
-function Icon({ d }: { d: string }) {
- return (
-
- );
-}
+import { Sidebar } from "./components/Sidebar";
+import { Dock } from "./components/Dock";
+import { Icon } from "./components/Icon";
+import { Editor } from "./editor/Editor";
+import { useBook } from "./store/useBook";
function App() {
- const [active, setActive] = useState("1");
const [dock, setDock] = useState(true);
- const current = CHAPTERS.find((c) => c.n === active)!;
+ const title = useBook((s) => s.book.metadata.title);
+ const author = useBook((s) => s.book.metadata.author);
+ const chapters = useBook((s) => s.book.chapters);
+ const activeChapterId = useBook((s) => s.activeChapterId);
+ const setChapterContent = useBook((s) => s.setChapterContent);
+ const setChapterTitle = useBook((s) => s.setChapterTitle);
+
+ const idx = chapters.findIndex((c) => c.id === activeChapterId);
+ const chapter = chapters[idx];
return (