feat: open card after duplicate (#674)

Co-authored-by: arvinWahyoo <arvin@wahyoo.com>
This commit is contained in:
Arvin 2021-07-06 15:00:25 +07:00 committed by GitHub
parent 766668ea82
commit 7d1a4f1393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View file

@ -155,6 +155,7 @@ class CenterPanel extends React.Component<Props, State> {
readonly={this.props.readonly}
onCardClicked={this.cardClicked}
addCard={this.addCard}
showCard={this.showCard}
/>}
{activeView.viewType === 'table' &&

View file

@ -25,6 +25,7 @@ type Props = {
readonly: boolean
onCardClicked: (e: React.MouseEvent, card: Card) => void
addCard: (groupByOptionId?: string, show?:boolean) => Promise<void>
showCard: (cardId?: string) => void
}
type State = {
@ -130,6 +131,7 @@ class Kanban extends React.Component<Props, State> {
this.props.onCardClicked(e, card)
}}
onDrop={this.onDropToCard}
showCard={this.props.showCard}
isManualSort={isManualSort}
/>
))}

View file

@ -24,6 +24,7 @@ type Props = {
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
readonly: boolean
onDrop: (srcCard: Card, dstCard: Card) => void
showCard: (cardId?: string) => void
isManualSort: boolean
}
@ -63,7 +64,17 @@ const KanbanCard = React.memo((props: Props) => {
id='duplicate'
name={intl.formatMessage({id: 'KanbanCard.duplicate', defaultMessage: 'Duplicate'})}
onClick={() => {
mutator.duplicateCard(card.id)
mutator.duplicateCard(
card.id,
'duplicate card',
false,
async (newCardId) => {
props.showCard(newCardId)
},
async () => {
props.showCard(undefined)
},
)
}}
/>
</Menu>