@nuxtseo/pro-indexing 0.0.0-stage → 0.1.5

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.
@@ -0,0 +1,320 @@
1
+ <script setup lang="ts">
2
+ import type { IndexingChangesDay } from '../../shared/changes'
3
+ import type { IndexingPortfolioEntry } from '../../shared/portfolio'
4
+ import { indexingVizColors } from '@nuxtseo/design-system/app/composables/dataVizColors'
5
+ import { DISPLAY_LOCALE, formatNumber } from '@nuxtseo/design-system/app/composables/formatting'
6
+ import { useChartTickPlan } from '@nuxtseo/design-system/app/composables/useChartTickPlan'
7
+ import { fillCopy } from '@nuxtseo/pro-shell/shared/copy'
8
+ import { TextAlign } from '@unovis/ts'
9
+ import { VisAxis, VisCrosshair, VisLine, VisStackedBar, VisTooltip, VisXYContainer } from '@unovis/vue'
10
+ import { useElementSize } from '@vueuse/core'
11
+ import { computed, useTemplateRef } from 'vue'
12
+ import { ClientOnly, NuxtLink, UiAlert, UiButton, UiEmptyState, UiFavicon, UiIcon, UiSkeleton, UiTableShell, UiTableTd, UiTableTh, UiTooltip, UiWidgetState } from '#components'
13
+ import { summarizeIndexingChanges } from '../../shared/changes'
14
+ import { hasCoverageObservation, isEntryPending, portfolioFetchState } from '../../shared/portfolio'
15
+ import { useIndexingSource } from '../composables/useIndexingSource'
16
+ import { useProIndexingCopy } from '../composables/useProIndexingCopy'
17
+ import { useProIndexingRoute } from '../composables/useProIndexingRoute'
18
+
19
+ // Portfolio Changes for one Portfolio scope: one roll-up read from the
20
+ // `changesRollup` capability, narrowed to the scope, plus each Site's trend.
21
+ // Without the capability the section does not render.
22
+
23
+ const { entries } = defineProps<{
24
+ entries: readonly IndexingPortfolioEntry[]
25
+ }>()
26
+
27
+ const emit = defineEmits<{ retry: [siteIds: string[]] }>()
28
+
29
+ const copy = useProIndexingCopy()
30
+ const route = useProIndexingRoute()
31
+ const source = useIndexingSource()
32
+ // No default: a failed read must never render as zero.
33
+ const rollupRead = source?.changesRollup?.() ?? null
34
+ const rollup = computed(() => rollupRead?.data.value ?? null)
35
+ const status = computed(() => rollupRead?.status.value ?? 'idle')
36
+ const error = computed(() => rollupRead?.error.value ?? null)
37
+
38
+ const fetchState = computed(() => portfolioFetchState(entries, copy.common))
39
+ const entriesById = computed(() => new Map(entries.map(entry => [entry.site.id, entry])))
40
+ const changes = computed(() => rollup.value
41
+ ? summarizeIndexingChanges(rollup.value, entries.map(entry => ({
42
+ id: entry.site.id,
43
+ label: entry.site.label,
44
+ trend: hasCoverageObservation(entry.summary) ? entry.trend : undefined,
45
+ })))
46
+ : null)
47
+
48
+ const days = computed(() => changes.value?.days ?? [])
49
+ const siteRows = computed(() => changes.value?.sites ?? [])
50
+ // Fetches are staggered, so a Site with no trend yet must not read as no change.
51
+ function isRowPending(siteId: string): boolean {
52
+ const entry = entriesById.value.get(siteId)
53
+ return !!entry && isEntryPending(entry)
54
+ }
55
+ function siteTo(siteId: string): string | null {
56
+ const entry = entriesById.value.get(siteId)
57
+ return entry ? route.site('siteIndexing', entry.site.ref) : null
58
+ }
59
+ // A list with nothing to show makes no claim until every Site has answered. The
60
+ // roll-up's own loading and error states come first, so its Retry stays reachable.
61
+ const rollupSettled = computed(() => status.value === 'success')
62
+ const isCollecting = computed(() => rollupSettled.value && !siteRows.value.length && !fetchState.value.isPending && !fetchState.value.hasCoverage && !fetchState.value.failed.length)
63
+ const isWithheld = computed(() => rollupSettled.value && !siteRows.value.length && fetchState.value.failed.length > 0)
64
+
65
+ const CHART_HEIGHT = 200
66
+ const NEW_LABEL = copy.changes.opened
67
+ const CLEARED_LABEL = copy.changes.cleared
68
+ const SAMPLED_COUNTS = copy.changes.sampledCounts
69
+ // Amber and blue, by the bars' side of the zero line. Green would read as a repair.
70
+ const newColor = indexingVizColors.notIndexed
71
+ const clearedColor = indexingVizColors.crawled
72
+
73
+ const x = (_d: IndexingChangesDay, index: number) => index
74
+ const y = [(d: IndexingChangesDay) => d.opened, (d: IndexingChangesDay) => -d.cleared]
75
+ const barColors = [newColor.hex, clearedColor.hex]
76
+ const zeroLine = () => 0
77
+
78
+ const xDomain = computed<[number, number]>(() => [-0.5, Math.max(days.value.length - 1, 0) + 0.5])
79
+ const yDomain = computed<[number, number]>(() => [
80
+ -Math.max(...days.value.map(day => day.cleared), 0),
81
+ Math.max(...days.value.map(day => day.opened), 1),
82
+ ])
83
+ // Counts are whole numbers, so the axis never labels a fraction. The step is a
84
+ // 1, 2, or 5 multiple of a power of 10, and never below 1.
85
+ const yTickValues = computed(() => {
86
+ const [min, max] = yDomain.value
87
+ const raw = (max - min) / 4
88
+ const power = 10 ** Math.floor(Math.log10(raw))
89
+ const step = Math.max(1, [1, 2, 5, 10].find(factor => factor * power >= raw)! * power)
90
+ const ticks: number[] = []
91
+ for (let value = Math.ceil(min / step) * step; value <= max; value += step)
92
+ ticks.push(value)
93
+ return ticks
94
+ })
95
+
96
+ const plotEl = useTemplateRef<HTMLElement>('plotEl')
97
+ const { width: plotWidth } = useElementSize(plotEl)
98
+ const { tickPlan, tickFormat } = useChartTickPlan({ dates: () => days.value.map(day => day.day), width: plotWidth })
99
+
100
+ function tickTextAlign(index: number): TextAlign {
101
+ if (index === 0)
102
+ return TextAlign.Left
103
+ return index === days.value.length - 1 ? TextAlign.Right : TextAlign.Center
104
+ }
105
+
106
+ const dayFormat = new Intl.DateTimeFormat(DISPLAY_LOCALE, { month: 'short', day: 'numeric', timeZone: 'UTC' })
107
+ function dayLabel(day: string): string {
108
+ return dayFormat.format(new Date(`${day}T00:00:00Z`))
109
+ }
110
+
111
+ function crosshairTemplate(d: IndexingChangesDay): string {
112
+ const row = (label: string, value: number, color: string) => `<div style="display:flex;align-items:center;gap:6px">
113
+ <span style="width:8px;height:8px;border-radius:9999px;background:${color};flex-shrink:0"></span>
114
+ <span style="color:var(--ui-text-muted)">${label}</span>
115
+ <span style="font-variant-numeric:tabular-nums;color:var(--ui-text-highlighted);margin-left:auto">${formatNumber(value)}</span>
116
+ </div>`
117
+ return `<div style="display:flex;flex-direction:column;gap:4px;min-width:140px;padding:2px">
118
+ <div style="color:var(--ui-text-dimmed);font-size:12px">${dayLabel(d.day)}</div>
119
+ ${row(NEW_LABEL, d.opened, newColor.hex)}
120
+ ${row(CLEARED_LABEL, d.cleared, clearedColor.hex)}
121
+ </div>`
122
+ }
123
+
124
+ // Mounted on the body so the plot box cannot clip it.
125
+ const tooltipContainer = import.meta.client ? document.body : undefined
126
+
127
+ const changeFormat = new Intl.NumberFormat(DISPLAY_LOCALE, { signDisplay: 'exceptZero' })
128
+
129
+ function sinceLabel(since: string): string | null {
130
+ return since > (days.value[1]?.day ?? since) ? fillCopy(copy.changes.since, { date: dayLabel(since) }) : null
131
+ }
132
+
133
+ function retryFailed() {
134
+ emit('retry', fetchState.value.failed.map(entry => entry.site.id))
135
+ }
136
+ </script>
137
+
138
+ <template>
139
+ <div v-if="rollupRead" class="min-w-0 space-y-4" data-pro-indexing-section="portfolio-changes">
140
+ <UiAlert
141
+ v-if="fetchState.failed.length"
142
+ status="error"
143
+ icon="caution"
144
+ :title="copy.common.failedTitle"
145
+ :description="fetchState.errorDescription ?? undefined"
146
+ >
147
+ <template #action>
148
+ <UiButton purpose="secondary" size="xs" class="min-h-11 sm:min-h-7" @click="retryFailed">
149
+ {{ copy.common.retry }}
150
+ </UiButton>
151
+ </template>
152
+ </UiAlert>
153
+
154
+ <UiEmptyState
155
+ v-if="isCollecting"
156
+ icon="file-search"
157
+ :title="copy.common.collectingTitle"
158
+ :description="copy.common.collectingBody"
159
+ />
160
+
161
+ <UiWidgetState
162
+ v-else-if="!isWithheld"
163
+ :status="status"
164
+ :error="error"
165
+ :empty="!siteRows.length && !fetchState.isPending"
166
+ show-loading-before-hydration
167
+ skeleton-type="bar"
168
+ :skeleton-lines="28"
169
+ :empty-title="copy.changes.emptyTitle"
170
+ :empty-message="fillCopy(copy.changes.emptyBody, { days: rollup?.windowDays ?? 28 })"
171
+ @retry="rollupRead?.refresh()"
172
+ >
173
+ <div class="flex flex-col gap-4">
174
+ <section class="min-w-0 space-y-1.5">
175
+ <p class="text-xs text-muted">
176
+ {{ fillCopy(copy.changes.window, { days: rollup?.windowDays ?? "" }) }}
177
+ </p>
178
+ <ul class="flex flex-wrap gap-x-3 gap-y-1" :aria-label="copy.changes.legendLabel">
179
+ <li class="flex items-center gap-1.5 text-xs text-muted">
180
+ <span class="size-2 shrink-0 rounded-full" :class="newColor.dot" aria-hidden="true" />
181
+ {{ NEW_LABEL }}
182
+ </li>
183
+ <li class="flex items-center gap-1.5 text-xs text-muted">
184
+ <span class="size-2 shrink-0 rounded-full" :class="clearedColor.dot" aria-hidden="true" />
185
+ {{ CLEARED_LABEL }}
186
+ </li>
187
+ </ul>
188
+
189
+ <div ref="plotEl" class="min-w-0" role="img" :aria-label="copy.changes.chartLabel">
190
+ <ClientOnly>
191
+ <VisXYContainer
192
+ :height="CHART_HEIGHT"
193
+ :data="days"
194
+ :x-domain="xDomain"
195
+ :y-domain="yDomain"
196
+ >
197
+ <VisStackedBar :x="x" :y="y" :color="barColors" :bar-padding="0.2" :rounded-corners="2" />
198
+ <VisLine :x="x" :y="zeroLine" color="var(--ui-border-accented)" :line-width="1" />
199
+ <VisAxis
200
+ type="x"
201
+ :tick-line="false"
202
+ :grid-line="false"
203
+ :domain-line="false"
204
+ :tick-values="tickPlan.indices"
205
+ :tick-format="tickFormat"
206
+ :tick-text-align="tickTextAlign"
207
+ tick-text-font-size="11px"
208
+ tick-text-color="var(--ui-text-dimmed)"
209
+ />
210
+ <VisAxis
211
+ type="y"
212
+ :tick-line="false"
213
+ :domain-line="false"
214
+ :tick-values="yTickValues"
215
+ :tick-format="(value: number) => formatNumber(value)"
216
+ tick-text-font-size="11px"
217
+ tick-text-color="var(--ui-text-dimmed)"
218
+ />
219
+ <VisTooltip :container="tooltipContainer" :follow-cursor="false" horizontal-placement="right" />
220
+ <VisCrosshair :x="x" :y="y" color="none" :template="crosshairTemplate" />
221
+ </VisXYContainer>
222
+ <template #fallback>
223
+ <UiSkeleton type="block" class="w-full" :style="{ height: `${CHART_HEIGHT}px` }" />
224
+ </template>
225
+ </ClientOnly>
226
+ </div>
227
+
228
+ <div class="sr-only">
229
+ <!-- eslint-disable-next-line vue/no-restricted-syntax -- The hidden chart equivalent is the documented raw-table exception. -->
230
+ <table>
231
+ <caption>{{ copy.changes.chartCaption }}</caption>
232
+ <thead>
233
+ <tr>
234
+ <th scope="col">
235
+ {{ copy.changes.day }}
236
+ </th>
237
+ <th scope="col">
238
+ {{ NEW_LABEL }}
239
+ </th>
240
+ <th scope="col">
241
+ {{ CLEARED_LABEL }}
242
+ </th>
243
+ </tr>
244
+ </thead>
245
+ <tbody>
246
+ <tr v-for="day in days" :key="day.day">
247
+ <th scope="row">
248
+ {{ dayLabel(day.day) }}
249
+ </th>
250
+ <td>{{ formatNumber(day.opened) }}</td>
251
+ <td>{{ formatNumber(day.cleared) }}</td>
252
+ </tr>
253
+ </tbody>
254
+ </table>
255
+ </div>
256
+ </section>
257
+
258
+ <!-- Below sm the cells pad less, the Site name truncates, and the sampled
259
+ headers wrap, so Site, Change, First recorded, and Cleared fit 375px. -->
260
+ <UiTableShell :label="copy.changes.tableLabel" size="xs" bordered row-hover>
261
+ <template #head>
262
+ <UiTableTh no-padding class="px-1.5 py-2.5 sm:px-3">
263
+ {{ copy.changes.site }}
264
+ </UiTableTh>
265
+ <UiTableTh numeric visible-from="sm">
266
+ {{ copy.changes.notIndexed }}
267
+ </UiTableTh>
268
+ <UiTableTh numeric no-padding class="px-1.5 py-2.5 sm:px-3">
269
+ {{ copy.changes.change }}
270
+ </UiTableTh>
271
+ <!-- The label variant's (?) trigger is 24px and the primitive fixes its
272
+ size, so the whole header is the trigger: 44px tall on mobile. -->
273
+ <UiTableTh v-for="label in [NEW_LABEL, CLEARED_LABEL]" :key="label" numeric no-padding class="px-1.5 py-1 sm:px-3 sm:py-2.5">
274
+ <UiTooltip :title="label" :description="SAMPLED_COUNTS" trigger-as="button">
275
+ <span class="text-label inline-flex min-h-11 sm:min-h-0 items-center gap-1 whitespace-normal text-right sm:whitespace-nowrap">
276
+ {{ label }}
277
+ <UiIcon name="life-buoy" class="size-3 shrink-0 text-dimmed" aria-hidden="true" />
278
+ </span>
279
+ </UiTooltip>
280
+ </UiTableTh>
281
+ </template>
282
+ <tr v-for="row in siteRows" :key="row.siteId">
283
+ <UiTableTd size="xs" row-header no-padding class="px-1.5 sm:px-3">
284
+ <component
285
+ :is="siteTo(row.siteId) ? NuxtLink : 'span'"
286
+ :to="siteTo(row.siteId) ?? undefined"
287
+ class="flex min-h-11 sm:min-h-0 min-w-0 max-w-[4.5rem] sm:max-w-none items-center gap-2 hover:underline"
288
+ >
289
+ <UiFavicon :domain="entriesById.get(row.siteId)?.site.url ?? ''" :size="14" decorative class="shrink-0 rounded-sm" />
290
+ <span class="truncate">{{ row.label }}</span>
291
+ </component>
292
+ </UiTableTd>
293
+ <UiTableTd size="xs" numeric visible-from="sm">
294
+ <UiSkeleton v-if="!row.level && isRowPending(row.siteId)" class="ml-auto h-5" :index="1" :base="40" :range="0" />
295
+ <template v-else>
296
+ {{ row.level ? formatNumber(row.level.notIndexed) : '—' }}
297
+ </template>
298
+ </UiTableTd>
299
+ <UiTableTd size="xs" numeric no-padding class="px-1.5 sm:px-3">
300
+ <UiSkeleton v-if="!row.level && isRowPending(row.siteId)" class="ml-auto h-5" :index="2" :base="48" :range="0" />
301
+ <span v-else-if="row.level" class="inline-flex flex-col items-end sm:flex-row sm:items-baseline sm:gap-1.5">
302
+ <span v-if="sinceLabel(row.level.since)" class="text-xs text-dimmed">{{ sinceLabel(row.level.since) }}</span>
303
+ <span class="font-medium" :class="row.level.change > 0 ? 'text-warning' : ''">{{ changeFormat.format(row.level.change) }}</span>
304
+ </span>
305
+ <template v-else>
306
+ —
307
+ </template>
308
+ </UiTableTd>
309
+ <UiTableTd size="xs" numeric no-padding class="px-1.5 sm:px-3">
310
+ {{ formatNumber(row.opened) }}
311
+ </UiTableTd>
312
+ <UiTableTd size="xs" numeric no-padding class="px-1.5 sm:px-3">
313
+ {{ formatNumber(row.cleared) }}
314
+ </UiTableTd>
315
+ </tr>
316
+ </UiTableShell>
317
+ </div>
318
+ </UiWidgetState>
319
+ </div>
320
+ </template>
@@ -0,0 +1,202 @@
1
+ <script setup lang="ts">
2
+ import type { IndexingWindow } from '@gscdump/sdk/indexing'
3
+ import type { IndexingPortfolioEntry } from '../../shared/portfolio'
4
+ import { indexingWindowNote, issueStack, portfolioIssueCounts } from '@gscdump/sdk/indexing'
5
+ import { formatNumber } from '@nuxtseo/design-system/app/composables/formatting'
6
+ import { fillCopy } from '@nuxtseo/pro-shell/shared/copy'
7
+ import { computed, ref, useId } from 'vue'
8
+ import { UiAlert, UiBarCell, UiButton, UiEmptyState, UiIcon, UiSkeleton, UiTableShell, UiTableTd, UiTableTh, UiTopEntityStackChart } from '#components'
9
+ import { portfolioFetchState } from '../../shared/portfolio'
10
+ import { indexingIssueQuery } from '../../shared/routes'
11
+ import { useProIndexingCopy } from '../composables/useProIndexingCopy'
12
+ import { useProIndexingRoute } from '../composables/useProIndexingRoute'
13
+
14
+ // Portfolio Issues: "is one problem spreading across my Sites?" Ranks issues
15
+ // across one Portfolio scope, with each Site's count a click away.
16
+
17
+ const { entries, window } = defineProps<{
18
+ entries: readonly IndexingPortfolioEntry[]
19
+ window: IndexingWindow
20
+ }>()
21
+
22
+ const emit = defineEmits<{ retry: [siteIds: string[]] }>()
23
+
24
+ const copy = useProIndexingCopy()
25
+ const route = useProIndexingRoute()
26
+
27
+ const LEGEND_SLOTS = 6
28
+ const CHART_HEIGHT = 200
29
+
30
+ const fetchState = computed(() => portfolioFetchState(entries, copy.common))
31
+ const coverageSites = computed(() => fetchState.value.coverageSites)
32
+ const stack = computed(() => issueStack(coverageSites.value, window))
33
+ const rows = computed(() => portfolioIssueCounts(coverageSites.value, window))
34
+ // The read cap can stop short of the window start, so the chart says where it starts.
35
+ const windowNote = computed(() => indexingWindowNote(window, coverageSites.value.map(site => site.trend)))
36
+ const maxCount = computed(() => rows.value[0]?.count ?? 0)
37
+ const sitesById = computed(() => new Map(entries.map(entry => [entry.site.id, entry.site])))
38
+
39
+ function barPercent(count: number): number {
40
+ return maxCount.value ? (count / maxCount.value) * 100 : 0
41
+ }
42
+
43
+ function issueTo(siteId: string, filter: { key: 'issue' | 'facet', value: string }): string | null {
44
+ const site = sitesById.value.get(siteId)
45
+ return site ? route.site('siteIndexingUrls', site.ref, indexingIssueQuery(filter)) : null
46
+ }
47
+
48
+ const detailIdPrefix = useId()
49
+ const expanded = ref(new Set<string>())
50
+
51
+ function toggleExpanded(id: string) {
52
+ if (!expanded.value.delete(id))
53
+ expanded.value.add(id)
54
+ }
55
+
56
+ function retryFailed() {
57
+ emit('retry', fetchState.value.failed.map(entry => entry.site.id))
58
+ }
59
+ </script>
60
+
61
+ <template>
62
+ <div class="min-w-0 space-y-4" data-pro-indexing-section="portfolio-issues">
63
+ <UiAlert
64
+ v-if="fetchState.failed.length"
65
+ status="error"
66
+ icon="caution"
67
+ :title="copy.common.failedTitle"
68
+ :description="fetchState.errorDescription ?? undefined"
69
+ >
70
+ <template #action>
71
+ <UiButton purpose="secondary" size="xs" class="min-h-11 sm:min-h-7" @click="retryFailed">
72
+ {{ copy.common.retry }}
73
+ </UiButton>
74
+ </template>
75
+ </UiAlert>
76
+
77
+ <div v-if="fetchState.isPending && !coverageSites.length" class="space-y-4" aria-busy="true">
78
+ <UiTopEntityStackChart :buckets="[]" :series="[]" :height="CHART_HEIGHT" :legend-slots="LEGEND_SLOTS" loading />
79
+ <div class="space-y-2">
80
+ <UiSkeleton v-for="i in 4" :key="i" type="block" class="h-8 w-full" />
81
+ </div>
82
+ </div>
83
+
84
+ <UiEmptyState
85
+ v-else-if="!coverageSites.length && !fetchState.failed.length"
86
+ icon="file-search"
87
+ :title="copy.common.collectingTitle"
88
+ :description="copy.common.collectingBody"
89
+ />
90
+
91
+ <template v-else-if="coverageSites.length">
92
+ <section v-if="rows.length || stack.series.length || windowNote" class="min-w-0 space-y-1.5">
93
+ <div class="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
94
+ <p class="text-xs text-muted">
95
+ {{ copy.issues.stackTitle }}
96
+ </p>
97
+ <!-- The chart and the list below sum only the Sites that loaded. -->
98
+ <p v-if="fetchState.partialTotalsNote" class="text-xs text-muted">
99
+ {{ fetchState.partialTotalsNote }}
100
+ </p>
101
+ <p v-if="windowNote" class="text-xs text-muted">
102
+ {{ windowNote }}
103
+ </p>
104
+ </div>
105
+ <UiTopEntityStackChart
106
+ :buckets="stack.buckets"
107
+ :series="stack.series"
108
+ scale="absolute"
109
+ :height="CHART_HEIGHT"
110
+ :legend-slots="LEGEND_SLOTS"
111
+ :format="formatNumber"
112
+ />
113
+ </section>
114
+
115
+ <UiTableShell v-if="rows.length" size="xs" bordered row-hover :label="copy.issues.tableLabel">
116
+ <template #head>
117
+ <UiTableTh>{{ copy.issues.issue }}</UiTableTh>
118
+ <UiTableTh numeric>
119
+ {{ copy.issues.urls }}
120
+ </UiTableTh>
121
+ <UiTableTh numeric>
122
+ {{ copy.issues.sites }}
123
+ </UiTableTh>
124
+ <UiTableTh visible-from="md">
125
+ {{ copy.issues.mostAffected }}
126
+ </UiTableTh>
127
+ </template>
128
+ <template v-for="row in rows" :key="row.id">
129
+ <tr>
130
+ <UiTableTd size="xs" row-header>
131
+ <!-- A disclosure button: a native details element cannot span the columns of a table row. -->
132
+ <button
133
+ type="button"
134
+ class="flex w-full min-h-11 sm:min-h-0 items-center gap-1.5 rounded-md text-left text-sm cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
135
+ :aria-expanded="expanded.has(row.id)"
136
+ :aria-controls="expanded.has(row.id) ? `${detailIdPrefix}-${row.id}` : undefined"
137
+ @click="toggleExpanded(row.id)"
138
+ >
139
+ <UiIcon
140
+ name="chevron-right"
141
+ class="size-3.5 shrink-0 text-dimmed transition-transform duration-150"
142
+ :class="{ 'rotate-90': expanded.has(row.id) }"
143
+ aria-hidden="true"
144
+ />
145
+ {{ row.label }}
146
+ </button>
147
+ </UiTableTd>
148
+ <UiTableTd size="xs" numeric>
149
+ <UiBarCell class="ml-auto min-w-24 justify-end" :percent="barPercent(row.count)" bar-class="bg-pro/15">
150
+ <span class="relative text-sm tabular-nums">{{ formatNumber(row.count) }}</span>
151
+ </UiBarCell>
152
+ </UiTableTd>
153
+ <UiTableTd size="xs" numeric>
154
+ <span class="text-sm">{{ formatNumber(row.siteCount) }}</span>
155
+ </UiTableTd>
156
+ <UiTableTd size="xs" visible-from="md">
157
+ <span v-if="row.sites[0]" class="flex min-w-0 items-baseline gap-1.5">
158
+ <span class="max-w-48 truncate text-sm" :title="row.sites[0].label">{{ row.sites[0].label }}</span>
159
+ <span class="text-xs tabular-nums text-muted">{{ formatNumber(row.sites[0].count) }}</span>
160
+ </span>
161
+ </UiTableTd>
162
+ </tr>
163
+ <tr v-if="expanded.has(row.id)" :id="`${detailIdPrefix}-${row.id}`">
164
+ <UiTableTd size="xs" v-bind="{ colspan: '4' }">
165
+ <ul class="space-y-1 pl-5">
166
+ <li v-for="site in row.sites" :key="site.siteId" class="flex min-h-7 items-center gap-3">
167
+ <span class="min-w-0 flex-1 truncate text-sm text-muted" :title="site.label">{{ site.label }}</span>
168
+ <span class="text-sm tabular-nums">{{ formatNumber(site.count) }}</span>
169
+ <!-- A Site can leave the scope between renders, or the site maps no URLs route: keep the count, drop the link. -->
170
+ <UiButton
171
+ v-if="issueTo(site.siteId, row.filter)"
172
+ :to="issueTo(site.siteId, row.filter)!"
173
+ purpose="secondary"
174
+ size="xs"
175
+ trailing-icon="next"
176
+ class="min-h-11 sm:min-h-7"
177
+ :aria-label="fillCopy(copy.common.fixIssuesLabel, { issue: row.label.toLowerCase(), site: site.label })"
178
+ >
179
+ {{ copy.common.fixIssues }}
180
+ </UiButton>
181
+ </li>
182
+ </ul>
183
+ </UiTableTd>
184
+ </tr>
185
+ </template>
186
+ </UiTableShell>
187
+
188
+ <div v-else-if="fetchState.isPending" class="space-y-2" aria-busy="true">
189
+ <UiSkeleton v-for="i in 4" :key="i" type="block" class="h-8 w-full" />
190
+ </div>
191
+
192
+ <!-- A failed Site is unknown, so the list makes no claim until it loads.
193
+ Days the read cannot reach are unknown too, and the note above says so. -->
194
+ <UiEmptyState
195
+ v-else-if="!fetchState.failed.length && !windowNote"
196
+ icon="file-search"
197
+ :title="copy.issues.emptyTitle"
198
+ :description="copy.issues.emptyBody"
199
+ />
200
+ </template>
201
+ </div>
202
+ </template>