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"
|
2020-10-15 16:57:43 +02:00
|
|
|
import mutator from "../mutator"
|
2020-10-15 19:46:32 +02:00
|
|
|
import Menu from "../widgets/menu"
|
|
|
|
import CardDetail from "./cardDetail"
|
2020-10-18 19:35:09 -07:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-10-15 19:46:32 +02:00
|
|
|
class CardDialog extends React.Component<Props> {
|
2020-10-08 09:21:27 -07:00
|
|
|
render() {
|
2020-10-15 19:46:32 +02:00
|
|
|
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")
|
2020-10-15 19:46:32 +02:00
|
|
|
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} />
|
2020-10-15 19:46:32 +02:00
|
|
|
</Dialog>
|
|
|
|
)
|
2020-10-08 09:21:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { CardDialog }
|