import Markdown from 'react-markdown'
import { formatMm } from 'shared/utils'
import { Tab, Tabs } from '../mdx/tabs.js'
export const Error = ({ err }) => (
{err.stack
.split(/\n/g)
.slice(0, 5)
.map((l, i) => (
0 ? ' break-all' : '')}
>
{l}
))}
)
// Markdown wrapper to suppress creation of P tags
const Md = ({ children }) => (
props.children }}>{children}
)
const Log = ({ log, units }) => {
if (Array.isArray(log)) {
if (log[1]?.mm)
return (
${formatMm(log[1].mm, units, 'html')}`,
}}
/>
)
else return log.map((l) => )
} else if (log.message) return
else if (typeof log === 'string') return {log}
return Unrecognized log: {JSON.stringify(log, null, 2)}
}
export const LogGroup = ({ type = 'info', logs = [], units = 'metric' }) =>
logs.length > 0 ? (
{type}
# |
Message |
{logs.map((log, i) => (
{i} |
|
))}
) : null
const order = ['error', 'warning', 'info', 'debug']
const StoreLogs = ({ logs, units }) => (
{order.map((type) =>
logs[type].length > 0 ? (
-
{type}
{type === 'debug' ? '' : |}
) : (
-
{type}
{type === 'debug' ? '' : |}
)
)}
{order.map((type) => (
))}
)
const Logs = (props) => {
const renderProps = props.draft.getRenderProps()
return (
`Set ${i}`)].join(',')}>
{[props.draft.store, ...props.draft.setStores].map((store, i) => (
))}
)
}
export default Logs