feat: flip routing — customer portal at /, admin at /admin (#57)
* feat: flip routing — customer portal at /, admin at /admin Move all admin dashboard routes under /admin prefix and mount the customer portal at root (/). This gives customers clean, shareable URLs while staff bookmark /admin. - Admin routes: /admin, /admin/clients, /admin/services, etc. - Customer portal: / (root) - Admin nav "Customer Portal" link points to / for staff preview - Updated tests for new route structure and fixed React 19 act compat Closes #56 Co-Authored-By: Paperclip <noreply@paperclip.ing> * fix(e2e): update tests for routing flip — admin at /admin, portal at / All E2E tests now use /admin prefix for admin routes (clients, services, staff, invoices, reports, book). Adds customer portal smoke test at /. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e): use specific locator for customer portal test getByText('Paws & Reflect') matched 3 elements causing strict mode violation. Scope to navigation role for unique match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Groom Book CTO <cto@groombook.dev> Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #57.
This commit is contained in:
committed by
GitHub
parent
1136824fe3
commit
c901b1135d
+19
-13
@@ -10,14 +10,14 @@ import { GroupBookingPage } from "./pages/GroupBooking.js";
|
||||
import { CustomerPortal } from "./portal/CustomerPortal.js";
|
||||
|
||||
const NAV_LINKS = [
|
||||
{ to: "/", label: "Appointments" },
|
||||
{ to: "/clients", label: "Clients" },
|
||||
{ to: "/services", label: "Services" },
|
||||
{ to: "/staff", label: "Staff" },
|
||||
{ to: "/invoices", label: "Invoices" },
|
||||
{ to: "/group-bookings", label: "Group Bookings" },
|
||||
{ to: "/reports", label: "Reports" },
|
||||
{ to: "/portal", label: "Customer Portal" },
|
||||
{ to: "/admin", label: "Appointments" },
|
||||
{ to: "/admin/clients", label: "Clients" },
|
||||
{ to: "/admin/services", label: "Services" },
|
||||
{ to: "/admin/staff", label: "Staff" },
|
||||
{ to: "/admin/invoices", label: "Invoices" },
|
||||
{ to: "/admin/group-bookings", label: "Group Bookings" },
|
||||
{ to: "/admin/reports", label: "Reports" },
|
||||
{ to: "/", label: "Customer Portal" },
|
||||
];
|
||||
|
||||
function AdminLayout() {
|
||||
@@ -36,7 +36,7 @@ function AdminLayout() {
|
||||
>
|
||||
<strong style={{ marginRight: "1rem", fontSize: 16 }}>Groom Book</strong>
|
||||
<Link
|
||||
to="/book"
|
||||
to="/admin/book"
|
||||
style={{
|
||||
padding: "0.35rem 0.75rem",
|
||||
borderRadius: 4,
|
||||
@@ -52,7 +52,9 @@ function AdminLayout() {
|
||||
</Link>
|
||||
{NAV_LINKS.map(({ to, label }) => {
|
||||
const active =
|
||||
to === "/" ? location.pathname === "/" : location.pathname.startsWith(to);
|
||||
to === "/admin"
|
||||
? location.pathname === "/admin"
|
||||
: location.pathname.startsWith(to);
|
||||
return (
|
||||
<Link
|
||||
key={to}
|
||||
@@ -91,9 +93,13 @@ function AdminLayout() {
|
||||
export function App() {
|
||||
const location = useLocation();
|
||||
|
||||
if (location.pathname.startsWith("/portal")) {
|
||||
return <CustomerPortal />;
|
||||
if (location.pathname.startsWith("/admin")) {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/admin/*" element={<AdminLayout />} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
return <AdminLayout />;
|
||||
return <CustomerPortal />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user