remove empty and unimplemented sections
This commit is contained in:
parent
03822ca3d0
commit
49cf69b4f4
3 changed files with 37 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { capitalize, trim } from 'lodash-es'
|
||||
import { trim } from 'lodash-es'
|
||||
|
||||
import renderFields from './render_block_fields.js'
|
||||
import renderInputs from './render_block_inputs.js'
|
||||
|
|
@ -21,12 +21,42 @@ This Block requires an IO+ subscription to use. [Learn more about IO+](https://i
|
|||
|
||||
renderIOPlusAlert = ({ ioPlus }) => ioPlus ? IO_PLUS_ALERT : "",
|
||||
|
||||
renderFieldsSection = definition => {
|
||||
const fieldsMarkdown = renderFields(definition)
|
||||
|
||||
return fieldsMarkdown
|
||||
? `## Fields\n\n${ fieldsMarkdown }`
|
||||
: ""
|
||||
},
|
||||
|
||||
renderInputsSection = definition => {
|
||||
const inputsMarkdown = renderInputs(definition)
|
||||
|
||||
return inputsMarkdown
|
||||
? `## Inputs\n\n${ inputsMarkdown }`
|
||||
: ""
|
||||
},
|
||||
|
||||
renderOutput = definition => {
|
||||
return capitalize(definition.connections?.output || "Unspecified")
|
||||
return ''
|
||||
|
||||
// TODO: re-enable when we have something meanginful to show the user
|
||||
// const defaultedOutput = capitalize(definition.connections?.output || "Unspecified")
|
||||
|
||||
// return `
|
||||
// ## Output
|
||||
// ${ defaultedOutput }
|
||||
// `
|
||||
},
|
||||
|
||||
renderExamples = definition => {
|
||||
return "Coming soon..."
|
||||
return ""
|
||||
|
||||
// TODO: re-enable conditionally when we have examples
|
||||
// return `
|
||||
// ## Examples
|
||||
// Coming soon...
|
||||
// `
|
||||
}
|
||||
|
||||
export default definition =>
|
||||
|
|
@ -44,15 +74,11 @@ ${ renderDescription(definition) }
|
|||
|
||||
${ renderIOPlusAlert(definition) }
|
||||
|
||||
## Fields
|
||||
${ renderFields(definition) }
|
||||
${ renderFieldsSection(definition) }
|
||||
|
||||
## Inputs
|
||||
${ renderInputs(definition) }
|
||||
${ renderInputsSection(definition) }
|
||||
|
||||
## Output
|
||||
${ renderOutput(definition) }
|
||||
|
||||
## Examples
|
||||
${ renderExamples(definition) }
|
||||
`
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const
|
|||
return newField
|
||||
}))
|
||||
|
||||
if(!fields.length) { return "This block has no form fields." }
|
||||
if(!fields.length) { return }
|
||||
|
||||
return fields.map(renderField).join("\n\n")
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ const
|
|||
return renderOverridenInputs(definition)
|
||||
}
|
||||
|
||||
if(!keys(definition.inputs).length) {
|
||||
return "This block has no inputs"
|
||||
}
|
||||
if(!keys(definition.inputs).length) { return }
|
||||
|
||||
return renderEachInput(definition)
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue