@@ -44,13 +44,15 @@ import {
4444 ThreadListV2SettledShelfHeader ,
4545 ThreadListV2ShowMoreRow ,
4646 ThreadListV2SnoozedShelfHeader ,
47+ ThreadListV2WorkingShelfHeader ,
4748} from "../threads/thread-list-v2-items" ;
4849import { useThreadRowProviderInstanceResolver } from "../threads/thread-provider-instance" ;
4950import {
5051 buildThreadListV2Items ,
5152 getThreadListV2OrderedSection ,
5253 buildThreadListV2ListItems ,
5354 threadListV2ListItemsAreEqual ,
55+ threadListInboxReturns ,
5456 THREAD_LIST_V2_SETTLED_INITIAL_COUNT ,
5557 THREAD_LIST_V2_SETTLED_PAGE_COUNT ,
5658 type ThreadListV2ListItem ,
@@ -466,8 +468,11 @@ export function HomeScreen(props: HomeScreenProps) {
466468 loaded : shelfPreferencesLoaded ,
467469 settledShelfExpanded,
468470 snoozedShelfExpanded,
471+ workingShelfEnabled,
472+ workingShelfExpanded,
469473 toggleSettledShelf,
470474 toggleSnoozedShelf,
475+ toggleWorkingShelf,
471476 } = useThreadListV2ShelfPreferences ( ) ;
472477 // The queued-start and snooze helpers need a clock while the list stays open.
473478 const [ nowMinute , setNowMinute ] = useState ( ( ) => new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) ) ;
@@ -520,8 +525,13 @@ export function HomeScreen(props: HomeScreenProps) {
520525 queuedThreadKeys,
521526 } ) ,
522527 } ) ;
523- return new Map ( [ ...sectionAvailability ( "pinned" ) , ...sectionAvailability ( "active" ) ] ) ;
528+ // The Working beta orders the inbox by time, so only pins can move.
529+ return new Map ( [
530+ ...sectionAvailability ( "pinned" ) ,
531+ ...( workingShelfEnabled ? [ ] : sectionAvailability ( "active" ) ) ,
532+ ] ) ;
524533 } , [
534+ workingShelfEnabled ,
525535 pinReorderEnvironmentIds ,
526536 activeReorderEnvironmentIds ,
527537 props . threads ,
@@ -533,6 +543,7 @@ export function HomeScreen(props: HomeScreenProps) {
533543 snoozeWakeTick ,
534544 ] ) ;
535545 const threadListV2Layout = useMemo ( ( ) => {
546+ threadListInboxReturns . observe ( workingShelfEnabled ? props . threads : null ) ;
536547 // Settled threads are live shells; archived threads keep their original
537548 // "hidden from lists" meaning.
538549 return buildThreadListV2Items ( {
@@ -547,11 +558,16 @@ export function HomeScreen(props: HomeScreenProps) {
547558 queuedThreadKeys,
548559 settledLimit : settledVisibleCount ,
549560 now : new Date ( ) . toISOString ( ) ,
561+ workingShelfEnabled,
562+ workingShelfExpanded,
563+ inboxReturnAt : threadListInboxReturns . returnedAt ,
550564 snoozedShelfExpanded,
551565 settledShelfExpanded,
552566 selectedThreadKey : null ,
553567 } ) ;
554568 } , [
569+ workingShelfEnabled ,
570+ workingShelfExpanded ,
555571 pendingOrder ,
556572 queuedThreadKeys ,
557573 nowMinute ,
@@ -606,6 +622,9 @@ export function HomeScreen(props: HomeScreenProps) {
606622 buildThreadListV2ListItems ( {
607623 items : threadListV2Layout . items ,
608624 pendingTasks : v2PendingTasks ,
625+ workingCount : threadListV2Layout . workingCount ,
626+ workingShelfExpanded,
627+ workingShelfHeaderIndex : threadListV2Layout . workingShelfHeaderIndex ,
609628 snoozedCount : threadListV2Layout . snoozedCount ,
610629 snoozedShelfExpanded,
611630 snoozedShelfHeaderIndex : threadListV2Layout . snoozedShelfHeaderIndex ,
@@ -628,6 +647,7 @@ export function HomeScreen(props: HomeScreenProps) {
628647 snoozeEnvironmentIds ,
629648 threadListV2Layout ,
630649 v2PendingTasks ,
650+ workingShelfExpanded ,
631651 ] ,
632652 ) ;
633653
@@ -662,6 +682,16 @@ export function HomeScreen(props: HomeScreenProps) {
662682 />
663683 ) ;
664684 }
685+ if ( item . type === "v2-working-shelf" ) {
686+ return (
687+ < ThreadListV2WorkingShelfHeader
688+ count = { item . count }
689+ disabled = { item . disabled }
690+ expanded = { item . expanded }
691+ onToggle = { toggleWorkingShelf }
692+ />
693+ ) ;
694+ }
665695 if ( item . type === "v2-snoozed-shelf" ) {
666696 return (
667697 < ThreadListV2SnoozedShelfHeader
@@ -730,7 +760,7 @@ export function HomeScreen(props: HomeScreenProps) {
730760 reorderSupported = {
731761 item . item . pinned
732762 ? pinReorderEnvironmentIds . has ( thread . environmentId )
733- : activeReorderEnvironmentIds . has ( thread . environmentId )
763+ : ! workingShelfEnabled && activeReorderEnvironmentIds . has ( thread . environmentId )
734764 }
735765 canMoveUp = { item . canMoveUp }
736766 canMoveDown = { item . canMoveDown }
@@ -782,8 +812,10 @@ export function HomeScreen(props: HomeScreenProps) {
782812 titleRegenerationEnvironmentIds ,
783813 toggleSettledShelf ,
784814 toggleSnoozedShelf ,
815+ toggleWorkingShelf ,
785816 v2ProjectTitleByProjectKey ,
786817 props . searchQuery ,
818+ workingShelfEnabled ,
787819 ] ,
788820 ) ;
789821 const v2KeyExtractor = useCallback ( ( item : ThreadListV2ListItem ) => item . key , [ ] ) ;
@@ -800,6 +832,8 @@ export function HomeScreen(props: HomeScreenProps) {
800832 savedConnectionsById : props . savedConnectionsById ,
801833 searchQuery : props . searchQuery ,
802834 threadSearchMatchByKey,
835+ // Rows read it for their reorder menu items.
836+ workingShelfEnabled,
803837 } ) ,
804838 [
805839 projectByKey ,
@@ -808,6 +842,7 @@ export function HomeScreen(props: HomeScreenProps) {
808842 listEnvironments ,
809843 threadSearchMatchByKey ,
810844 v2ProjectTitleByProjectKey ,
845+ workingShelfEnabled ,
811846 ] ,
812847 ) ;
813848
0 commit comments