Skip to content

Commit 7239ae7

Browse files
committed
feat: fix config crash, add global tenant switcher, and schema-driven config forms
- Fix Application error: listModules() was calling .map() on { data: [...] } object Updated ModuleSummary interface and listModules() return type to ListModulesResponse - Add global TenantContext with localStorage persistence across page refreshes - Add tenant switcher dropdown in header: shows active tenant (Acme Corp / acme-corp), search, avatar initials, and persists selection — switching it updates all pages - Build schema-driven config form renderer using x-ui hints from the API schema: * toggle for booleans (autoConfirm) * visual slider with numeric input for bounded integers (slotDurationMinutes, bufferMinutes) * number input for unbounded integers (maxBookingsPerDay, advanceBookingDays) * nested collapsible section for objects (cancellationPolicy) - Config page: Form/JSON view toggle, module pill buttons, tenant context sync - Tenant config page: same schema form treatment - Bookings/Keys pages auto-select tenant from global context on mount - Sidebar: updated to better icons (KeyRound, CalendarCheck2, SlidersHorizontal, Plug2)
1 parent 37f16f0 commit 7239ae7

12 files changed

Lines changed: 1095 additions & 251 deletions

File tree

apps/management-ui/app/bookings/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
"use client";
1010

11-
import { useState } from "react";
11+
import { useState, useEffect } from "react";
1212
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
13+
import { useTenant } from "@/lib/context/tenant-context";
1314
import { useForm } from "react-hook-form";
1415
import { zodResolver } from "@hookform/resolvers/zod";
1516
import { z } from "zod";
@@ -62,7 +63,12 @@ const statusFilterOptions = [
6263
export default function BookingsPage() {
6364
const { toast } = useToast();
6465
const qc = useQueryClient();
65-
const [selectedTenantId, setSelectedTenantId] = useState("");
66+
const { activeTenant } = useTenant();
67+
const [selectedTenantId, setSelectedTenantId] = useState(activeTenant?.id ?? "");
68+
69+
useEffect(() => {
70+
if (activeTenant?.id) { setSelectedTenantId(activeTenant.id); setPage(0); }
71+
}, [activeTenant?.id]);
6672
const [statusFilter, setStatusFilter] = useState("");
6773
const [createOpen, setCreateOpen] = useState(false);
6874
const [cancelTarget, setCancelTarget] = useState<Booking | null>(null);

0 commit comments

Comments
 (0)