feat(editor): a clear final state once the engine spent its three recoveries (canvas and action alerts)
This commit is contained in:
1 parent
f0580922b5
commit
0279953e9e
19 files changed
+101
-16
No files matched your search
@@ -17,6 +17,13 @@ export interface AnatomyCanvasProps {
|
||||
|
||||
const ANNOTATED = '[data-anno-id]'
|
||||
|
||||
/** Only an engine that can still recover offers a retry. */
|
||||
const FAILURE_MESSAGE: Record<ViewFailure, string> = {
|
||||
engine: 'sheet.core_unavailable',
|
||||
engine_stopped: 'core.stopped',
|
||||
view: 'canvas.view_unavailable',
|
||||
}
|
||||
|
||||
function annotatedTarget(event: Event): Element | null {
|
||||
const target = event.target
|
||||
return target instanceof Element ? target.closest(ANNOTATED) : null
|
||||
@@ -133,9 +140,7 @@ export default function AnatomyCanvas({
|
||||
{failure && (
|
||||
<div className="absolute inset-0 grid place-items-center p-4">
|
||||
<div className="space-y-3 max-w-sm">
|
||||
<Notice tone="error">
|
||||
{t(failure === 'engine' ? 'sheet.core_unavailable' : 'canvas.view_unavailable')}
|
||||
</Notice>
|
||||
<Notice tone="error">{t(FAILURE_MESSAGE[failure])}</Notice>
|
||||
{failure === 'engine' && (
|
||||
<Button onClick={() => setAttempt((n) => n + 1)}>
|
||||
{t('sheet.core_retry')}
|
||||
|
||||
Reference in new issue
Block a user