import type { EnvironmentId } from "@t3tools/contracts"; import { Globe, RadioTower } from "lucide-react"; import { Empty, EmptyDescription, EmptyMedia, EmptyTitle } from "~/components/ui/empty"; import { PreviewLocalServerCard } from "./PreviewLocalServerCard"; import { useDiscoveredLocalServers } from "./useDiscoveredLocalServers"; interface Props { environmentId: EnvironmentId; configuredUrls?: ReadonlyArray | undefined; recentlySeenUrls?: ReadonlyArray | undefined; onOpenUrl: (url: string) => void; } export function PreviewEmptyState({ environmentId, configuredUrls, recentlySeenUrls, onOpenUrl, }: Props) { const servers = useDiscoveredLocalServers({ environmentId, configuredUrls, recentlySeenUrls, }); if (servers.length === 0) { return ( No preview yet Type a URL above, or run a dev script. Listening localhost ports will show up here automatically. ); } return (

Local servers

{servers.map((server) => ( onOpenUrl(server.url)} /> ))}

Select a listening port to open it in this browser tab.

); }