Skip to content

Commit

Permalink
refactor (heart): new code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Oct 18, 2023
1 parent c1b7a74 commit e6a1dab
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions health/heart/integrated/blockly-oid-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ toolbox: {
{
'kind': 'block',
'type': 'heart_image'
},
}
],
'colour': 300
},
{
'kind': 'category',
'name': 'Atividade Elétrica',
'contents': [
{
'kind': 'block',
'type': 'sequence'
}
],
'colour': 300
colour: 250
}
]
},
Expand Down Expand Up @@ -80,8 +87,8 @@ blocks:
'type': 'field_dropdown',
'name': 'entity',
'options': [
[{src: 'images/heart1.svg', width: 100, height: 100, alt: 'heart 1'}, 'heart1'],
[{src: 'images/heart2.svg', width: 100, height: 100, alt: 'heart 2'}, 'heart2']
[{src: 'assets/images/heart1.svg', width: 100, height: 100, alt: 'heart 1'}, 'heart1'],
[{src: 'assets/images/heart2.svg', width: 100, height: 100, alt: 'heart 2'}, 'heart2']
]
}
],
Expand Down Expand Up @@ -114,16 +121,17 @@ generator: {
const state = block.getFieldValue('state')
const rhythm = block.getFieldValue('rhythm')
const healthy = block.getFieldValue('healthy')
return `// heart ${state} ${rhythm} ${healthy}`
const image = generator.statementToCode(block, 'image')
return `heart ${state} ${rhythm} ${healthy} attached ${image}`
},

'heart_image': function (block, generator) {
const entity = block.getFieldValue('entity')
return `// heart image ${entity}`
return `heart image ${entity}`
},

'sequence': function (block, generator) {
return `// sequence`
return `sequence`
}
}

Expand Down

0 comments on commit e6a1dab

Please sign in to comment.