mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-05-02 19:31:15 +00:00
This commit introduces Vercel integration, enabling users to deploy projects directly to Vercel. It includes: - New Vercel types and store for managing connections and stats. - A VercelConnection component for managing Vercel account connections. - A VercelDeploymentLink component for displaying deployment links. - API routes for handling Vercel deployments. - Updates to the HeaderActionButtons component to support Vercel deployment. The integration allows users to connect their Vercel accounts, view project stats, and deploy projects with ease.
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { useStore } from '@nanostores/react';
|
|
import { netlifyConnection, fetchNetlifyStats } from '~/lib/stores/netlify';
|
|
import { chatId } from '~/lib/persistence/useChatHistory';
|
|
import * as Tooltip from '@radix-ui/react-tooltip';
|
|
import { useEffect } from 'react';
|
|
|
|
export function NetlifyDeploymentLink() {
|
|
const connection = useStore(netlifyConnection);
|
|
const currentChatId = useStore(chatId);
|
|
|
|
useEffect(() => {
|
|
if (connection.token && currentChatId) {
|
|
fetchNetlifyStats(connection.token);
|
|
}
|
|
}, [connection.token, currentChatId]);
|
|
|
|
const deployedSite = connection.stats?.sites?.find((site) => site.name.includes(`bolt-diy-${currentChatId}`));
|
|
|
|
if (!deployedSite) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Tooltip.Provider>
|
|
<Tooltip.Root>
|
|
<Tooltip.Trigger asChild>
|
|
<a
|
|
href={deployedSite.url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="inline-flex items-center justify-center w-8 h-8 rounded hover:bg-bolt-elements-item-backgroundActive text-bolt-elements-textSecondary hover:text-[#00AD9F] z-50"
|
|
onClick={(e) => {
|
|
e.stopPropagation(); // This is to prevent click from bubbling up
|
|
}}
|
|
>
|
|
<div className="i-ph:link w-4 h-4 hover:text-blue-400" />
|
|
</a>
|
|
</Tooltip.Trigger>
|
|
<Tooltip.Portal>
|
|
<Tooltip.Content
|
|
className="px-3 py-2 rounded bg-bolt-elements-background-depth-3 text-bolt-elements-textPrimary text-xs z-50"
|
|
sideOffset={5}
|
|
>
|
|
{deployedSite.url}
|
|
<Tooltip.Arrow className="fill-bolt-elements-background-depth-3" />
|
|
</Tooltip.Content>
|
|
</Tooltip.Portal>
|
|
</Tooltip.Root>
|
|
</Tooltip.Provider>
|
|
);
|
|
}
|