diff --git a/src/app/api/public/companies/list/route.ts b/src/app/api/public/companies/list/route.ts new file mode 100644 index 0000000..fafc769 --- /dev/null +++ b/src/app/api/public/companies/list/route.ts @@ -0,0 +1,29 @@ +import { NextResponse } from "next/server"; +import { createAdminClient } from "@/lib/supabase/admin"; + +// Cache aggressively — directory rarely changes, and 1k+ companies is ~50KB. +export const revalidate = 600; + +export async function GET() { + try { + const svc = createAdminClient(); + const { data } = await svc + .from("tracked_companies") + .select("company_name, slug") + .eq("directory_visible", true) + .not("slug", "is", null) + .not("company_name", "is", null); + + const rows = (data || []) + .filter((r: any) => r.company_name && r.slug) + .map((r: any) => ({ name: String(r.company_name).trim(), slug: String(r.slug) })) + .filter((r) => r.name.length >= 3); + + return NextResponse.json( + { companies: rows }, + { headers: { "Cache-Control": "public, s-maxage=600, stale-while-revalidate=1200" } }, + ); + } catch (e: any) { + return NextResponse.json({ companies: [], error: e?.message || "error" }, { status: 500 }); + } +} diff --git a/src/app/forum/thread/[id]/page.tsx b/src/app/forum/thread/[id]/page.tsx index bec39c6..32798aa 100644 --- a/src/app/forum/thread/[id]/page.tsx +++ b/src/app/forum/thread/[id]/page.tsx @@ -8,6 +8,8 @@ import AdImage from '@/components/AdImage'; import { ADS_300X250, rotateAll } from '@/lib/ads'; import { createClient } from '@/lib/supabase/client'; import SidebarAdStack from "@/components/SidebarAdStack"; +import LinkifyPlainText from "@/components/LinkifyPlainText"; +import CompanyMentionsHover from "@/components/CompanyMentionsHover"; // Inline ad slot inserted between forum replies every N posts. function InThreadAd({ adIndex }: { adIndex: number }) { @@ -368,7 +370,9 @@ export default function ForumThreadPage() { · {thread.view_count} views -

{thread.body}

+

+ +

· {timeAgo(reply.created_at)} -

{reply.body}

+

+ +