diff --git a/import/trello/importTrello.ts b/import/trello/importTrello.ts index 60ca4cd97..7157d0f9c 100644 --- a/import/trello/importTrello.ts +++ b/import/trello/importTrello.ts @@ -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' @@ -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('')