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 renderFields from './render_block_fields.js'
|
||||||
import renderInputs from './render_block_inputs.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 : "",
|
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 => {
|
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 => {
|
renderExamples = definition => {
|
||||||
return "Coming soon..."
|
return ""
|
||||||
|
|
||||||
|
// TODO: re-enable conditionally when we have examples
|
||||||
|
// return `
|
||||||
|
// ## Examples
|
||||||
|
// Coming soon...
|
||||||
|
// `
|
||||||
}
|
}
|
||||||
|
|
||||||
export default definition =>
|
export default definition =>
|
||||||
|
|
@ -44,15 +74,11 @@ ${ renderDescription(definition) }
|
||||||
|
|
||||||
${ renderIOPlusAlert(definition) }
|
${ renderIOPlusAlert(definition) }
|
||||||
|
|
||||||
## Fields
|
${ renderFieldsSection(definition) }
|
||||||
${ renderFields(definition) }
|
|
||||||
|
|
||||||
## Inputs
|
${ renderInputsSection(definition) }
|
||||||
${ renderInputs(definition) }
|
|
||||||
|
|
||||||
## Output
|
|
||||||
${ renderOutput(definition) }
|
${ renderOutput(definition) }
|
||||||
|
|
||||||
## Examples
|
|
||||||
${ renderExamples(definition) }
|
${ renderExamples(definition) }
|
||||||
`
|
`
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const
|
||||||
return newField
|
return newField
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if(!fields.length) { return "This block has no form fields." }
|
if(!fields.length) { return }
|
||||||
|
|
||||||
return fields.map(renderField).join("\n\n")
|
return fields.map(renderField).join("\n\n")
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@ const
|
||||||
return renderOverridenInputs(definition)
|
return renderOverridenInputs(definition)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keys(definition.inputs).length) {
|
if(!keys(definition.inputs).length) { return }
|
||||||
return "This block has no inputs"
|
|
||||||
}
|
|
||||||
|
|
||||||
return renderEachInput(definition)
|
return renderEachInput(definition)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue