import { Popover } from '@base-ui/react/popover'; import { CheckIcon, ChevronDownIcon, CodeIcon, CopyIcon } from 'lucide-react'; import { useState } from 'react'; import { Button } from '#/components/atoms/button.jsx'; import { account, repoRecord } from '#/lib/git.js'; import { cn } from '#/lib/utils.js'; /** * The clone URLs this repository answers on, behind a Code button. The * atproto remote always works wherever the helper is installed. The https * remote appears only where the deploy found the read-only smart HTTP * endpoint switched on, and never for a repository in a space, which the * read-only surface does not serve. */ export function CodeMenu({ repo, httpClone, space }) { const [copied, setCopied] = useState(''); const record = repoRecord(repo, space); const remotes = []; if (httpClone && !space) { remotes.push({ label: 'HTTPS', url: `${account.pds}/git/${account.handle}/${repo}`, note: 'stock git, read only', }); } remotes.push({ label: 'atproto', url: typeof record?.cloneUrl === 'string' ? record.cloneUrl : `atproto://${account.handle}/${repo}`, note: space ? 'push and fetch with the helper, as someone added to it' : 'push and fetch with the helper', }); return ( {/* The same control the ref picker is. Cloning is the one thing this page offers, but a filled button for it would be the only loud surface on a page of flat panels. */} {/* The word goes where the bar is short, so the tabs beside it keep their room. The icon still says what it opens. */} Clone Clone this repository
{remotes.map((remote) => (
{remote.label} {remote.note}
git clone {remote.url}
))}
); }