import { useStore } from '@nanostores/react'; import { cloudflareConnection, fetchCloudflareProjects } from '~/lib/stores/cloudflare'; import { chatId } from '~/lib/persistence/useChatHistory'; import * as Tooltip from '@radix-ui/react-tooltip'; import { useEffect } from 'react'; export function CloudflareDeploymentLink() { const connection = useStore(cloudflareConnection); const currentChatId = useStore(chatId); useEffect(() => { if (connection.token && connection.accountId) { fetchCloudflareProjects(connection.token, connection.accountId); } }, [connection.token, connection.accountId]); const project = connection.projects?.find((p) => p.name.includes(`bolt-diy-${currentChatId}`)); if (!project) { return null; } const url = project.subdomain ? `https://${project.subdomain}` : `https://${project.name}.pages.dev`; return ( { e.stopPropagation(); }} >
{url} ); }