2022-09-17 10:30:21 +02:00
|
|
|
import DefaultErrorView from 'shared/components/error/view'
|
2022-01-28 16:57:07 +01:00
|
|
|
|
2022-09-17 10:30:21 +02:00
|
|
|
const Error = ({ logs=[], updateGist }) => {
|
|
|
|
let errors = 0
|
|
|
|
let warnings = 0
|
|
|
|
for (const log of logs) {
|
|
|
|
errors += log.errors.length
|
|
|
|
warnings += log.warnings.length
|
|
|
|
}
|
|
|
|
|
|
|
|
const inspectChildren = (
|
|
|
|
<ul className="list-disc list-inside ml-4 text-xl">
|
2022-07-14 07:08:41 -05:00
|
|
|
<li>
|
2022-09-17 10:30:21 +02:00
|
|
|
Check the{' '}
|
|
|
|
<button className="btn-link" onClick={() => updateGist(['_state', 'view'], 'logs')}>
|
|
|
|
<strong>{errors.length} errors</strong> and <strong>{warnings.length} warnings</strong>
|
|
|
|
</button>
|
2022-07-14 07:08:41 -05:00
|
|
|
</li>
|
|
|
|
<li>Check the partially rendered pattern below to see which areas are problematic</li>
|
2022-09-17 10:30:21 +02:00
|
|
|
</ul>
|
|
|
|
)
|
2022-03-24 10:53:57 +01:00
|
|
|
|
2022-09-17 10:30:21 +02:00
|
|
|
return (
|
|
|
|
<DefaultErrorView inspectChildren={inspectChildren}>
|
|
|
|
<p>No need to be alarmed, but we ran into some trouble while drafting this pattern.</p>
|
|
|
|
</DefaultErrorView>
|
|
|
|
)
|
2022-02-08 20:49:19 +01:00
|
|
|
}
|
|
|
|
|
2022-01-28 16:57:07 +01:00
|
|
|
export default Error
|