50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import type { VMState } from "../index.js";
|
|
|
|
/**
|
|
* AK-P16b · booking-pages list view-model (M06 Block E.1, interim UI AD-28).
|
|
* Pure (DoD A.3): the loader resolves the tenant's booking pages and the
|
|
* absolute public URL per row (no `window.location` access in the screen).
|
|
*/
|
|
|
|
export interface BookingPageListRow {
|
|
readonly id: string;
|
|
readonly title: string;
|
|
readonly slug: string;
|
|
readonly durationMinutes: number;
|
|
readonly isPublished: boolean;
|
|
readonly providerCount: number;
|
|
readonly editHref: string;
|
|
readonly publicPath: string;
|
|
/** Absolute public URL resolved by the loader (origin + publicPath). */
|
|
readonly publicUrl: string;
|
|
}
|
|
|
|
export interface BookingPagesListData {
|
|
readonly rows: readonly BookingPageListRow[];
|
|
readonly canCreate: boolean;
|
|
readonly newHref: string;
|
|
readonly emptyHeadlineKey: string;
|
|
readonly emptyBodyKey: string;
|
|
}
|
|
|
|
export type BookingPagesListVM = VMState<BookingPagesListData>;
|
|
|
|
export interface BuildBookingPagesListInput {
|
|
readonly rows: readonly BookingPageListRow[];
|
|
readonly canCreate: boolean;
|
|
readonly newHref: string;
|
|
}
|
|
|
|
export function buildBookingPagesListVM(input: BuildBookingPagesListInput): BookingPagesListVM {
|
|
return {
|
|
status: "ready",
|
|
data: {
|
|
rows: input.rows,
|
|
canCreate: input.canCreate,
|
|
newHref: input.newHref,
|
|
emptyHeadlineKey: "bookings.pages.empty.headline",
|
|
emptyBodyKey: "bookings.pages.empty.body",
|
|
},
|
|
};
|
|
}
|