Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project are documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Bookings, inquiries and their detail pages now use the shared Merqo section, card and empty-state components.

## [0.11.3] - 2026-12-02

### Changed
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,5 @@ A deep link into the vendor dashboard survives the login and legal gates: every
The `/admin/activity` paging links and boundaries are pinned by `src/app/admin/activity/activity-paging.dom.test.tsx` (listed in `CHANGELOG.md`).

The landing phone mockups use rem font sizes, so the dashboard text-size adjuster scales them like the rest of the page.

The bookings list, inquiries and their detail pages use the shared `@merqo/ui` `Section`, `ElevatedCard` and `EmptyState` (see `CHANGELOG.md`).
2 changes: 2 additions & 0 deletions src/app/dashboard/bookings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ Money and times here come from `@merqo/ui` (`Money`, `formatMoney`, `Timestamp`,
Signed-out and stale-terms vendors come back here after sign-in or terms acceptance: the page passes its own path and query to `getVendorSession` as `returnTo`.

The new-inquiry and balance-due-soon badges use the `warning` tone instead of palette amber.

The list sections ("Inquiries" and "Your bookings") are `@merqo/ui` `Section`s, and the empty inquiry list uses its `EmptyState`. The phone-only card list and the GET filter form stay local: there is no shared equivalent.
2 changes: 2 additions & 0 deletions src/app/dashboard/bookings/[id]/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ Money and times here come from `@merqo/ui` (`Money`, `formatMoney`, `Timestamp`,
Signed-out and stale-terms vendors come back here after sign-in or terms acceptance: the page passes its own path and query to `getVendorSession` as `returnTo`.

The cancel and reschedule dialogs show their inline error through the shared `FormError`.

The Customer, Amounts and Booking ID blocks are `@merqo/ui` `ElevatedCard`s with a `Section` each, and `transaction-status-card.tsx` is an `ElevatedCard` too.
128 changes: 66 additions & 62 deletions src/app/dashboard/bookings/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ import { BookingIdCopy } from "./booking-id-copy";
import { checkoutKind } from "@/lib/checkout-kind";
import { RecoverDepositButton } from "./recover-deposit-button";
import { notFound } from "next/navigation";
import { Money, Timestamp, formatDate, qrSvg } from "@merqo/ui";
import {
ElevatedCard,
Money,
PageHeader,
Section,
Timestamp,
formatDate,
qrSvg,
} from "@merqo/ui";
import { getVendorSession } from "@/lib/vendor-session";
import { getBooking } from "@/lib/bookings";
import { getTransaction } from "@/lib/transactions";
import { getInquiryForBooking } from "@/lib/inquiry-inbox";
import { readVendorPlan } from "@/lib/vendor-entitlement";
import { PageHeader } from "@merqo/ui";
import { BookingStatusBadge, BalanceDueIndicator } from "../booking-badges";
import { TermsSnapshot } from "../inquiry-badges";
import { CustomerPhone } from "../customer-phone";
Expand Down Expand Up @@ -76,68 +83,65 @@ export default async function BookingDetailPage({
}
/>

<section aria-labelledby="customer-heading">
<h2 id="customer-heading" className="text-base font-semibold">
Customer
</h2>
<dl className="mt-2 grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm">
<dt className="text-muted-foreground">Phone</dt>
<dd>
<CustomerPhone phone={booking.customer_phone} />
</dd>
{inquiry && (
<>
<dt className="text-muted-foreground">Booking terms</dt>
<dd>
<TermsSnapshot inquiry={inquiry} />
</dd>
</>
)}
</dl>
</section>
<ElevatedCard className="p-6">
<Section title="Customer">
<dl className="grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm">
<dt className="text-muted-foreground">Phone</dt>
<dd>
<CustomerPhone phone={booking.customer_phone} />
</dd>
{inquiry && (
<>
<dt className="text-muted-foreground">Booking terms</dt>
<dd>
<TermsSnapshot inquiry={inquiry} />
</dd>
</>
)}
</dl>
</Section>
</ElevatedCard>

<section aria-labelledby="amounts-heading">
<h2 id="amounts-heading" className="text-base font-semibold">
Amounts
</h2>
<dl className="mt-2 grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm tabular-nums">
<dt className="text-muted-foreground">Total</dt>
<dd>
<Money cents={booking.total_amount_cents} />
</dd>
<dt className="text-muted-foreground">Deposit</dt>
<dd>
<Money cents={booking.deposit_amount_cents} />
</dd>
<dt className="text-muted-foreground">Balance</dt>
<dd>
<Money cents={booking.balance_amount_cents} />
</dd>
<dt className="text-muted-foreground">Balance due</dt>
<dd>
<Timestamp value={booking.balance_due_date} variant="date" />
</dd>
</dl>
</section>
<ElevatedCard className="p-6">
<Section title="Amounts">
<dl className="grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm tabular-nums">
<dt className="text-muted-foreground">Total</dt>
<dd>
<Money cents={booking.total_amount_cents} />
</dd>
<dt className="text-muted-foreground">Deposit</dt>
<dd>
<Money cents={booking.deposit_amount_cents} />
</dd>
<dt className="text-muted-foreground">Balance</dt>
<dd>
<Money cents={booking.balance_amount_cents} />
</dd>
<dt className="text-muted-foreground">Balance due</dt>
<dd>
<Timestamp value={booking.balance_due_date} variant="date" />
</dd>
</dl>
</Section>
</ElevatedCard>

<section aria-labelledby="reference-heading">
<h2 id="reference-heading" className="text-base font-semibold">
Booking ID
</h2>
<div className="mt-2 flex items-center gap-2 text-sm">
<code
className="min-w-0 truncate font-mono text-xs text-muted-foreground"
title={booking.id}
>
{booking.id}
</code>
<BookingIdCopy bookingId={booking.id} />
</div>
<p className="mt-2 text-xs text-muted-foreground">
Paste this into your qkit event&rsquo;s payment settings to show this
booking&rsquo;s live deposit and balance status there.
</p>
</section>
<ElevatedCard className="p-6">
<Section title="Booking ID">
<div className="flex items-center gap-2 text-sm">
<code
className="min-w-0 truncate font-mono text-xs text-muted-foreground"
title={booking.id}
>
{booking.id}
</code>
<BookingIdCopy bookingId={booking.id} />
</div>
<p className="text-xs text-muted-foreground">
Paste this into your qkit event&rsquo;s payment settings to show
this booking&rsquo;s live deposit and balance status there.
</p>
</Section>
</ElevatedCard>

<div className="grid gap-4 sm:grid-cols-2">
<TransactionStatusCard
Expand Down
6 changes: 3 additions & 3 deletions src/app/dashboard/bookings/[id]/transaction-status-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { checkoutKind } from "@/lib/checkout-kind";
import Image from "next/image";
import { Badge, cn } from "@merqo/ui/primitives";

import { Money } from "@merqo/ui";
import { ElevatedCard, Money } from "@merqo/ui";
import type { Transaction, TxStatus } from "@/lib/types";

// Same treatment as `dashboard/transactions/transaction-table.tsx` — `claimed`
Expand All @@ -24,7 +24,7 @@ export function TransactionStatusCard({
qrMarkup: string | null;
}) {
return (
<div className="rounded-xl border p-4">
<ElevatedCard className="p-4">
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
{label}
</p>
Expand Down Expand Up @@ -53,7 +53,7 @@ export function TransactionStatusCard({
/>
</>
)}
</div>
</ElevatedCard>
);
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/dashboard/bookings/inquiries/[id]/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ Buttons, inputs, dialogs, badges and the other shared primitives here are import
"Received" and the terms-accepted time render through `@merqo/ui` `formatDateTime` ("7 Nov 2026, 1:30 am", Singapore time).

The page passes its own path to `getVendorSession` as `returnTo`, so login and the legal gate bring the vendor back to this inquiry.

The details panel is an `@merqo/ui` `ElevatedCard`.
11 changes: 8 additions & 3 deletions src/app/dashboard/bookings/inquiries/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import Link from "next/link";
import { notFound } from "next/navigation";
import { getVendorSession } from "@/lib/vendor-session";
import { getInquiry } from "@/lib/inquiry-inbox";
import { PageHeader, formatDate, formatDateTime } from "@merqo/ui";
import {
ElevatedCard,
PageHeader,
formatDate,
formatDateTime,
} from "@merqo/ui";
import { CustomerPhone } from "../../customer-phone";
import { InquiryStatusBadge, TermsSnapshot } from "../../inquiry-badges";
import { NewBookingDialog } from "../../new-booking-dialog";
Expand Down Expand Up @@ -37,7 +42,7 @@ export default async function InquiryDetailPage({
action={<InquiryStatusBadge status={inquiry.status} />}
/>

<div className="rounded-xl border p-4 text-sm">
<ElevatedCard className="p-6 text-sm">
<dl className="grid grid-cols-[auto_1fr] gap-x-6 gap-y-2">
<dt className="text-muted-foreground">Phone</dt>
<dd>
Expand All @@ -53,7 +58,7 @@ export default async function InquiryDetailPage({
</dd>
</dl>
<p className="mt-4 whitespace-pre-wrap">{inquiry.message}</p>
</div>
</ElevatedCard>

<div className="flex flex-wrap items-center gap-3">
{inquiry.booking_id ? (
Expand Down
14 changes: 12 additions & 2 deletions src/app/dashboard/bookings/inquiry-table.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
"use client";

import Link from "next/link";
import { DataTable, Timestamp, type DataTableColumn } from "@merqo/ui";
import {
DataTable,
EmptyState,
Timestamp,
type DataTableColumn,
} from "@merqo/ui";
import { PhoneList, PhoneRow } from "@/components/list/phone-row";
import { InquiryStatusBadge } from "./inquiry-badges";
import type { Inquiry } from "@/lib/types";
Expand Down Expand Up @@ -39,7 +44,12 @@ const columns: DataTableColumn<Inquiry>[] = [

export function InquiryTable({ inquiries }: { inquiries: Inquiry[] }) {
if (inquiries.length === 0) {
return <p className="text-sm text-muted-foreground">No open inquiries.</p>;
return (
<EmptyState
title="No open inquiries."
description="New requests from your inquiry form appear here."
/>
);
}
return (
<>
Expand Down
3 changes: 3 additions & 0 deletions src/app/dashboard/bookings/page.dom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ describe("BookingsPage", () => {
screen.getByRole("button", { name: "Inquiry form" }),
).toBeInTheDocument();
expect(screen.getByText("No open inquiries.")).toBeInTheDocument();
expect(
screen.getByText("New requests from your inquiry form appear here."),
).toBeInTheDocument();
});

it("shows the empty state with no bookings", async () => {
Expand Down
54 changes: 20 additions & 34 deletions src/app/dashboard/bookings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { Section } from "@merqo/ui";
import { PageShell } from "@/components/page-shell";
import { getVendorSession } from "@/lib/vendor-session";
import { pathWithSearch } from "@/lib/return-to";
Expand Down Expand Up @@ -51,50 +52,35 @@ export default async function BookingsPage({
description="Deposit now, balance later, for events booked ahead."
action={<NewBookingDialog />}
>
<section aria-labelledby="inquiries-heading">
<div className="flex flex-wrap items-center justify-between gap-3">
<h2 id="inquiries-heading" className="text-lg font-semibold">
Inquiries{" "}
<span className="font-normal tabular-nums text-muted-foreground">
({inquiries.length})
</span>
</h2>
<Section title={`Inquiries (${inquiries.length})`}>
<div className="flex justify-end">
<InquiryFormSettings form={inquiryForm} />
</div>
<div className="mt-3">
<InquiryTable inquiries={inquiries} />
</div>
</section>
<InquiryTable inquiries={inquiries} />
</Section>

<section className="mt-10" aria-labelledby="bookings-heading">
<h2 id="bookings-heading" className="text-lg font-semibold">
Your bookings{" "}
<span className="font-normal tabular-nums text-muted-foreground">
{result.ok ? `(${total})` : ""}
</span>
</h2>
<div className="mt-3">
<BookingFilters params={params} />
</div>
<div className="mt-4">
{result.ok ? (
<BookingTable bookings={result.rows} filtered={filtered} />
) : (
<ListError
retryHref={bookingListHref(params)}
message="Couldn’t load bookings"
/>
)}
</div>
<Section
className="mt-10"
title={result.ok ? `Your bookings (${total})` : "Your bookings"}
>
<BookingFilters params={params} />
{result.ok ? (
<BookingTable bookings={result.rows} filtered={filtered} />
) : (
<ListError
retryHref={bookingListHref(params)}
message="Couldn’t load bookings"
/>
)}
{result.ok && (
<UrlPager
label="Bookings pages"
page={params.page}
pageCount={Math.max(1, Math.ceil(total / BOOKING_PAGE_SIZE))}
pageCount={pageCount}
href={(next) => bookingListHref({ ...params, page: next })}
/>
)}
</section>
</Section>
</PageShell>
);
}
Loading