@prenta/admin 1.17.6 → 1.17.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,11 @@ export interface MediaSeoAuditItem {
24
24
  title?: string
25
25
  description?: string
26
26
  seoScore?: number
27
+ /**
28
+ * Derived server-side. `low-quality-alt` is an advisory that does not
29
+ * change `seoScore` (#715).
30
+ */
31
+ seoIssues?: Array<{ type: string }>
27
32
  }
28
33
 
29
34
  export interface MediaSeoAuditProps {
@@ -35,15 +40,21 @@ export interface MediaSeoAuditProps {
35
40
  onRetry?: () => void
36
41
  }
37
42
 
38
- type AuditFilter = 'all' | 'alt' | 'title' | 'poor'
43
+ type AuditFilter = 'all' | 'alt' | 'quality' | 'title' | 'poor'
39
44
 
40
45
  const FILTERS: Array<[AuditFilter, string]> = [
41
46
  ['all', 'All items'],
42
47
  ['alt', 'Missing Alt'],
48
+ ['quality', 'Low-quality alt'],
43
49
  ['title', 'Missing Title'],
44
50
  ['poor', 'Poor score'],
45
51
  ]
46
52
 
53
+ /** Topic-label or filename-stem alt. Advisory only — the score is unchanged. */
54
+ export function hasLowQualityAlt(item: { seoIssues?: Array<{ type: string }> }): boolean {
55
+ return item.seoIssues?.some((issue) => issue.type === 'low-quality-alt') === true
56
+ }
57
+
47
58
  const hasValue = (value?: string): boolean => Boolean(value?.trim())
48
59
 
49
60
  const hasAccessibleAlt = (item: MediaSeoAuditItem): boolean =>
@@ -107,7 +118,24 @@ function ScoreBar({ score }: { score: number }) {
107
118
  )
108
119
  }
109
120
 
110
- function SeoCheck({ set, missTone }: { set: boolean; missTone: 'err' | 'warn' }) {
121
+ function SeoCheck({
122
+ set,
123
+ missTone,
124
+ review = false,
125
+ }: {
126
+ set: boolean
127
+ missTone: 'err' | 'warn'
128
+ /** Present alt that still needs a human look (low-quality-alt). */
129
+ review?: boolean
130
+ }) {
131
+ if (review) {
132
+ return (
133
+ <span className="inline-flex items-center gap-[3px] rounded-[4px] bg-[var(--warn-l)] px-[7px] py-[2px] text-[11px] font-medium text-[var(--warn)]">
134
+ <TriangleAlert size={10} aria-hidden />
135
+ Review
136
+ </span>
137
+ )
138
+ }
111
139
  if (set) {
112
140
  return (
113
141
  <span className="inline-flex items-center gap-[3px] rounded-[4px] bg-[var(--suc-l)] px-[7px] py-[2px] text-[11px] font-medium text-[var(--suc)]">
@@ -174,6 +202,8 @@ export function MediaSeoAudit({ items, onEdit, error, onRetry }: MediaSeoAuditPr
174
202
  return items
175
203
  case 'alt':
176
204
  return items.filter((it) => !hasAccessibleAlt(it))
205
+ case 'quality':
206
+ return items.filter((it) => hasLowQualityAlt(it))
177
207
  case 'title':
178
208
  return items.filter((it) => !hasValue(it.title))
179
209
  case 'poor':
@@ -329,7 +359,11 @@ export function MediaSeoAudit({ items, onEdit, error, onRetry }: MediaSeoAuditPr
329
359
  </span>
330
360
  </td>
331
361
  <td className="px-3 py-[9px] align-middle">
332
- <SeoCheck set={hasAccessibleAlt(item)} missTone="err" />
362
+ <SeoCheck
363
+ set={hasAccessibleAlt(item)}
364
+ missTone="err"
365
+ review={hasLowQualityAlt(item)}
366
+ />
333
367
  </td>
334
368
  <td className="px-3 py-[9px] align-middle">
335
369
  <SeoCheck set={hasValue(item.title)} missTone="warn" />