Remove recursive topic removal limit

This commit is contained in:
Thomas Nordquist
2019-07-23 00:36:15 +02:00
parent 6781170b85
commit 39d87d5a8e
4 changed files with 25 additions and 37 deletions

View File

@@ -13,25 +13,23 @@ export const RecursiveTopicDeleteButton = (props: {
if (props.node) {
event.stopPropagation()
event.preventDefault()
props.deleteTopicAction(props.node, true, deleteLimit)
props.deleteTopicAction(props.node, true, Infinity)
}
},
[props.node]
)
if (!props.node) {
return null
}
const deleteLimit = 50
const topicCount = props.node ? props.node.childTopicCount() : 0
if (topicCount === 0 || (props.node.message && topicCount === 1)) {
return null
}
return (
<Badge
badgeContent={<span style={{ whiteSpace: 'nowrap' }}>{topicCount >= deleteLimit ? '50+' : topicCount}</span>}
color="secondary"
>
<CustomIconButton onClick={onClick} tooltip={`Deletes up to ${deleteLimit} sub-topics with a single click`}>
<Badge badgeContent={<span style={{ whiteSpace: 'nowrap' }}>{topicCount}</span>} color="secondary">
<CustomIconButton onClick={onClick} tooltip={`Deletes ${topicCount} sub-topics with a single click`}>
<Delete color="action" />
</CustomIconButton>
</Badge>

View File

@@ -14,12 +14,12 @@ const TopicPanel = (props: { node?: q.TreeNode<any>; actions: typeof sidebarActi
console.log(node && node.path())
const copyTopic = node ? <Copy value={node.path()} /> : null
const deleteTopic = useCallback((topic?: q.TreeNode<any>, recursive: boolean = false, maxCount = 50) => {
const deleteTopic = useCallback((topic?: q.TreeNode<any>, recursive: boolean = false) => {
if (!topic) {
return
}
props.actions.clearTopic(topic, recursive, maxCount)
props.actions.clearTopic(topic, recursive)
}, [])
return useMemo(