mirror of
https://github.com/block/buzz.git
synced 2026-11-28 04:01:45 +00:00
feat(projects): support multiple repositories (#4671)
## Summary - adopt the finalized NIP-MP project model so one project can enumerate and switch between multiple NIP-34 repositories - add project and repository navigation, activity summaries, existing-repository attachment, and repository access-channel management - preserve privacy-safe activation provenance for agent-authored patches, pull requests, issues, and associated commits ## Test plan - [x] Run desktop typecheck and unit tests - [x] Run focused NIP-MP, repository access, and provenance tests - [x] Run Rust formatting and desktop lint checks - [x] Run the complete pre-push suite after merging current `main` - [ ] Manually verify project creation, repository attachment, switching, and access repair on staging - [ ] Manually verify public-channel and private-agent origin labels on newly created Git activity Related: [#4695](https://github.com/block/buzz/pull/4695) --------- Signed-off-by: Thomas Petersen <thomasp@squareup.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
@@ -2,7 +2,9 @@ import {
|
||||
ChevronDown,
|
||||
Cloud,
|
||||
DownloadCloud,
|
||||
ExternalLink,
|
||||
GitBranch,
|
||||
Globe,
|
||||
HardDrive,
|
||||
Loader2,
|
||||
Plus,
|
||||
@@ -23,6 +25,7 @@ import {
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/shared/ui/dropdown-menu";
|
||||
import { GitHubMark } from "./GitHubMark";
|
||||
import { PROJECT_PANEL_ACTION_BUTTON_CLASS } from "./projectPanelStyles";
|
||||
|
||||
/** Branch picker shared by the readme and files panel headers. */
|
||||
@@ -181,6 +184,8 @@ export type RepoSourceHeaderControls = {
|
||||
localDisabled: boolean;
|
||||
localLabel: string;
|
||||
remoteLabel: string;
|
||||
remoteKind?: "buzz" | "external";
|
||||
externalUrl?: string | null;
|
||||
/** Clones the repository when no local checkout is available. */
|
||||
onCloneLocal?: () => void;
|
||||
clonePending?: boolean;
|
||||
@@ -213,7 +218,13 @@ export function RepoSourceDropdown({
|
||||
}) {
|
||||
const isLocal = controls.source === "local";
|
||||
const cloneLocal = controls.localDisabled && controls.onCloneLocal;
|
||||
const SourceIcon = isLocal ? HardDrive : Cloud;
|
||||
const RemoteIcon =
|
||||
controls.remoteKind === "external"
|
||||
? controls.remoteLabel === "github.com"
|
||||
? GitHubMark
|
||||
: Globe
|
||||
: Cloud;
|
||||
const SourceIcon = isLocal ? HardDrive : RemoteIcon;
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -238,7 +249,7 @@ export function RepoSourceDropdown({
|
||||
value={controls.source}
|
||||
>
|
||||
<DropdownMenuRadioItem value="remote">
|
||||
<Cloud className="mr-1.5 h-3.5 w-3.5 text-muted-foreground" />
|
||||
<RemoteIcon className="mr-1.5 h-3.5 w-3.5 text-muted-foreground" />
|
||||
{controls.remoteLabel}
|
||||
</DropdownMenuRadioItem>
|
||||
{!cloneLocal ? (
|
||||
@@ -280,6 +291,23 @@ export function RepoSyncActionButton({
|
||||
}: {
|
||||
controls: RepoSourceHeaderControls;
|
||||
}) {
|
||||
if (controls.remoteKind === "external") {
|
||||
return controls.externalUrl ? (
|
||||
<Button
|
||||
asChild
|
||||
className={PROJECT_PANEL_ACTION_BUTTON_CLASS}
|
||||
size="sm"
|
||||
title={`Open repository on ${controls.remoteLabel}`}
|
||||
variant="ghost"
|
||||
>
|
||||
<a href={controls.externalUrl} rel="noreferrer" target="_blank">
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
Open
|
||||
</a>
|
||||
</Button>
|
||||
) : null;
|
||||
}
|
||||
|
||||
const pull = controls.canPull && controls.onPull;
|
||||
const push = controls.canPush && controls.onPush;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user