diff --git a/app/[doc_id]/page.tsx b/app/[doc_id]/page.tsx
index 809e6e6b..ec1b6795 100644
--- a/app/[doc_id]/page.tsx
+++ b/app/[doc_id]/page.tsx
@@ -1,3 +1,46 @@
+"use client";
+import { ReplicacheProvider, useEntity, useReplicache } from "../../replicache";
+import { TextEditor } from "../../components/TextEditor";
+
export default function DocumentPage(props: { params: { doc_id: string } }) {
- return
doc_id: {props.params.doc_id}
;
+ return (
+
+ doc_id: {props.params.doc_id}
+
+
+ );
+}
+
+function AllFacts(props: { entityID: string }) {
+ let blocks = useEntity(props.entityID, "block/card");
+
+ return (
+
+ {blocks?.map((f) => {
+ let data = f.data as { type: "reference"; value: string };
+ return ;
+ })}
+
+ );
+}
+
+function Block(props: { entityID: string }) {
+ let content = useEntity(props.entityID, "card/content");
+ let children = useEntity(props.entityID, "block/card");
+ let rep = useReplicache();
+ return (
+
+ {
+ await rep.rep?.mutate.assertFact({
+ entity: props.entityID,
+ attribute: "card/content",
+ data: { type: "text", value },
+ });
+ }}
+ />
+ {children?.map((c) => )}
+
+ );
}
diff --git a/backend/index.ts b/backend/index.ts
deleted file mode 100644
index 310c2f10..00000000
--- a/backend/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export default {
- async fetch() {
- return new Response("hello world");
- },
-};
diff --git a/components/TextEditor.tsx b/components/TextEditor.tsx
new file mode 100644
index 00000000..fbd6756e
--- /dev/null
+++ b/components/TextEditor.tsx
@@ -0,0 +1,20 @@
+import { useEffect, useState } from "react";
+
+export function TextEditor(props: {
+ value?: string;
+ onChange: (value: string) => Promise;
+}) {
+ let [intermediateState, setIntermediateState] = useState(props.value);
+ useEffect(() => {
+ setIntermediateState(props.value as string);
+ }, [props.value]);
+ return (
+