Files
vigilcare-records/vigilcare-records-web/src/components/WorkstationLayout.vue
T
Trent 3c7bf5bccb
CI / backend (push) Failing after 38s
CI / frontend (push) Successful in 9m35s
Harden workstation UX and seed placeholder scans after Playwright QA.
Fix mobile queue navigation, draft/loading states, and Intake overflow; seed MinIO demo PDFs so document viewing does not 500; add e2e smoke coverage.
2026-10-06 15:07:15 +08:00

126 lines
3.5 KiB
Vue

<template>
<!-- Queue-only: full-width list with empty/skeleton patterns from the list slot -->
<div
v-if="!hasBatch"
class="flex-1 min-h-0 overflow-auto p-4 sm:p-6"
data-testid="workstation-queue"
data-tour="workstation-queue"
>
<slot name="queue" />
</div>
<!-- Work mode: optional left rail + dominant scan + form (desktop ≥1280px) -->
<div
v-else
class="workstation-split flex-1 min-h-0"
:class="{ 'workstation-split--no-rail': !showRail }"
data-testid="workstation-split"
>
<aside
v-if="showRail"
class="workstation-rail hidden xl:flex min-h-0"
data-testid="workstation-rail"
>
<slot name="rail" />
</aside>
<!-- Below xl the rail is hidden; keep an explicit path back to the queue -->
<div
v-if="queuePath"
class="xl:hidden col-span-full flex flex-wrap items-center gap-3 border-b border-line bg-surface px-3 py-2 sm:px-4"
data-testid="workstation-mobile-nav"
>
<RouterLink
:to="queuePath"
class="inline-flex items-center gap-1.5 text-sm font-medium text-primary-700 hover:text-primary-800 shrink-0"
>
<span aria-hidden="true">←</span>
{{ queueLabel }}
</RouterLink>
<label
v-if="showMobileBatchSwitcher"
class="flex min-w-0 flex-1 items-center gap-2 sm:max-w-xs"
>
<span class="sr-only">Switch batch in queue</span>
<select
class="form-input min-w-0 flex-1 py-1.5 text-sm"
data-testid="workstation-mobile-batch-select"
:value="selectedBatchId"
@change="onMobileBatchChange"
>
<option v-for="item in queueBatches" :key="item.id" :value="item.id">
{{ item.label }}
</option>
</select>
</label>
</div>
<section
class="workstation-scan min-h-0 min-w-0"
data-testid="workstation-scan"
data-tour="workstation-scan"
>
<p class="evidence-level evidence-level--1" data-testid="evidence-level-1">
<span class="evidence-level-mark" aria-hidden="true">1</span>
Source scan
</p>
<div class="min-h-0 flex-1 flex flex-col">
<slot name="scan" />
</div>
</section>
<section class="workstation-form min-h-0 min-w-0" data-testid="workstation-form">
<slot name="form" />
</section>
</div>
</template>
<script setup lang="ts">
import { computed, useSlots } from 'vue'
import { RouterLink } from 'vue-router'
export type WorkstationQueueBatchOption = {
id: string
label: string
}
const props = withDefaults(
defineProps<{
/** When false, render full-width queue slot only */
hasBatch: boolean
/** Queue list route shown on viewports where the rail is hidden */
queuePath?: string
queueLabel?: string
/** Compact batch switcher below xl when rail is hidden */
queueBatches?: WorkstationQueueBatchOption[]
selectedBatchId?: string
}>(),
{
queuePath: undefined,
queueLabel: 'Back to queue',
queueBatches: () => [],
selectedBatchId: undefined,
},
)
const emit = defineEmits<{
(e: 'select-batch', batchId: string): void
}>()
const slots = useSlots()
const showRail = computed(() => props.hasBatch && !!slots.rail)
const showMobileBatchSwitcher = computed(
() =>
props.hasBatch &&
!!props.selectedBatchId &&
(props.queueBatches?.length ?? 0) > 0,
)
function onMobileBatchChange(event: Event) {
const id = (event.target as HTMLSelectElement).value
if (id && id !== props.selectedBatchId) {
emit('select-batch', id)
}
}
</script>