Files
buzz/desktop/src/features/channels/lib/threadPanelLayout.ts
Thomas Petersen ce1ebfe6c8 fix(desktop): name project threads after their channel and reflow commit bodies
Hard-wrapped git commit messages were rendered as chat line-breaks, so they stayed a narrow column. The conversation panel now titles itself with a clickable #channel, and the mentions card is labeled Related Conversations.

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
2026-08-14 08:49:17 -04:00

57 lines
1.7 KiB
TypeScript

import type * as React from "react";
import { THREAD_FOCUS_COLUMN_MAX_WIDTH_PX } from "@/features/channels/lib/threadFocusLayout";
export type ThreadPanelLayoutProps = {
canResetWidth?: boolean;
columnMaxWidthPx?: number;
enterMotion?: boolean;
headerLeading?: React.ReactNode;
/** Replaces the default "Thread" label. Channel threads leave this unset. */
headerTitle?: string;
headerTitleAriaLabel?: string;
isFocusMode: boolean;
isSinglePanelView?: boolean;
layout?: "standalone" | "split";
showBackButton?: boolean;
onHeaderTitleClick?: () => void;
onResetWidth?: () => void;
onResizeStart?: React.PointerEventHandler<HTMLButtonElement>;
splitPaneClamp?: boolean;
testId?: string;
transparentChrome?: boolean;
};
type ThreadPanelLayoutOptions = {
headerLeading?: React.ReactNode;
isFocusDrawer: boolean;
isSinglePanelView: boolean;
useSplitAuxiliaryPane: boolean;
};
/** Maps channel presentation into the shared thread-panel layout contract. */
export function getThreadPanelLayout({
headerLeading,
isFocusDrawer,
isSinglePanelView,
useSplitAuxiliaryPane,
}: ThreadPanelLayoutOptions): ThreadPanelLayoutProps {
return isFocusDrawer
? {
columnMaxWidthPx: THREAD_FOCUS_COLUMN_MAX_WIDTH_PX,
headerLeading,
isFocusMode: true,
isSinglePanelView: true,
layout: "standalone",
transparentChrome: false,
}
: {
columnMaxWidthPx: undefined,
headerLeading,
isFocusMode: false,
isSinglePanelView: useSplitAuxiliaryPane ? false : isSinglePanelView,
layout: useSplitAuxiliaryPane ? "split" : "standalone",
transparentChrome: useSplitAuxiliaryPane,
};
}