mirror of
https://github.com/block/buzz.git
synced 2026-10-31 22:41:12 +00:00
## Summary - give inline project agents bounded visible-page and selection context while reusing the shared message-thread presentation - add contextual collaboration actions for discussing project entities in related channels - align project list metadata, context rails, and work-item communication actions with the active workspace This is Part 3 of the Projects v6 stack, following #6368. Part 4 contains the remaining navigation and detail-page polish. ## Testing - Desktop unit suite: 5,125/5,125 passed - Projects smoke specs: 62/62 passed - TypeScript, Biome, typography, pubkey, and differential file-size checks passed - full pre-push gate passed ## Post-Deploy Monitoring & Validation - validate Projects overview/detail agent chat and discuss-in-channel journeys in the first staging Desktop session - healthy signals: context matches the active project/repository/work item, messages remain in the chosen channel, and restored conversations exclude unrelated DM history - failure signals: stale or cross-project context, duplicate/missing thread rows, or collaboration actions targeting the wrong channel; mitigate by reverting this PR Related: #6335 --------- Signed-off-by: Thomas Petersen <thomasp@squareup.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import * as React from "react";
|
|
|
|
import { useAppNavigation } from "@/app/navigation/useAppNavigation";
|
|
import {
|
|
loadDraftEntry,
|
|
saveDraftEntry,
|
|
} from "@/features/messages/lib/useDrafts";
|
|
import {
|
|
mergeSelectionDiscussDraft,
|
|
projectSelectionDiscussContent,
|
|
type ProjectSelectionItem,
|
|
} from "@/features/projects/lib/projectSelection";
|
|
|
|
export function useProjectDiscussInChannel(items: ProjectSelectionItem[]) {
|
|
const { goChannel } = useAppNavigation();
|
|
|
|
return React.useCallback(
|
|
(channelId: string) => {
|
|
const now = new Date().toISOString();
|
|
const existing = loadDraftEntry(channelId);
|
|
const content = mergeSelectionDiscussDraft(
|
|
existing?.content,
|
|
projectSelectionDiscussContent(items),
|
|
);
|
|
saveDraftEntry(channelId, {
|
|
channelId,
|
|
content,
|
|
createdAt: existing?.createdAt ?? now,
|
|
mentionRefs: existing?.mentionRefs ?? [],
|
|
pendingImeta: existing?.pendingImeta ?? [],
|
|
selectionEnd: content.length,
|
|
selectionStart: content.length,
|
|
spoileredAttachmentUrls: existing?.spoileredAttachmentUrls ?? [],
|
|
status: "active",
|
|
updatedAt: now,
|
|
});
|
|
void goChannel(channelId);
|
|
},
|
|
[goChannel, items],
|
|
);
|
|
}
|