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} readonly={this.props.readonly}
onCardClicked={this.cardClicked} onCardClicked={this.cardClicked}
addCard={this.addCard} addCard={this.addCard}
showCard={this.showCard}
/>} />}
{activeView.viewType === 'table' && {activeView.viewType === 'table' &&

View file

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

View file

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