refactor(app): split the crop group hook, closed reason in drawing refusals
This commit is contained in:
1 parent
1bbf97e65b
commit
7ea9619aa0
3 files changed
+82
-25
No files matched your search
@@ -1,10 +1,21 @@
|
||||
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
|
||||
import type { Locale } from '@/i18n/types'
|
||||
import { rejectionReason } from './drawingReason'
|
||||
import { elementLabel } from './sheetDocument'
|
||||
import type { GeometryRefusal } from './issues'
|
||||
|
||||
type Translate = (key: string) => string
|
||||
|
||||
function drawingRejectedMessage(t: Translate, detail: string | null): string {
|
||||
const reason = rejectionReason(detail)
|
||||
if (reason === 'not_canonical')
|
||||
return t('editor.upload.err.svg_not_canonical')
|
||||
return t('editor.upload.err.svg_rejected').replace(
|
||||
'{reason}',
|
||||
t(`editor.upload.reason.${reason}`),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The words for a frame change the geometry check refused: the annotations (or views)
|
||||
* the change would break, by name. Nothing here re-judges the geometry.
|
||||
@@ -20,7 +31,7 @@ export function frameRefusalMessage(
|
||||
.map((id) => (doc ? elementLabel(doc, { kind, id }, locale) : id))
|
||||
.join(', ')
|
||||
if (refusal.reason === 'drawing_rejected') {
|
||||
return t('editor.upload.err.svg_not_canonical')
|
||||
return drawingRejectedMessage(t, refusal.drawingDetail ?? null)
|
||||
}
|
||||
if (refusal.reason === 'view_unmeasured') {
|
||||
return t('editor.views.frame.view_unmeasured').replace(
|
||||
|
||||
Reference in new issue
Block a user