"use client"; import * as Icons from "lucide-react"; import Link from "next/link"; import { ArrowUpRight } from "lucide-react"; import { useTheme } from "next-themes"; import { cn } from "@/lib/utils"; export type AppTile = { id: string; title: string; description: string; category: string; icon: string; accent: string; href: string; featured?: boolean; /** Open in a new tab. Defaults to false — task-style apps replace the current tab so the browser back button works naturally. Set true for long-running sessions like the chat tile. */ newTab?: boolean; /** Visual kind. "tool" (default) is a normal app tile. "cta" renders a dashed-border invitation card visually distinct from the tools. */ kind?: "tool" | "cta"; }; const accentVar = (accent: string) => `var(--color-accent-${accent})`; export function Tile({ app }: { app: AppTile }) { const { resolvedTheme } = useTheme(); const LucideIcon = (Icons[app.icon as keyof typeof Icons] as React.ComponentType<{ className?: string; }>) ?? Icons.Sparkles; const isExternal = app.href.startsWith("http"); const isDisabled = app.href === "#"; // Append current theme to internal-app URLs so they pick up the same scheme. const isInternalApp = isExternal && app.href.includes(".klas.chat"); const hrefWithTheme = (() => { if (!isInternalApp || !resolvedTheme) return app.href; try { const u = new URL(app.href); u.searchParams.set("theme", resolvedTheme); return u.toString(); } catch { return app.href; } })(); const isCta = app.kind === "cta"; const content = isCta ? ( // ─── CTA / "request a new tool" — visually distinct ───
{app.description}
{app.description}