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
@@ -36,6 +36,7 @@ import type { ExportWarning } from '@faunosteo/pdf'
|
||||
import type { RebaseOutcome } from '@faunosteo/core-wasm/types'
|
||||
import { useT } from '@/i18n/useT'
|
||||
import { DEFAULT_SPECIES_ID } from './NewReportRoute'
|
||||
import { coreFailureMessage } from '@/core/failure'
|
||||
|
||||
const DISCLAIMER_FLAG = 'osteo:disclaimer-shown'
|
||||
|
||||
@@ -161,7 +162,7 @@ export default function EditorRoute() {
|
||||
const activeObs =
|
||||
activeIndex >= 0 ? report.observations[activeIndex] : undefined
|
||||
const outcome = sheet.index.ops.zoneClick(activeObs ?? null, annotationId)
|
||||
if (!outcome.ok) return window.alert(t('core.action_failed'))
|
||||
if (!outcome.ok) return window.alert(coreFailureMessage(t))
|
||||
const click = outcome.value
|
||||
if (click.observation) store.updateObservation(activeIndex, click.observation)
|
||||
switch (click.kind) {
|
||||
@@ -189,7 +190,7 @@ export default function EditorRoute() {
|
||||
/** A store action the core ran: the practitioner hears about a failure. */
|
||||
const guarded = useCallback(
|
||||
(result: ActionResult) => {
|
||||
if (!result.ok) window.alert(t('core.action_failed'))
|
||||
if (!result.ok) window.alert(coreFailureMessage(t))
|
||||
},
|
||||
[t],
|
||||
)
|
||||
@@ -198,7 +199,7 @@ export default function EditorRoute() {
|
||||
function openVertebraPicker(index: SheetIndex, zoneIndex: number) {
|
||||
if (!activeObs) return
|
||||
const outcome = index.ops.vertebraInitial(activeObs, zoneIndex)
|
||||
if (!outcome.ok) return window.alert(t('core.action_failed'))
|
||||
if (!outcome.ok) return window.alert(coreFailureMessage(t))
|
||||
setVertebraTarget({ zoneIndex, initial: outcome.value })
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ export default function EditorRoute() {
|
||||
if (!obs) return
|
||||
const outcome = index.ops.removeZoneAt(obs, zoneIndex)
|
||||
if (outcome.ok) store.updateObservation(i, outcome.value)
|
||||
else window.alert(t('core.action_failed'))
|
||||
else window.alert(coreFailureMessage(t))
|
||||
}
|
||||
|
||||
function acknowledgeDisclaimer() {
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import { useReportStore } from '@/state/reportStore'
|
||||
import { loadSheetIndex, useSheetAvailability } from '@/sheets/useSheet'
|
||||
import { useT } from '@/i18n/useT'
|
||||
import { coreFailureMessage } from '@/core/failure'
|
||||
|
||||
/** The one species this build ships a sheet for. */
|
||||
export const DEFAULT_SPECIES_ID = 'equine'
|
||||
@@ -71,7 +72,7 @@ export default function NewReportRoute() {
|
||||
else if (created.reason === 'held') {
|
||||
window.alert(t('session.held_blocked'))
|
||||
navigate('/editor')
|
||||
} else window.alert(t('core.action_failed'))
|
||||
} else window.alert(coreFailureMessage(t))
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user