a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pass down rootentity in replicache provider

so that we can use it to set theme and stuff away from the top level

+12 -9
+1
app/[doc_id]/Doc.tsx
··· 20 20 }) { 21 21 return ( 22 22 <ReplicacheProvider 23 + rootEntity={props.doc_id} 23 24 token={props.token} 24 25 name={props.doc_id} 25 26 initialFacts={props.initialFacts}
+8 -9
components/Toolbar/HighlightButton.tsx
··· 82 82 }; 83 83 84 84 export const HighlightColorSettings = () => { 85 - let { rep } = useReplicache(); 85 + let { rep, rootEntity } = useReplicache(); 86 86 let params = useParams(); 87 - let docID = params.doc_id as string; 88 87 let set = useMemo(() => { 89 - return setColorAttribute(rep, docID); 90 - }, [rep, docID]); 88 + return setColorAttribute(rep, rootEntity); 89 + }, [rep, rootEntity]); 91 90 92 91 let [openPicker, setOpenPicker] = useState<pickers>("null"); 93 92 94 - let backgroundImage = useEntity(docID, "theme/background-image"); 95 - let backgroundRepeat = useEntity(docID, "theme/background-image-repeat"); 93 + let backgroundImage = useEntity(rootEntity, "theme/background-image"); 94 + let backgroundRepeat = useEntity(rootEntity, "theme/background-image-repeat"); 96 95 97 - let highlight1Value = useColorAttribute(docID, "theme/highlight-1"); 98 - let highlight2Value = useColorAttribute(docID, "theme/highlight-2"); 99 - let highlight3Value = useColorAttribute(docID, "theme/highlight-3"); 96 + let highlight1Value = useColorAttribute(rootEntity, "theme/highlight-1"); 97 + let highlight2Value = useColorAttribute(rootEntity, "theme/highlight-2"); 98 + let highlight3Value = useColorAttribute(rootEntity, "theme/highlight-3"); 100 99 101 100 return ( 102 101 <Popover.Root>
+3
src/replicache/index.tsx
··· 17 17 }; 18 18 19 19 let ReplicacheContext = createContext({ 20 + rootEntity: "" as string, 20 21 rep: null as null | Replicache<ReplicacheMutators>, 21 22 initialFacts: [] as Fact<keyof typeof Attributes>[], 22 23 permission_token: {} as PermissionToken, ··· 41 42 }[]; 42 43 }; 43 44 export function ReplicacheProvider(props: { 45 + rootEntity: string; 44 46 initialFacts: Fact<keyof typeof Attributes>[]; 45 47 token: PermissionToken; 46 48 name: string; ··· 101 103 <ReplicacheContext.Provider 102 104 value={{ 103 105 rep, 106 + rootEntity: props.rootEntity, 104 107 initialFacts: props.initialFacts, 105 108 permission_token: props.token, 106 109 }}