import Markdown from 'react-markdown' import { formatMm } from 'shared/utils.mjs' import { Tab, Tabs } from '../mdx/tabs.mjs' export const Error = ({ err }) => { // Include the error name and message info if it isn't already at the top // of the error stack. let stack = err.stack if (!err.stack.startsWith(err.toString())) { stack = err.toString() + '\n' + err.stack } return (
      {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}

{logs.map((log, i) => ( ))}
# Message
{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) => ( ))}
) export const DraftLogs = (props) => { return ( `Draft logs [set ${i}]`), 'Pattern Logs', ].join(',')} > {[...props.draft.setStores, props.draft.store].map((store, i) => ( ))} ) } export default DraftLogs