@@ -16,7 +16,12 @@ import { TaskOrganizationErrorBoundary } from "./TaskOrganizationErrorBoundary"
1616import { TaskOrganizationDndSurface } from "./TaskOrganizationDndSurface"
1717import { DraggableTaskEntry } from "./DraggableTaskEntry"
1818import { ManualFolderItem , ManualFolderMemberItem } from "./ManualFolderItem"
19- import { buildGroupedOrganizationProjection , resolveOrganizationUnit } from "./taskOrganizationModel"
19+ import {
20+ buildGroupedOrganizationProjection ,
21+ buildCanonicalTarget ,
22+ resolveOrganizationUnit ,
23+ } from "./taskOrganizationModel"
24+ import { PinnedHistoryItem } from "./PinnedHistoryItem"
2025import { UNFILED_DROP_ZONE_ID } from "./useTaskOrganizationDnd"
2126import type { ActiveDragState , DndItemData } from "./useTaskOrganizationDnd"
2227
@@ -98,6 +103,23 @@ const HistoryPreviewInner = memo(() => {
98103 [ organization , groups , tasks , cwd ] ,
99104 )
100105
106+ // Pinned shortcuts section, mirroring HistoryView's pinned header: pins
107+ // follow the same workspace scoping as the projection (a folder whose
108+ // members all belong to another workspace is not visible here; task pins
109+ // resolve to their canonical group root within the visible tasks).
110+ const visiblePins = useMemo (
111+ ( ) =>
112+ organization . pins . filter ( ( pin ) => {
113+ const target = pin . target
114+ if ( target . kind === "folder" ) {
115+ return projection . folderProjections . some ( ( p ) => p . folderId === target . folderId )
116+ }
117+ const rootId = target . kind === "task" ? buildCanonicalTarget ( target . taskId , groups ) : target . rootTaskId
118+ return tasks . some ( ( x ) => x . id === rootId )
119+ } ) ,
120+ [ organization . pins , projection . folderProjections , groups , tasks ] ,
121+ )
122+
101123 // Resolve a human-readable label for the drag overlay.
102124 const resolveDragLabel = useCallback (
103125 ( activeDrag : ActiveDragState ) : React . ReactNode => {
@@ -140,6 +162,45 @@ const HistoryPreviewInner = memo(() => {
140162 < div className = "flex flex-col gap-1" >
141163 < UnfiledDropZone visible = { isFolderMemberDragActive } disabled = { false } />
142164
165+ { /* Pinned shortcuts (same section as History's pinned header) */ }
166+ { visiblePins . length > 0 && (
167+ < div className = "flex flex-col gap-1 m-2" data-testid = "preview-pinned-section" >
168+ { visiblePins . map ( ( pin ) => {
169+ const target = pin . target
170+ if ( target . kind === "folder" ) {
171+ const folder = organization . folders . find ( ( f ) => f . folderId === target . folderId )
172+ return (
173+ < PinnedHistoryItem
174+ key = { `preview-pin-folder-${ target . folderId } ` }
175+ folderName = { folder ?. name ?? target . folderId }
176+ isPinned
177+ canPin = { canPin }
178+ onTogglePin = { ( ) => void togglePin ( target ) }
179+ data-testid = { `preview-pinned-folder-${ target . folderId } ` }
180+ />
181+ )
182+ }
183+ const rootId =
184+ target . kind === "task"
185+ ? buildCanonicalTarget ( target . taskId , groups )
186+ : target . rootTaskId
187+ const unit = resolveOrganizationUnit ( rootId , tasks )
188+ const rootTask = tasks . find ( ( x ) => x . id === unit . rootTaskId )
189+ return (
190+ < PinnedHistoryItem
191+ key = { `preview-pin-unit-${ unit . rootTaskId } ` }
192+ unit = { unit }
193+ label = { rootTask ?. task ?? unit . rootTaskId }
194+ isPinned
195+ canPin = { canPin }
196+ onTogglePin = { ( ) => void togglePin ( target ) }
197+ data-testid = { `preview-pinned-unit-${ unit . rootTaskId } ` }
198+ />
199+ )
200+ } ) }
201+ </ div >
202+ ) }
203+
143204 { /* Manual Folders */ }
144205 { projection . folderProjections . map ( ( folder ) => (
145206 < ManualFolderItem
0 commit comments