← back to Govarbitrage

src/app/agents/page.tsx

60 lines

import Link from "next/link";
import { getCurrentUser } from "@/lib/current-user";
import { LogoutButton } from "@/components/logout-button";
import { AgentFinder } from "@/components/agent-finder";

export const dynamic = "force-dynamic";

export const metadata = {
  title: "Commercial Real Estate Agents",
  description:
    "Find commercial real-estate buyer / acquisition brokers and leasing agents in any market, sourced live from Google Places — a standalone commercial-property resource.",
};

// Deep-linkable from a listing: /agents?city=…&state=…&zip=…&type=both
export default async function AgentsPage({
  searchParams,
}: {
  searchParams: Promise<{ city?: string; state?: string; zip?: string; type?: string }>;
}) {
  const [user, sp] = await Promise.all([getCurrentUser(), searchParams]);
  const type = sp.type === "buyer" || sp.type === "leasing" ? sp.type : "both";

  return (
    <main className="mx-auto max-w-[1100px] space-y-5 p-5">
      <header className="flex items-center justify-between">
        <div>
          <h1 className="text-xl font-semibold tracking-tight">
            Commercial <span className="text-primary">Agents</span>
          </h1>
          <p className="text-sm text-muted-foreground">
            Commercial-only buyer / acquisition brokers &amp; leasing agents by location — live from Google Places. A
            standalone research resource — not tied to the surplus listings on your dashboard.
          </p>
        </div>
        <nav className="flex items-center gap-4 text-sm">
          <Link href="/" className="text-primary underline-offset-4 hover:underline">
            ← Dashboard
          </Link>
          <Link href="/selling-avenues" className="text-primary underline-offset-4 hover:underline">
            Selling avenues →
          </Link>
          {user && (
            <span className="flex items-center gap-2 text-muted-foreground">
              {user.email} · {user.role}
              <LogoutButton />
            </span>
          )}
        </nav>
      </header>

      <AgentFinder
        initialCity={sp.city ?? ""}
        initialState={sp.state ?? ""}
        initialZip={sp.zip ?? ""}
        initialType={type}
      />
    </main>
  );
}