MCPcopy Create free account
hub / github.com/emwalker/digraph / ViewTopicPage

Function ViewTopicPage

client/src/components/TopicPage/ViewTopicPage/index.tsx:190–240  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

188}
189
190export default function ViewTopicPage(props: Props) {
191 const topic = useFragment(topicFragment, props.topic)
192 const viewer = useFragment(viewerFragment, props.viewer)
193 const children = liftNodes(topic.children)
194 const parentTopics = liftNodes(topic.displayParentTopics)
195 const renderHeadingDetail = useCallback(() => headingDetail(topic), [headingDetail, topic])
196
197 const canEdit = topic.viewerCanUpdate
198
199 return (
200 <Page>
201 <Subhead
202 heading={topic.displayName}
203 renderHeadingDetail={renderHeadingDetail}
204 />
205 <Columns>
206 <RightColumn>
207 <SidebarList
208 items={parentTopics}
209 placeholder="There are no parent topics for this topic."
210 title="Parent topics"
211 />
212 {renderTopicViews(topic)}
213 {canEdit
214 ? <AddForm parentTopic={topic} viewer={viewer} />
215 : renderNotification()}
216 </RightColumn>
217 <LeftColumn>
218 <List
219 placeholder="There are no items in this list."
220 hasItems={!isEmpty(children)}
221 >
222 {children.filter(Boolean).map((child) => {
223 const key = (child?.__typename == 'Link' || child?.__typename == 'Topic')
224 ? child.id
225 : 'client:topicChildren:0'
226
227 return (
228 <TopicChild
229 key={key}
230 child={child}
231 viewer={viewer}
232 />
233 )
234 })}
235 </List>
236 </LeftColumn>
237 </Columns>
238 </Page>
239 )
240}

Callers

nothing calls this directly

Calls 4

liftNodesFunction · 0.90
headingDetailFunction · 0.85
renderTopicViewsFunction · 0.85
renderNotificationFunction · 0.85

Tested by

no test coverage detected