feat: announce admin inventory actions
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-11 09:18:19 -04:00
parent eb43cef872
commit 98d2adac17
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -45,6 +45,7 @@ h1 { max-width: 760px; margin: var(--space-3) 0 var(--space-4); font-size: var(-
.auth-panel h1 { font-size: var(--text-2xl); }
.skip-link { position: absolute; left: var(--space-4); top: var(--space-2); z-index: 10; transform: translateY(-200%); background: var(--color-surface); color: var(--color-interactive-text); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: var(--color-background); }
.admin-sidebar { display: grid; align-content: start; gap: var(--space-6); border-right: var(--border-thin) solid var(--color-border); padding: var(--space-8); background: var(--color-surface); }
.admin-sidebar h1 { font-size: var(--text-xl); }
@@ -18,6 +18,7 @@ const inventoryTags = ref('');
const isLoading = ref(true);
const isSaving = ref(false);
const error = ref('');
const announcement = ref('');
function csrfToken() {
return document.cookie.split('; ').find((value) => value.startsWith('pokemon_inventory_csrf='))?.split('=')[1] ?? '';
@@ -46,6 +47,7 @@ async function archiveSelectedInventory() {
const archivedById = new Map(archivedItems.map((item) => [item.id, item]));
inventory.value = inventory.value.map((item) => archivedById.get(item.id) ?? item);
selectedInventoryIds.value = [];
announcement.value = `${archivedItems.length} inventory item${archivedItems.length === 1 ? '' : 's'} archived.`;
} catch (requestError) {
error.value = requestError.message;
} finally {
@@ -61,6 +63,7 @@ async function refreshSelectedPricing() {
const jobs = await refreshAdminInventoryPricing(selectedInventoryIds.value, 'fixture-provider', csrfToken());
pricingJobs.value = [...jobs, ...pricingJobs.value];
selectedInventoryIds.value = [];
announcement.value = `Pricing refresh queued for ${jobs.length} inventory item${jobs.length === 1 ? '' : 's'}.`;
} catch (requestError) {
error.value = requestError.message;
} finally {
@@ -82,6 +85,7 @@ async function updateSelectedTags(action) {
);
inventoryTags.value = '';
selectedInventoryIds.value = [];
announcement.value = `Tags ${action === 'add' ? 'added to' : 'removed from'} selected inventory items.`;
} catch (requestError) {
error.value = requestError.message;
} finally {
@@ -95,6 +99,7 @@ async function retryPricingJob(jobId) {
try {
await retryAdminPricingJob(jobId, csrfToken());
pricingJobs.value = await listAdminPricingJobs();
announcement.value = 'Pricing job retry requested.';
} catch (requestError) {
error.value = requestError.message;
} finally {
@@ -111,6 +116,7 @@ onMounted(load);
<h1>Physical inventory</h1>
<p v-if="isLoading" class="state state--loading" role="status">Loading inventory...</p>
<p v-if="error" class="state state--error" role="alert">{{ error }}</p>
<p class="sr-only" role="status" aria-live="polite">{{ announcement }}</p>
<section v-if="!isLoading" class="admin-list" aria-labelledby="inventory-title">
<h2 id="inventory-title">All physical copies</h2>
<div class="admin-list__actions">