@@ -45,13 +45,15 @@ import {
4545 ThreadListV2SettledShelfHeader ,
4646 ThreadListV2ShowMoreRow ,
4747 ThreadListV2SnoozedShelfHeader ,
48+ ThreadListV2WorkingShelfHeader ,
4849} from "../threads/thread-list-v2-items" ;
4950import { useThreadRowProviderInstanceResolver } from "../threads/thread-provider-instance" ;
5051import {
5152 buildThreadListV2Items ,
5253 getThreadListV2OrderedSection ,
5354 buildThreadListV2ListItems ,
5455 threadListV2ListItemsAreEqual ,
56+ threadListInboxReturns ,
5557 THREAD_LIST_V2_SETTLED_INITIAL_COUNT ,
5658 THREAD_LIST_V2_SETTLED_PAGE_COUNT ,
5759 type ThreadListV2ListItem ,
@@ -469,8 +471,11 @@ export function HomeScreen(props: HomeScreenProps) {
469471 loaded : shelfPreferencesLoaded ,
470472 settledShelfExpanded,
471473 snoozedShelfExpanded,
474+ workingShelfEnabled,
475+ workingShelfExpanded,
472476 toggleSettledShelf,
473477 toggleSnoozedShelf,
478+ toggleWorkingShelf,
474479 } = useThreadListV2ShelfPreferences ( ) ;
475480 // The queued-start and snooze helpers need a clock while the list stays open.
476481 const [ nowMinute , setNowMinute ] = useState ( ( ) => new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) ) ;
@@ -529,9 +534,14 @@ export function HomeScreen(props: HomeScreenProps) {
529534 queuedThreadKeys,
530535 } ) ,
531536 } ) ;
532- return new Map ( [ ...sectionAvailability ( "pinned" ) , ...sectionAvailability ( "active" ) ] ) ;
537+ // The Working beta orders the inbox by time, so only pins can move.
538+ return new Map ( [
539+ ...sectionAvailability ( "pinned" ) ,
540+ ...( workingShelfEnabled ? [ ] : sectionAvailability ( "active" ) ) ,
541+ ] ) ;
533542 } , [
534543 activeThreadSortOrder ,
544+ workingShelfEnabled ,
535545 pinReorderEnvironmentIds ,
536546 activeReorderEnvironmentIds ,
537547 props . threads ,
@@ -543,6 +553,7 @@ export function HomeScreen(props: HomeScreenProps) {
543553 snoozeWakeTick ,
544554 ] ) ;
545555 const threadListV2Layout = useMemo ( ( ) => {
556+ threadListInboxReturns . observe ( workingShelfEnabled ? props . threads : null ) ;
546557 // Settled threads are live shells; archived threads keep their original
547558 // "hidden from lists" meaning.
548559 return buildThreadListV2Items ( {
@@ -558,12 +569,17 @@ export function HomeScreen(props: HomeScreenProps) {
558569 queuedThreadKeys,
559570 settledLimit : settledVisibleCount ,
560571 now : new Date ( ) . toISOString ( ) ,
572+ workingShelfEnabled,
573+ workingShelfExpanded,
574+ inboxReturnAt : threadListInboxReturns . returnedAt ,
561575 snoozedShelfExpanded,
562576 settledShelfExpanded,
563577 selectedThreadKey : null ,
564578 } ) ;
565579 } , [
566580 activeThreadSortOrder ,
581+ workingShelfEnabled ,
582+ workingShelfExpanded ,
567583 pendingOrder ,
568584 queuedThreadKeys ,
569585 nowMinute ,
@@ -618,6 +634,9 @@ export function HomeScreen(props: HomeScreenProps) {
618634 buildThreadListV2ListItems ( {
619635 items : threadListV2Layout . items ,
620636 pendingTasks : v2PendingTasks ,
637+ workingCount : threadListV2Layout . workingCount ,
638+ workingShelfExpanded,
639+ workingShelfHeaderIndex : threadListV2Layout . workingShelfHeaderIndex ,
621640 snoozedCount : threadListV2Layout . snoozedCount ,
622641 snoozedShelfExpanded,
623642 snoozedShelfHeaderIndex : threadListV2Layout . snoozedShelfHeaderIndex ,
@@ -640,6 +659,7 @@ export function HomeScreen(props: HomeScreenProps) {
640659 snoozeEnvironmentIds ,
641660 threadListV2Layout ,
642661 v2PendingTasks ,
662+ workingShelfExpanded ,
643663 ] ,
644664 ) ;
645665
@@ -674,6 +694,16 @@ export function HomeScreen(props: HomeScreenProps) {
674694 />
675695 ) ;
676696 }
697+ if ( item . type === "v2-working-shelf" ) {
698+ return (
699+ < ThreadListV2WorkingShelfHeader
700+ count = { item . count }
701+ disabled = { item . disabled }
702+ expanded = { item . expanded }
703+ onToggle = { toggleWorkingShelf }
704+ />
705+ ) ;
706+ }
677707 if ( item . type === "v2-snoozed-shelf" ) {
678708 return (
679709 < ThreadListV2SnoozedShelfHeader
@@ -742,7 +772,7 @@ export function HomeScreen(props: HomeScreenProps) {
742772 reorderSupported = {
743773 item . item . pinned
744774 ? pinReorderEnvironmentIds . has ( thread . environmentId )
745- : activeReorderEnvironmentIds . has ( thread . environmentId )
775+ : ! workingShelfEnabled && activeReorderEnvironmentIds . has ( thread . environmentId )
746776 }
747777 canMoveUp = { item . canMoveUp }
748778 canMoveDown = { item . canMoveDown }
@@ -794,8 +824,10 @@ export function HomeScreen(props: HomeScreenProps) {
794824 titleRegenerationEnvironmentIds ,
795825 toggleSettledShelf ,
796826 toggleSnoozedShelf ,
827+ toggleWorkingShelf ,
797828 v2ProjectTitleByProjectKey ,
798829 props . searchQuery ,
830+ workingShelfEnabled ,
799831 ] ,
800832 ) ;
801833 const v2KeyExtractor = useCallback ( ( item : ThreadListV2ListItem ) => item . key , [ ] ) ;
@@ -812,6 +844,8 @@ export function HomeScreen(props: HomeScreenProps) {
812844 savedConnectionsById : props . savedConnectionsById ,
813845 searchQuery : props . searchQuery ,
814846 threadSearchMatchByKey,
847+ // Rows read it for their reorder menu items.
848+ workingShelfEnabled,
815849 } ) ,
816850 [
817851 projectByKey ,
@@ -820,6 +854,7 @@ export function HomeScreen(props: HomeScreenProps) {
820854 listEnvironments ,
821855 threadSearchMatchByKey ,
822856 v2ProjectTitleByProjectKey ,
857+ workingShelfEnabled ,
823858 ] ,
824859 ) ;
825860
0 commit comments