MCPcopy Create free account
hub / github.com/pacexy/flow / AnnotationBlock

Function AnnotationBlock

apps/reader/src/components/viewlets/AnnotationView.tsx:113–159  ·  view source on GitHub ↗
({ annotations })

Source from the content-addressed store, hash-verified

111 annotations: Annotation[]
112}
113const AnnotationBlock: React.FC<AnnotationBlockProps> = ({ annotations }) => {
114 const [expanded, toggle] = useBoolean(true)
115
116 return (
117 <div>
118 <Row
119 depth={1}
120 badge
121 expanded={expanded}
122 toggle={toggle}
123 subitems={annotations}
124 >
125 {annotations[0]?.spine.title}
126 </Row>
127
128 {expanded && (
129 <div>
130 {annotations.map((a) => (
131 <Fragment key={a.id}>
132 <Row
133 depth={2}
134 onClick={() => {
135 reader.focusedBookTab?.display(a.cfi)
136 }}
137 onDelete={() => {
138 reader.focusedBookTab?.removeAnnotation(a.cfi)
139 }}
140 >
141 {a.text}
142 </Row>
143 {a.notes && (
144 <Row
145 depth={3}
146 onClick={() => {
147 reader.focusedBookTab?.display(a.cfi)
148 }}
149 >
150 <span className="text-outline">{a.notes}</span>
151 </Row>
152 )}
153 </Fragment>
154 ))}
155 </div>
156 )}
157 </div>
158 )
159}

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
removeAnnotationMethod · 0.80
displayMethod · 0.45

Tested by

no test coverage detected