mirror of
https://github.com/block/buzz.git
synced 2026-11-01 23:11:58 +00:00
## Summary - Makes Projects repository-aware across browsing, branch and tag selection, local and remote source management, work items, commits, and contextual repository actions. - Refines project details into consistent single-column reading surfaces with a resizable, section-aware context pod, while keeping project conversations available in the attached chat panel. - Adds persistent sidebar project navigation, direct entity links, repository discussion channels, contributor identity matching, and consistent loading and activity presentation. - Keeps branch-specific controls on code-oriented sections while Tasks, Reviews, and Channels remain repository-scoped, reducing misleading context and actions. Replacement for #5981 with an identical final tree flattened into one signed-off commit because the required DCO check suite remained stalled. ### Related issue N/A ### Testing - [x] Desktop pre-push checks, TypeScript typecheck, and unit tests - [x] E2E production build with `pnpm build:e2e` - [x] Focused Playwright smoke coverage for project workspace, task, review, commit, sidebar, and contextual-panel behavior - [ ] Attach final before/after screenshots after design review --------- Signed-off-by: Thomas Petersen <thomasp@squareup.com> Signed-off-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz> Co-authored-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz>
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
|
import { relayClient } from "@/shared/api/relayClient";
|
|
import { signRelayEvent } from "@/shared/api/tauri";
|
|
import { KIND_GIT_ISSUE } from "@/shared/constants/kinds";
|
|
import type { Repository as Project } from "./hooks";
|
|
import { buildGitIssueTags } from "./projectIssues.mjs";
|
|
import type { ProjectTaskCategory } from "./projectTaskCategories";
|
|
|
|
type CreateProjectIssueInput = {
|
|
title: string;
|
|
body: string;
|
|
category?: ProjectTaskCategory;
|
|
};
|
|
|
|
export async function publishProjectIssue(
|
|
project: Project,
|
|
input: CreateProjectIssueInput,
|
|
) {
|
|
const event = await signRelayEvent({
|
|
kind: KIND_GIT_ISSUE,
|
|
content: input.body.trim(),
|
|
tags: buildGitIssueTags({
|
|
repoAddress: project.repoAddress,
|
|
repoOwner: project.owner,
|
|
title: input.title,
|
|
labels: [input.category ?? "issue"],
|
|
}),
|
|
});
|
|
await relayClient.publishEvent(
|
|
event,
|
|
"Timed out creating task.",
|
|
"Failed to create task.",
|
|
);
|
|
return event.id;
|
|
}
|
|
|
|
export function useCreateProjectIssueMutation(
|
|
project: Project | null | undefined,
|
|
) {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: (input: CreateProjectIssueInput) => {
|
|
if (!project) throw new Error("No project selected.");
|
|
return publishProjectIssue(project, input);
|
|
},
|
|
onSuccess: async () => {
|
|
await Promise.all([
|
|
queryClient.invalidateQueries({
|
|
queryKey: ["project", project?.id ?? "none", "issues"],
|
|
}),
|
|
queryClient.invalidateQueries({
|
|
queryKey: ["projects", "work-items"],
|
|
}),
|
|
queryClient.invalidateQueries({
|
|
queryKey: ["projects", "activity-summaries"],
|
|
}),
|
|
]);
|
|
},
|
|
});
|
|
}
|