focalboard/webapp/src/components/cardDialog.tsx

48 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-10-20 21:50:53 +02:00
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
2020-10-20 21:52:56 +02:00
import React from 'react'
2020-10-20 21:50:53 +02:00
2020-10-20 21:52:56 +02:00
import {Card} from '../blocks/card'
2020-10-21 03:54:39 +02:00
import {BoardTree} from '../viewModel/boardTree'
2020-10-20 21:52:56 +02:00
import mutator from '../mutator'
import Menu from '../widgets/menu'
2020-10-20 21:50:53 +02:00
2020-10-20 21:52:56 +02:00
import CardDetail from './cardDetail'
import Dialog from './dialog'
2020-10-08 18:21:27 +02:00
type Props = {
2020-10-20 21:50:53 +02:00
boardTree: BoardTree
card: Card
onClose: () => void
2020-10-08 18:21:27 +02:00
}
class CardDialog extends React.Component<Props> {
2020-10-20 21:50:53 +02:00
render() {
const menu = (
<Menu position='left'>
2020-10-20 21:50:53 +02:00
<Menu.Text
id='delete'
name='Delete'
onClick={async () => {
await mutator.deleteBlock(this.props.card, 'delete card')
this.props.onClose()
}}
/>
</Menu>
)
return (
2020-10-20 21:50:53 +02:00
<Dialog
onClose={this.props.onClose}
toolsMenu={menu}
>
<CardDetail
boardTree={this.props.boardTree}
2020-10-21 03:28:55 +02:00
cardId={this.props.card.id}
2020-10-20 21:50:53 +02:00
/>
</Dialog>
)
2020-10-20 21:50:53 +02:00
}
2020-10-08 18:21:27 +02:00
}
2020-10-20 21:50:53 +02:00
export {CardDialog}