feat(uat-batch-11): picker polish + BulkAddBerthsWizard currency + DocumentsHub root cleanup

- BulkAddBerthsWizard `priceCurrency` row + apply-to-all swapped from
  freetext Input to the shared CurrencySelect. Same idiom as
  berth-form + expense-form-dialog.
- /api/v1/yachts/autocomplete no longer short-circuits to `[]` when
  the search query is empty — the service returns the top 20
  most-recently-updated yachts so the picker has a useful default
  view the moment it opens. Saves the rep from a dead-end empty
  state.
- YachtPicker gains a fallback useQuery against `/api/v1/yachts/{id}`
  when the selected yacht isn't present in the current autocomplete
  window. Trigger label now shows the real name (was falling back to
  "Yacht <uuid-prefix>" when a parent pre-selected a value from a URL
  param).
- DocumentsHub: breadcrumb row only renders when a folder is
  selected. The "Home / All documents" placeholder was wasted
  vertical space above the PageHeader on the root view.

tsc clean. 1419/1419 vitest pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 18:06:41 +02:00
parent c18dbbd61b
commit 2bcf544cbc
5 changed files with 40 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
import { and, eq, ilike, inArray, isNull, or, sql } from 'drizzle-orm';
import { and, desc, eq, ilike, inArray, isNull, or, sql } from 'drizzle-orm';
import { db } from '@/lib/db';
import { yachts, yachtOwnershipHistory, yachtTags, clients } from '@/lib/db/schema';
import type { Yacht } from '@/lib/db/schema/yachts';
@@ -393,6 +393,17 @@ export async function listOwnershipHistory(yachtId: string, portId: string) {
// ─── Autocomplete ─────────────────────────────────────────────────────────────
export async function autocomplete(portId: string, q: string) {
// Empty query returns the top 20 most-recently-updated yachts so the
// picker has something useful to show the moment it opens, instead of
// a dead-end empty state until the rep types something.
if (!q) {
return await db
.select()
.from(yachts)
.where(eq(yachts.portId, portId))
.orderBy(desc(yachts.updatedAt))
.limit(20);
}
const pattern = `%${q}%`;
return await db
.select()