(props: Props)
| 188 | } |
| 189 | |
| 190 | export 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 | } |
nothing calls this directly
no test coverage detected