focalboard/webapp/src/components/cardDialog.tsx

34 lines
896 B
TypeScript
Raw Normal View History

2020-10-08 09:21:27 -07:00
import React from "react"
2020-10-15 12:22:38 -07:00
import { Card } from "../blocks/card"
2020-10-08 09:21:27 -07:00
import { BoardTree } from "../boardTree"
import mutator from "../mutator"
import Menu from "../widgets/menu"
import CardDetail from "./cardDetail"
import Dialog from "./dialog"
2020-10-08 09:21:27 -07:00
type Props = {
boardTree: BoardTree
2020-10-15 22:43:16 +02:00
card: Card
2020-10-08 09:21:27 -07:00
onClose: () => void
}
class CardDialog extends React.Component<Props> {
2020-10-08 09:21:27 -07:00
render() {
const menu = (
<Menu>
<Menu.Text id="delete" name="Delete" onClick={async () => {
2020-10-15 22:43:16 +02:00
await mutator.deleteBlock(this.props.card, "delete card")
this.props.onClose()
}}/>
</Menu>
)
return (
<Dialog onClose={this.props.onClose} toolsMenu={menu}>
2020-10-15 22:43:16 +02:00
<CardDetail boardTree={this.props.boardTree} card={this.props.card} />
</Dialog>
)
2020-10-08 09:21:27 -07:00
}
}
export { CardDialog }