import Markdown from 'react-markdown'
import { formatMm } from 'shared/utils'
const Error = ({err}) => (
{err.toString()}
)
// Markdown wrapper to suppress creation of P tags
const Md = ({ children }) => props.children }}>{children}
const Event = ({ evt, units }) => {
if (Array.isArray(evt)) {
if (evt[1]?.mm) return ${formatMm(evt[1].mm, units, 'html')}`
}}/>
else return evt.map(e => )
}
else if (evt.message) return
else if (typeof evt === 'string') return {evt}
return Note a recognized event: {JSON.stringify(evt, null ,2)}
}
const EventGroup = ({ type='info', events=[], units='metric' }) => events.length > 0 ? (
{type}
# |
Message |
{events.map((evt, i) => (
{i} |
|
))}
) : null
const order = [
'error',
'warning',
'info',
'debug'
]
const Events = props => props?.draft?.events
? (
{order.map(type => (props.draft.events[type].length > 0)
? (
-
{type}
{type === 'debug' ? '' : |}
) : (
-
{type}
{type === 'debug' ? '' : |}
)
)}
{order.map(type =>
)}
) : null
export default Events