TypeScript
feat(web): simplify sidebar drag destination cues (#9750)
Julius Marminge9a47c7bd4052
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex 1a66dbdd9b5..63c7deca4c5 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -568,7 +568,6 @@ function SidebarSectionPlaceholder(props: {function SidebarDragBoundary(props: {marker: "pinned-header" | "pinned-divider";label: string;- hint: string | null;visible: boolean;isDropTarget: boolean;}) {@@ -587,7 +586,6 @@ function SidebarDragBoundary(props: {)}>{props.label}- {props.hint ? <span className="font-normal">{props.hint}</span> : null}</span><spanaria-hidden@@ -603,7 +601,6 @@ function SidebarDragBoundary(props: {function SidebarSectionHeader(props: {marker: "snoozed-header" | "settled-header";label: string;- hint?: string | null;isDropTarget?: boolean;toggle: { expanded: boolean; onToggle: () => void };}) {@@ -624,7 +621,6 @@ function SidebarSectionHeader(props: {props.isDropTarget && "bg-primary/30",)}/>- {props.hint ? <span className="truncate text-[11px] font-normal">{props.hint}</span> : null}<ChevronDownIconaria-hiddenclassName={cn(@@ -910,7 +906,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {// sortable bag applied to the row root so the whole row drags (the// pointer sensor's distance constraint keeps plain clicks working).sortable?: SortableThreadRowBag | undefined;- dropSection: SidebarSection | null;+ dropSection: Exclude<SidebarSection, "snoozed"> | null;// Compact wake countdown ("2h") for rows in the snoozed shelf.snoozeWakeLabelText: string | null;// When a snooze ended (timer or early wake); drives the Woke pill until@@ -1331,14 +1327,13 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {role="status"className="pointer-events-none ml-auto inline-flex h-5 shrink-0 items-center gap-1 rounded-sm border border-primary/30 bg-sidebar px-1.5 text-[11px] font-medium text-primary">+ <span className="sr-only">Move to </span><span aria-hidden>→</span>{props.dropSection === "pinned"? "Pinned": props.dropSection === "active"? "Active"- : props.dropSection === "settled"- ? "Settled"- : "Snoozed"}+ : "Settled"}</span>) : null;@@ -1442,31 +1437,32 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {<TooltipPopup side="top">Unsent draft</TooltipPopup></Tooltip>) : null;- const pinIndicator = props.isPinned ? (- props.pinningSupported ? (- <Tooltip>- <TooltipTrigger- render={- <button- type="button"- aria-label="Unpin thread"- onClick={handleUnpinClick}- className="inline-flex cursor-pointer items-center rounded-sm text-muted-foreground/65 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"- />- }- >- <PinIcon aria-hidden className="size-3 shrink-0" />- </TooltipTrigger>- <TooltipPopup>Unpin thread</TooltipPopup>- </Tooltip>- ) : (- <PinIcon- aria-label="Pinned"- role="img"- className="size-3 shrink-0 text-muted-foreground/65"- />- )- ) : null;+ const pinIndicator =+ props.isPinned && !sortable?.isDragging ? (+ props.pinningSupported ? (+ <Tooltip>+ <TooltipTrigger+ render={+ <button+ type="button"+ aria-label="Unpin thread"+ onClick={handleUnpinClick}+ className="inline-flex cursor-pointer items-center rounded-sm text-muted-foreground/65 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"+ />+ }+ >+ <PinIcon aria-hidden className="size-3 shrink-0" />+ </TooltipTrigger>+ <TooltipPopup>Unpin thread</TooltipPopup>+ </Tooltip>+ ) : (+ <PinIcon+ aria-label="Pinned"+ role="img"+ className="size-3 shrink-0 text-muted-foreground/65"+ />+ )+ ) : null;if (variant === "slim") {return (@@ -1526,7 +1522,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {remain visible AND clickable while the row is hovered. Onlythe time/jump label yields to the settle affordance. */}{prBadge}- {dragDestination ?? (+ {sortable?.isDragging ? (+ dragDestination+ ) : (<span className="relative ml-auto flex h-6 min-w-8 shrink-0 items-center justify-end"><spanclassName={cn(@@ -1679,7 +1677,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {actions on hover/keyboard focus or while the popover is open. Keepingthe hidden state out of flow lets the project label reclaimspace without either state overlapping it. */}- {dragDestination ?? (+ {sortable?.isDragging ? (+ dragDestination+ ) : (<span className="group/sidebar-status-slot relative ml-auto flex h-5 min-w-8 shrink-0 items-stretch justify-end text-xs">{/* Read-only status labels yield to the hover actions. Woke isitself an action, so it stays pointer-enabled and visible@@ -4534,7 +4534,11 @@ export default function Sidebar() {isPinned={thread.pinnedAt != null}sortable={sortable}dropSection={- dragState?.activeKey === threadKey ? dragTargetSection : null+ dragState?.activeKey === threadKey &&+ dragTargetSection !== dragState.activeSection &&+ dragTargetSection !== "snoozed"+ ? dragTargetSection+ : null}snoozeWakeLabelText={section === "snoozed" && thread.snoozedUntil != null@@ -4634,14 +4638,6 @@ export default function Sidebar() {dragTargetSection !== "pinned"? 1: 0);- const activeHint =- from === "pinned"- ? "Drop to unpin"- : from === "settled"- ? "Drop to un-settle"- : from === "snoozed"- ? "Drop to wake"- : null;const items: ReactNode[] = [<SidebarDraftBlockkey="draft-sessions"@@ -4667,7 +4663,6 @@ export default function Sidebar() {key="pinned-header"marker="pinned-header"label="Pinned"- hint={from !== null && from !== "pinned" ? "Drop to pin" : null}isDropTarget={dragTargetSection === "pinned"}visible={from !== null}/>,@@ -4679,7 +4674,6 @@ export default function Sidebar() {key="pinned-divider"marker="pinned-divider"label="Active"- hint={dragTargetSection === "active" ? activeHint : null}isDropTarget={dragTargetSection === "active"}visible={from !== null && previewPinnedCount > 0}/>,@@ -4690,7 +4684,7 @@ export default function Sidebar() {<SidebarSectionPlaceholderkey="active-placeholder"marker="active-placeholder"- label={activeHint ?? "Drop here"}+ label="Active"showHint={from !== null}isDropTarget={dragTargetSection === "active"}/>,@@ -4723,11 +4717,6 @@ export default function Sidebar() {? "Settled": `Settled (${settledThreads.length})`}- hint={- dragTargetSection === "settled" && from !== "settled"- ? "Drop to settle"- : null- }isDropTarget={dragTargetSection === "settled"}toggle={{expanded: settledShelfExpanded,@@ -4741,7 +4730,7 @@ export default function Sidebar() {<SidebarSectionPlaceholderkey="settled-placeholder"marker="settled-placeholder"- label="Drop to settle"+ label="Settled"showHint={from !== null && from !== "settled"}isDropTarget={dragTargetSection === "settled"}/>,diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.mdindex 5168041471d..4286ed654d8 100644--- a/docs/user/thread-sidebar.md+++ b/docs/user/thread-sidebar.md@@ -33,9 +33,11 @@ thread into the active list un-settles it. A snoozed thread can be dragged out oshelf, which wakes it, but threads cannot be dragged into the shelf because snoozing needs a waketime. Dragging a pinned thread out of the pinned section does not ask for unpin confirmation.Pinned and active boundary labels appear only while dragging, without moving the rows. The-destination boundary highlights and the thread shows which section it will land in. When there-are no pins, drag to the top edge to pin a thread. Drop instructions also appear for empty sections-and a collapsed settled shelf.+destination boundary highlights. When you cross into another section, the dragged thread shows+its destination, such as **→ Active**. Its usual pin, status, and hover actions hide during the+drag. Reordering within the same section does not show a destination badge. When there are no+pins, drag to the top edge to pin a thread. Section labels also identify empty sections and a+collapsed settled shelf.Drag within the pinned or active section to change its order. Other rows slide aside to show thespot where the thread will land. Drops into either section keep the position you choose. On