Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add CLI install section to download page

Richie McIlroy96dd69d9b46f
diff --git a/apps/web/components/pages/DownloadPage.tsx b/apps/web/components/pages/DownloadPage.tsx
index e9c453521..5b6a77b21 100644
--- a/apps/web/components/pages/DownloadPage.tsx
+++ b/apps/web/components/pages/DownloadPage.tsx
@@ -3,6 +3,7 @@
import { Button } from "@cap/ui";
import { useDetectPlatform } from "hooks/useDetectPlatform";
import Link from "next/link";
+import { useState } from "react";
import { trackEvent } from "@/app/utils/analytics";
import {
getDownloadButtonText,
@@ -14,8 +15,13 @@ import {
export const DownloadPage = () => {
const { platform, isIntel } = useDetectPlatform();
+ const [copiedCliCommand, setCopiedCliCommand] = useState(false);
const loading = platform === null;
const primaryDownloadUrl = getDownloadUrl(platform, isIntel);
+ const cliInstallCommand =
+ platform === "windows"
+ ? "irm https://cap.so/install-cli.ps1 | iex"
+ : "curl -fsSL https://cap.so/install-cli.sh | sh";
const trackDownloadClick = (ctaLocation: string, targetUrl: string) => {
trackEvent("download_cta_clicked", {
@@ -27,6 +33,16 @@ export const DownloadPage = () => {
});
};
+ const copyCliInstallCommand = async () => {
+ await navigator.clipboard.writeText(cliInstallCommand);
+ setCopiedCliCommand(true);
+ trackEvent("cli_install_command_copied", {
+ source_page: "download_page",
+ detected_platform: platform ?? "unknown",
+ });
+ window.setTimeout(() => setCopiedCliCommand(false), 2000);
+ };
+
return (
<div className="py-32 md:py-40 wrapper wrapper-sm">
<div className="space-y-4 text-center">
@@ -80,6 +96,34 @@ export const DownloadPage = () => {
<PlatformIcons source="download_page" />
</div>
+ <div className="mx-auto mt-6 max-w-xl fade-in-up animate-delay-2">
+ <div className="rounded-xl border border-gray-5 bg-gray-2 p-4 text-left">
+ <div className="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
+ <div>
+ <h3 className="text-sm font-medium text-gray-12">
+ Install the Cap CLI
+ </h3>
+ <p className="mt-1 text-xs leading-5 text-gray-10">
+ Already have Cap Desktop? Link the bundled CLI for agents,
+ scripts, and terminals.
+ </p>
+ </div>
+ <Button
+ type="button"
+ size="sm"
+ variant="gray"
+ onClick={copyCliInstallCommand}
+ className="shrink-0"
+ >
+ {copiedCliCommand ? "Copied" : "Copy command"}
+ </Button>
+ </div>
+ <code className="mt-3 block overflow-x-auto rounded-lg bg-gray-1 px-3 py-2 font-mono text-xs text-gray-12">
+ {cliInstallCommand}
+ </code>
+ </div>
+ </div>
+
<div className="pb-4 mt-6 fade-in-up animate-delay-2">
<h3 className="mb-2 text-base font-medium text-gray-10">
Other download options: