feat: redesign CMS and unify German admin UI
This commit is contained in:
@@ -4,7 +4,7 @@ import { customerBookingView, type CustomerBooking } from "./customerView";
|
||||
|
||||
/**
|
||||
* These are called only after the caller has already verified who the
|
||||
* current customer is (see lib/auth/customer.ts) — the `where: { user }`
|
||||
* current customer is (see lib/auth/customer.ts) - the `where: { user }`
|
||||
* filter below is what actually scopes results to that one customer.
|
||||
*/
|
||||
export const getCustomerBookings = cache(async (customerId: number): Promise<CustomerBooking[]> => {
|
||||
|
||||
@@ -19,7 +19,7 @@ const WEEKDAY_BY_INDEX = [
|
||||
// and writes here go through Intl's Berlin timezone data (not local Date
|
||||
// accessors, and not manual UTC+1/+2 arithmetic), so the server process's
|
||||
// own timezone (this app runs in UTC in production) never leaks into the
|
||||
// computed availability — see lib/calendar/timezone.ts for the same pattern.
|
||||
// computed availability - see lib/calendar/timezone.ts for the same pattern.
|
||||
function dateKey(date: Date): string {
|
||||
const { year, month, day } = berlinParts(date);
|
||||
return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||
@@ -31,7 +31,7 @@ function calendarDate(date: Date): CalendarDate {
|
||||
}
|
||||
|
||||
function addCalendarDays({ year, month, day }: CalendarDate, delta: number): CalendarDate {
|
||||
// Pure calendar-rollover arithmetic (month/year boundaries) — no timezone
|
||||
// Pure calendar-rollover arithmetic (month/year boundaries) - no timezone
|
||||
// conversion happens here, so using the UTC constructor is safe and simple.
|
||||
const utc = new Date(Date.UTC(year, month - 1, day + delta));
|
||||
return { year: utc.getUTCFullYear(), month: utc.getUTCMonth() + 1, day: utc.getUTCDate() };
|
||||
@@ -58,7 +58,7 @@ function overlaps(aStart: Date, aEnd: Date, bStart: Date, bEnd: Date): boolean {
|
||||
/**
|
||||
* Computes bookable slots for one offer across a date range, from the
|
||||
* configured weekly Availability (plus per-date AvailabilityOverrides),
|
||||
* minus anything already pending/confirmed on Anna's schedule — she can
|
||||
* minus anything already pending/confirmed on Anna's schedule - she can
|
||||
* only do one thing at a time, regardless of which offer it's for.
|
||||
*/
|
||||
export async function getAvailableSlots(
|
||||
|
||||
Reference in New Issue
Block a user