feat(SPA): media field type
This commit is contained in:
1 parent
a2d596f4ca
commit
3e7fc9a4a5
57 files changed
+6109
-75
No files matched your search
@@ -6,7 +6,8 @@ import RetryAlert from '@/components/RetryAlert.vue'
|
||||
import type { SaveFailure } from '@/composables/useEntryDraft'
|
||||
import type { BuiltinField } from '@/lib/contentTypes'
|
||||
import type { EntryIssues } from '@/lib/entryForm'
|
||||
import { schemaChangedLine, uniqueAlert } from '@/lib/entryMessages'
|
||||
import { mediaChangedLine, schemaChangedLine, uniqueAlert } from '@/lib/entryMessages'
|
||||
import { fieldTypeSpec } from '@/lib/fieldTypes'
|
||||
|
||||
const props = defineProps<{
|
||||
failure: SaveFailure
|
||||
@@ -22,6 +23,12 @@ defineEmits<{ retry: []; reload: [] }>()
|
||||
const uniqueField = computed(() =>
|
||||
props.fields.find((field) => props.issues[field.key]?.rule === 'unique'),
|
||||
)
|
||||
const changedLine = computed(() => {
|
||||
const changed = props.fields.find((field) => field.key === props.schemaField)
|
||||
return changed && fieldTypeSpec(changed.type).editor.control === 'media'
|
||||
? mediaChangedLine(changed.label)
|
||||
: schemaChangedLine(props.schemaField)
|
||||
})
|
||||
const alertUi = {
|
||||
root: 'items-start gap-2.5 px-3.5 py-3',
|
||||
title: 'font-semibold',
|
||||
@@ -60,7 +67,7 @@ const alertUi = {
|
||||
orientation="vertical"
|
||||
icon="i-lucide-triangle-alert"
|
||||
:title="t('The fields of {0} changed', [typeName])"
|
||||
:description="schemaChangedLine(schemaField)"
|
||||
:description="changedLine"
|
||||
:ui="{ ...alertUi, actions: 'mt-1.5' }"
|
||||
>
|
||||
<template #actions>
|
||||
|
||||
Reference in new issue
Block a user