mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
32ac8e73fd
* Fix Biome lint violations and add Biome CI check Biome was not configured to respect .gitignore, so ~92% of the 13,355 reported diagnostics came from gitignored build artifacts. Enable VCS integration (useIgnoreFile), apply safe auto-fixes across the repo, fix the remaining mechanical errors by hand, downgrade judgment-call a11y / dangerouslySetInnerHTML rules to warnings, and add a 'biome ci' job to the Lint workflow so violations block PRs going forward. * Use an empty changeset (no behavior change, no release needed)
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
'use client';
|
|
|
|
import { Button } from '@vercel/geistdocs/components/button';
|
|
import { CheckIcon, CopyIcon } from 'lucide-react';
|
|
import { useState } from 'react';
|
|
|
|
function CopyButton({ text }: { text: string }) {
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
const handleCopy = () => {
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
setCopied(true);
|
|
setTimeout(() => setCopied(false), 2000);
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className="size-6 shrink-0"
|
|
onClick={handleCopy}
|
|
>
|
|
{copied ? (
|
|
<CheckIcon className="size-3" />
|
|
) : (
|
|
<CopyIcon className="size-3" />
|
|
)}
|
|
<span className="sr-only">Copy</span>
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
export function PreviewInstall({ deploymentUrl }: { deploymentUrl: string }) {
|
|
const baseUrl = deploymentUrl.replace(/\/$/, '');
|
|
const installCmd = `pnpm i ${baseUrl}/workflow.tgz`;
|
|
const npxCmd = `npx workflow@${baseUrl}/workflow.tgz web`;
|
|
|
|
return (
|
|
<div className="space-y-3">
|
|
<div className="space-y-1.5">
|
|
<p className="text-sm text-muted-foreground">
|
|
Install the workflow package from this preview:
|
|
</p>
|
|
<div className="flex items-center gap-2 rounded-md border bg-muted/50 px-3 py-2">
|
|
<code className="flex-1 text-xs break-all font-mono">
|
|
{installCmd}
|
|
</code>
|
|
<CopyButton text={installCmd} />
|
|
</div>
|
|
</div>
|
|
<div className="space-y-1.5">
|
|
<p className="text-sm text-muted-foreground">
|
|
Run the web UI in your project:
|
|
</p>
|
|
<div className="flex items-center gap-2 rounded-md border bg-muted/50 px-3 py-2">
|
|
<code className="flex-1 text-xs break-all font-mono">{npxCmd}</code>
|
|
<CopyButton text={npxCmd} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|