Skip to content

Commit

Permalink
Add the ability to import checklists from Trello (#1430)
Browse files Browse the repository at this point in the history
* Add the ability to import checklists from Trello

* Fix various lint and import issues
  • Loading branch information
leosunmo authored Oct 4, 2021
1 parent 58f6b80 commit f51b33d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions import/trello/importTrello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {IPropertyOption, IPropertyTemplate, createBoard} from '../../webapp/src/
import {createBoardView} from '../../webapp/src/blocks/boardView'
import {createCard} from '../../webapp/src/blocks/card'
import {createTextBlock} from '../../webapp/src/blocks/textBlock'
import {createCheckboxBlock} from '../../webapp/src/blocks/checkboxBlock'
import {Trello} from './trello'
import {Utils} from './utils'

Expand Down Expand Up @@ -135,6 +136,29 @@ function convert(input: Trello): Block[] {

outCard.fields.contentOrder = [text.id]
}

// Add Checklists
if (card.idChecklists && card.idChecklists.length > 0) {
card.idChecklists.forEach(checklistID => {
const lookup = input.checklists.find(e => e.id === checklistID)
if (lookup) {
lookup.checkItems.forEach(trelloCheckBox=> {
const checkBlock = createCheckboxBlock()
checkBlock.title = trelloCheckBox.name
if (trelloCheckBox.state === 'complete') {
checkBlock.fields.value = true
} else {
checkBlock.fields.value = false
}
checkBlock.rootId = outCard.rootId
checkBlock.parentId = outCard.id
blocks.push(checkBlock)

outCard.fields.contentOrder.push(checkBlock.id)
})
}
})
}
})

console.log('')
Expand Down

0 comments on commit f51b33d

Please sign in to comment.