From 6eb4852e9d3304709b4f6927e483112badf1524e Mon Sep 17 00:00:00 2001 From: Esdras Renan Date: Fri, 10 Oct 2025 11:10:41 -0300 Subject: [PATCH] ui(machines): breadcrumbs show hostname; remove dev debug footer from sidebar; prep list search virtualization via name --- src/app/admin/machines/[id]/page.tsx | 20 ++++++++++++++++---- src/components/app-sidebar.tsx | 25 +------------------------ 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/app/admin/machines/[id]/page.tsx b/src/app/admin/machines/[id]/page.tsx index 9239f0b..3ba7eb1 100644 --- a/src/app/admin/machines/[id]/page.tsx +++ b/src/app/admin/machines/[id]/page.tsx @@ -1,18 +1,30 @@ +"use client" + import Link from "next/link" +import { useMemo } from "react" +import { useQuery } from "convex/react" +import type { Id } from "@/convex/_generated/dataModel" import { AppShell } from "@/components/app-shell" import { SiteHeader } from "@/components/site-header" import { DEFAULT_TENANT_ID } from "@/lib/constants" import { AdminMachineDetailsClient } from "@/components/admin/machines/admin-machine-details.client" +import { api } from "@/convex/_generated/api" +import { useAuth } from "@/lib/auth-client" export const runtime = "nodejs" export const dynamic = "force-dynamic" export default function AdminMachineDetailsPage({ params }: { params: { id: string } }) { const { id } = params + const { convexUserId } = useAuth() + const machines = useQuery( + convexUserId ? api.machines.listByTenant : "skip", + convexUserId ? { tenantId: DEFAULT_TENANT_ID, includeMetadata: false } : ("skip" as const) + ) as Array<{ _id: Id<"machines">; hostname: string }> | undefined + const hostname = useMemo(() => machines?.find((m) => m._id === (id as unknown as Id<"machines">))?.hostname ?? "Hostname", [machines, id]) + return ( - } - > + }>
diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index edc6784..847efab 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -214,30 +214,7 @@ export function AppSidebar({ ...props }: React.ComponentProps) { }} /> )} - {process.env.NODE_ENV !== "production" ? ( -
-
- Dev - {isStaff ? "staff" : "guest"} -
-
-
- role: - {(session?.user as any)?.role ?? "(none)"} -
-
- convexUserId: - {convexUserId ?? "(null)"} -
- {process.env.NEXT_PUBLIC_CONVEX_URL ? ( -
- convex: - {process.env.NEXT_PUBLIC_CONVEX_URL} -
- ) : null} -
-
- ) : null} + {/* Dev debug removido */}