polish(desktop): finish Projects navigation and context chrome (#6429)

## Summary

After #6396, Projects still split chrome across the workspace header, a
copy-link control, and a labeled Actions group that mixed people,
create, and metadata. This PR finishes that surface: the right-hand
context box is unlabeled actions plus a Details group, people stacks and
contribution heatmaps are gone from that box, Create review sits with
Create task, and the top chrome is terminal / chat / info with no
copy-link. Sent project context collapses to a pill, and review file
diffs keep the last good git view instead of flashing empty while
queries refetch.

This also lands the remaining navigation polish that followed Part 3:
overview and list presentation, readme and commit layout, and opening
the latest matching conversation from the Channels tab without leaving
the project.

### Related issue
N/A. Related: #6396

## Testing
- Walked Files, Tasks, Reviews, task/review detail, overview tabs, and
chrome chat vs info in the running desktop app
- Pre-push: desktop typecheck, unit tests, Tauri checks, and file-size
gate passed
- Updated Projects smoke specs for the new context groups, Create
review, chrome order, and removed copy-link control
- Merged current `origin/main`; one conflict in discussion-channel rows
kept conversation-panel navigation and took main's bounded channel-name
lookup

## Post-Deploy Monitoring & Validation
- validate Projects workspace chrome, context box, and review file diffs
in the first staging Desktop session
- healthy signals: context box shows unlabeled actions then Details,
chat toggle sits between terminal and info, review diffs stay populated
across selection changes
- failure signals: missing Create review, restored heatmap/people in the
context box, or empty Files Changed while the review is still selected;
mitigate by reverting this PR

---------

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
thomaspblock
2026-08-21 08:45:55 -04:00
committed by GitHub
parent 9891e64f6b
commit 9b32e055fe
70 changed files with 3935 additions and 1477 deletions

View File

@@ -48,6 +48,7 @@ import {
isImageOnlyParagraph,
markdownPropsAreEqual,
} from "./markdownUtils";
import { ImageMosaic } from "./markdown/ImageMosaic";
import {
CODE_BLOCK_CLASS,
extractLanguage,
@@ -1233,33 +1234,10 @@ function ImageBlock({ alt, dim, resolvedSrc, src, thumbSrc }: ImageBlockProps) {
);
}
function ImageMosaic({ children }: { children: React.ReactNode[] }) {
const mosaicRef = React.useRef<HTMLDivElement | null>(null);
const isTriptych = children.length === 3;
const hasOddTail = children.length > 3 && children.length % 2 === 1;
useSmoothCorners(mosaicRef);
return (
<div
className={cn(
"mt-1 grid w-full min-w-0 max-w-lg grid-cols-2 gap-1.5 overflow-hidden rounded-2xl [&_br]:hidden [&_[data-block-media]]:min-h-0 [&_[data-block-media]]:max-w-none [&_[data-block-media]]:overflow-hidden [&_[data-block-media]>button]:m-0 [&_[data-block-media]>button]:h-full [&_[data-block-media]>button]:w-full [&_[data-block-media]>button]:max-w-none [&_[data-block-media]>button]:rounded-none [&_[data-block-media]_[data-progressive-image-frame]]:!h-full [&_[data-block-media]_[data-progressive-image-frame]]:!w-full [&_[data-block-media]_img]:!h-full [&_[data-block-media]_img]:!max-h-none [&_[data-block-media]_img]:!w-full [&_[data-block-media]_img]:!max-w-none [&_[data-block-media]_img]:rounded-none [&_[data-block-media]_img]:object-cover",
isTriptych
? "h-80 grid-rows-2 [&_[data-block-media]]:h-auto [&_[data-block-media]:first-child]:row-span-2"
: "[&_[data-block-media]]:h-48",
hasOddTail && "[&_[data-block-media]:last-child]:col-span-2",
)}
data-image-mosaic=""
data-image-mosaic-count={children.length}
ref={mosaicRef}
>
{children}
</div>
);
}
export function createMarkdownComponents(
interactive = true,
mediaInset = false,
blockCode = false,
): Components {
const listItemClassName = "[&_p]:inline";
const listClassName = "space-y-1 pl-6 marker:text-muted-foreground/80";
@@ -1563,7 +1541,7 @@ export function createMarkdownComponents(
return <p>{children}</p>;
},
pre: ({ children }) => {
if (!interactive) return <span>{children}</span>;
if (!interactive && !blockCode) return <span>{children}</span>;
let language = "";
React.Children.forEach(children, (child) => {
if (
@@ -1699,9 +1677,9 @@ export function createMarkdownComponents(
}
/**
* The component map only varies by the three boolean render flags, so at most
* eight instances ever exist. Module-stable maps mean cached markdown element
* trees (see ./markdown/nodeCache.ts) never embed per-mount closures.
* The component map only varies by the four boolean render flags, so at most
* sixteen instances ever exist. Module-stable maps mean cached markdown
* element trees (see ./markdown/nodeCache.ts) never embed per-mount closures.
*/
const MARKDOWN_COMPONENT_SCHEMA_VERSION = "8";
const markdownComponentsByVariant = new Map<string, MarkdownComponentSet>();
@@ -1719,12 +1697,13 @@ function getMarkdownComponents(
interactive: boolean,
leadingInlineContent: boolean,
mediaInset: boolean,
blockCode: boolean,
): MarkdownComponentSet {
const variant = `${MARKDOWN_COMPONENT_SCHEMA_VERSION}:${interactive ? "i" : ""}${leadingInlineContent ? "l" : ""}${mediaInset ? "m" : ""}`;
const variant = `${MARKDOWN_COMPONENT_SCHEMA_VERSION}:${interactive ? "i" : ""}${leadingInlineContent ? "l" : ""}${mediaInset ? "m" : ""}${blockCode ? "c" : ""}`;
let entry = markdownComponentsByVariant.get(variant);
if (!entry) {
entry = {
components: createMarkdownComponents(interactive, mediaInset),
components: createMarkdownComponents(interactive, mediaInset, blockCode),
variant,
};
markdownComponentsByVariant.set(variant, entry);
@@ -1741,6 +1720,7 @@ function MarkdownInner({
hardLineBreaks = true,
imetaByUrl,
interactive = true,
blockCode = false,
agentMentionPubkeysByName,
leadingInlineContent,
mediaInset = false,
@@ -1856,6 +1836,7 @@ function MarkdownInner({
interactive,
hasLeadingInlineContent,
mediaInset,
blockCode,
);
const markdownNode =
configNudge === null

View File

@@ -32,3 +32,14 @@ test("channelTooltipFooter adds archived status without changing existing metada
"Private channel · Forum",
);
});
test("channelTooltipFooter uses just now for activity within a minute", () => {
assert.equal(
channelTooltipFooter({
...channel,
archivedAt: null,
lastMessageAt: new Date().toISOString(),
}),
"Private channel · Forum · Active just now",
);
});

View File

@@ -0,0 +1,28 @@
import React from "react";
import { cn } from "@/shared/lib/cn";
import { useSmoothCorners } from "@/shared/ui/smoothCorners";
/** Grid layout for messages that contain multiple standalone images. */
export function ImageMosaic({ children }: { children: React.ReactNode[] }) {
const mosaicRef = React.useRef<HTMLDivElement | null>(null);
const isTriptych = children.length === 3;
const hasOddTail = children.length > 3 && children.length % 2 === 1;
useSmoothCorners(mosaicRef);
return (
<div
className={cn(
"mt-1 grid w-full min-w-0 max-w-lg grid-cols-2 gap-1.5 overflow-hidden rounded-2xl [&_br]:hidden [&_[data-block-media]]:min-h-0 [&_[data-block-media]]:max-w-none [&_[data-block-media]]:overflow-hidden [&_[data-block-media]>button]:m-0 [&_[data-block-media]>button]:h-full [&_[data-block-media]>button]:w-full [&_[data-block-media]>button]:max-w-none [&_[data-block-media]>button]:rounded-none [&_[data-block-media]_[data-progressive-image-frame]]:!h-full [&_[data-block-media]_[data-progressive-image-frame]]:!w-full [&_[data-block-media]_img]:!h-full [&_[data-block-media]_img]:!max-h-none [&_[data-block-media]_img]:!w-full [&_[data-block-media]_img]:!max-w-none [&_[data-block-media]_img]:rounded-none [&_[data-block-media]_img]:object-cover",
isTriptych
? "h-80 grid-rows-2 [&_[data-block-media]]:h-auto [&_[data-block-media]:first-child]:row-span-2"
: "[&_[data-block-media]]:h-48",
hasOddTail && "[&_[data-block-media]:last-child]:col-span-2",
)}
data-image-mosaic=""
data-image-mosaic-count={children.length}
ref={mosaicRef}
>
{children}
</div>
);
}

View File

@@ -82,6 +82,13 @@ export type MarkdownProps = {
hardLineBreaks?: boolean;
imetaByUrl?: ImetaLookup;
interactive?: boolean;
/**
* Render fenced code as scrollable code blocks even when `interactive` is
* false. Non-interactive surfaces default to inlining code (compact
* previews); document surfaces like repository READMEs pass true so long
* lines scroll inside the block instead of stretching the layout.
*/
blockCode?: boolean;
agentMentionPubkeysByName?: Record<string, string>;
mentionNames?: string[];
mentionPubkeysByName?: Record<string, string>;

View File

@@ -111,6 +111,7 @@ export function markdownPropsAreEqual(
prev.customEmoji === next.customEmoji &&
prev.hardLineBreaks === next.hardLineBreaks &&
prev.interactive === next.interactive &&
prev.blockCode === next.blockCode &&
prev.mediaInset === next.mediaInset &&
shallowRecordEqual(
prev.agentMentionPubkeysByName,