import { useEffect, useMemo } from "react";
import Head from "next/head";
import ReaderNav from "../../components/reader/ReaderNav";
import ReaderCrumbs from "../../components/reader/ReaderCrumbs";
import ReaderFooter from "../../components/reader/ReaderFooter";
import WorkflowBlock from "../../components/reader/WorkflowBlock";
import ChapterOutline from "../../components/reader/ChapterOutline";
import WorkflowRail from "../../components/reader/WorkflowRail";
import ChapterKit from "../../components/reader/ChapterKit";
import useActivation from "../../components/reader/useActivation";
import { CHAPTER, RECIPES, buildOutline } from "../../data/sample-chapter";
const RECIPE_IDS = RECIPES.map((r) => r.id);
const ESSAY_KEYS = ["stakes", "constraints", "practice"];
function Essay({ id, heading, paragraphs }) {
return (
{heading}
{paragraphs.map((p) => (
{p}
))}
);
}
export default function RealEstateChapter() {
const { complete, toggle, count, total } = useActivation(RECIPE_IDS);
const [first, second] = RECIPES;
const outline = useMemo(() => buildOutline(CHAPTER, RECIPES), []);
const essayGroup = outline.find((g) => g.label === "Essay");
const workflowGroup = outline.find((g) => g.label === "Workflows");
useEffect(() => {
const hash = window.location.hash;
if (!hash) return;
const el = document.getElementById(hash.slice(1));
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
}, []);
return (
<>
{CHAPTER.title} · AIBook.fun reading demo
Reading demo · not the live book
{CHAPTER.vertical} · {CHAPTER.edition} edition
{CHAPTER.title}
{CHAPTER.authors}
{CHAPTER.promise}
{ESSAY_KEYS.map((key) => (
))}
Workflow 1 of {RECIPES.length} in this chapter
Workflow 2 of {RECIPES.length} in this chapter
Further workflows in this vertical
{CHAPTER.further.map((item) => (
-
{item.coming ? (
<>
{item.id}
{" "}
{item.title}
>
) : (
<>
{item.id}
{" "}
{item.title}
>
)}
))}
Sources
{CHAPTER.sources.map((s) => (
- {s}
))}
Last updated: {CHAPTER.lastUpdated}
>
);
}