Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,52 @@
import type { VMState } from "../index.js";
/**
* AK-P16b · bookings list view-model (M06 Block C). Pure (DoD A.3): the loader
* resolves appointments already permission-filtered (read_own → own provider rows
* only) and this shapes the table. Customer name/email come from the booking's
* intake answers (no cross-entity join needed). Status is rendered via an i18n key.
*/
export type AppointmentStatus = "scheduled" | "held" | "cancelled" | "no_show" | "rescheduled";
export interface BookingListRow {
readonly id: string;
readonly startAtIso: string;
readonly endAtIso: string;
readonly status: AppointmentStatus;
/** i18n key for the status pill (e.g. `bookings.status.scheduled`). */
readonly statusKey: string;
readonly customerName: string;
readonly customerEmail: string;
readonly pageTitle: string;
readonly providerUserId: string;
readonly detailHref: string;
}
export interface BookingListData {
readonly rows: readonly BookingListRow[];
readonly emptyHeadlineKey: string;
readonly emptyBodyKey: string;
}
export type BookingListVM = VMState<BookingListData>;
/** i18n key for an appointment status pill. */
export function bookingStatusKey(status: AppointmentStatus): string {
return `bookings.status.${status}`;
}
export interface BuildBookingListInput {
readonly rows: readonly BookingListRow[];
}
export function buildBookingListVM(input: BuildBookingListInput): BookingListVM {
return {
status: "ready",
data: {
rows: input.rows,
emptyHeadlineKey: "bookings.list.empty.headline",
emptyBodyKey: "bookings.list.empty.body",
},
};
}
@@ -0,0 +1,46 @@
import { describe, expect, it } from "vitest";
import { buildBookingListVM, bookingStatusKey, type BookingListRow } from "./booking-list.vm.js";
const row = (over: Partial<BookingListRow> = {}): BookingListRow => ({
id: "a1",
startAtIso: "2026-07-01T09:00:00.000Z",
endAtIso: "2026-07-01T09:30:00.000Z",
status: "scheduled",
statusKey: bookingStatusKey("scheduled"),
customerName: "Max Muster",
customerEmail: "max@example.com",
pageTitle: "Wartungstermin",
providerUserId: "u1",
detailHref: "/t/bookings/a1",
...over,
});
describe("buildBookingListVM (M06 Block C)", () => {
it("is always ready and carries the rows + empty keys", () => {
const vm = buildBookingListVM({ rows: [row()] });
expect(vm.status).toBe("ready");
if (vm.status !== "ready" || !vm.data) {
throw new Error("expected ready");
}
expect(vm.data.rows).toHaveLength(1);
expect(vm.data.emptyHeadlineKey).toBe("bookings.list.empty.headline");
expect(vm.data.emptyBodyKey).toBe("bookings.list.empty.body");
});
it("ready with an empty rows array (the UI renders the empty state)", () => {
const vm = buildBookingListVM({ rows: [] });
expect(vm.status).toBe("ready");
if (vm.status !== "ready" || !vm.data) {
throw new Error("expected ready");
}
expect(vm.data.rows).toHaveLength(0);
});
it("maps every status to a stable i18n key", () => {
expect(bookingStatusKey("scheduled")).toBe("bookings.status.scheduled");
expect(bookingStatusKey("held")).toBe("bookings.status.held");
expect(bookingStatusKey("cancelled")).toBe("bookings.status.cancelled");
expect(bookingStatusKey("no_show")).toBe("bookings.status.no_show");
expect(bookingStatusKey("rescheduled")).toBe("bookings.status.rescheduled");
});
});