33 parsePullRequestQuery ,
44} from "@t3tools/client-runtime/pull-request-query" ;
55import { Spinner } from "~/components/ui/spinner" ;
6- import { useShortcutModifierState } from "~/shortcutModifierState" ;
76import type { PullRequestSpeedActionResult } from "~/components/pullRequest/PullRequestSpeedActions" ;
87import { usePullRequestCloseBatch } from "~/components/pullRequest/usePullRequestActions" ;
98import { SidebarPointerSensor } from "~/components/Sidebar.pointer" ;
@@ -24,15 +23,7 @@ import type {
2423} from "@t3tools/contracts" ;
2524import { useAtomValue } from "@effect/atom-react" ;
2625import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
27- import {
28- ArrowDownUpIcon ,
29- EyeIcon ,
30- LayersIcon ,
31- PenLineIcon ,
32- UsersIcon ,
33- Plug2Icon ,
34- type LucideIcon ,
35- } from "lucide-react" ;
26+ import { ArrowDownUpIcon , LayersIcon , Plug2Icon } from "lucide-react" ;
3627import { useEffect , useEffectEvent , useRef , useState , type ComponentProps } from "react" ;
3728
3829import {
@@ -58,7 +49,6 @@ import {
5849 resolveSelectedEnvironmentId ,
5950 withDiffStat ,
6051 writePullRequestListSnapshot ,
61- scorePullRequestMatch ,
6252 pullRequestStatsRefreshBatches ,
6353 pullRequestStatsRequestBatches ,
6454 retainVisiblePullRequestStatsBatches ,
@@ -104,12 +94,10 @@ import {
10494 STATE_TABS ,
10595} from "../components/pullRequest/pullRequestListOptions" ;
10696import { PullRequestsColumn } from "../components/pullRequest/PullRequestsColumn" ;
97+ import { PullRequestListGroups } from "../components/pullRequest/PullRequestListGroups" ;
10798import { PullRequestListEmptyState } from "../components/pullRequest/PullRequestListEmptyState" ;
10899import { PullRequestListGhost } from "../components/pullRequest/PullRequestGhosts" ;
109- import {
110- PullRequestRow ,
111- type PullRequestRowTarget ,
112- } from "../components/pullRequest/PullRequestRow" ;
100+ import { type PullRequestRowTarget } from "../components/pullRequest/PullRequestRow" ;
113101import { PullRequestsUnavailableState } from "../components/pullRequest/PullRequestsUnavailableState" ;
114102import { RightPanelTabs , type PullRequestTabStatusSeed } from "../components/RightPanelTabs" ;
115103import { isCommandPaletteOpen } from "../commandPaletteBus" ;
@@ -151,7 +139,6 @@ import {
151139} from "../state/pullRequests" ;
152140import { useAtomCommand } from "../state/use-atom-command" ;
153141import { cn } from "~/lib/utils" ;
154- import { Separator } from "~/components/ui/separator" ;
155142import { primaryServerKeybindingsAtom } from "~/state/server" ;
156143import { getSourceControlPresentationForKind } from "~/sourceControlPresentation" ;
157144
@@ -178,30 +165,7 @@ export interface PullRequestsSearch extends PullRequestListPreferences {
178165 readonly selectedEnvironmentId ?: EnvironmentId ;
179166}
180167
181- const GROUP_ICONS : Record < string , LucideIcon > = {
182- authored : PenLineIcon ,
183- reviewRequested : EyeIcon ,
184- others : UsersIcon ,
185- } ;
186-
187- function PullRequestGroupHeader ( {
188- group,
189- } : {
190- group : { key : string ; label : string ; entries : ReadonlyArray < unknown > } ;
191- } ) {
192- const Icon = GROUP_ICONS [ group . key ] ?? LayersIcon ;
193- return (
194- < div className = "flex items-center gap-2 px-3 pb-1 text-xs font-medium text-muted-foreground/70" >
195- < Icon aria-hidden className = "size-3.5 shrink-0" />
196- < h2 className = "shrink-0" > { group . label } </ h2 >
197- < span className = "shrink-0 tabular-nums text-muted-foreground/50" > { group . entries . length } </ span >
198- < Separator className = "min-w-2 flex-1" />
199- </ div >
200- ) ;
201- }
202-
203168const SEARCH_DEBOUNCE_MS = 250 ;
204- const MATCHED_ELSEWHERE_SCORE = 10 ;
205169/**
206170 * One whole page from the host and no more: every provider asks for one row beyond the page as
207171 * its "is there more" probe, and GitHub serves a hundred per request — so asking for ninety-nine
@@ -292,9 +256,6 @@ export const Route = createFileRoute("/_chat/pull-requests")({
292256
293257function PullRequestsRouteView ( ) {
294258 useEscapeToGoBack ( ) ;
295- const modifiers = useShortcutModifierState ( true ) ;
296- const speedMode =
297- modifiers . shiftKey && ! modifiers . metaKey && ! modifiers . ctrlKey && ! modifiers . altKey ;
298259 const search = Route . useSearch ( ) ;
299260 const sort = search . sort ?? "ready" ;
300261 const statsPolicy : PullRequestStatsPolicy =
@@ -1302,47 +1263,20 @@ function PullRequestsRouteView() {
13021263 onLoadMore = { loadMore }
13031264 />
13041265 ) : (
1305- < div className = { cn ( "space-y-3" , closeSweepKeys . size > 0 && "**:pointer-events-none" ) } >
1306- { displayGroups . map ( ( group ) => (
1307- < div key = { group . key } className = "space-y-0.5" >
1308- { group . label ? < PullRequestGroupHeader group = { group } /> : null }
1309- { group . entries . map ( ( entry ) => {
1310- const entryKey = pullRequestEntryKey ( entry ) ;
1311- return (
1312- < PullRequestRow
1313- key = { entryKey }
1314- statsKey = { entryKey }
1315- statsRef = { registerStatsRow }
1316- entry = { entry }
1317- showProjectTitle
1318- showProvider = { showProvider }
1319- { ...( capableEnvironments . length > 1 &&
1320- environmentLabels . get ( entry . environmentId ) !== undefined
1321- ? { environmentLabel : environmentLabels . get ( entry . environmentId ) ! }
1322- : { } ) }
1323- matchedElsewhere = {
1324- typedParsed . text . length > 0 &&
1325- scorePullRequestMatch ( entry , typedParsed . text ) <= MATCHED_ELSEWHERE_SCORE
1326- }
1327- selected = {
1328- selected ?. environmentId === entry . environmentId &&
1329- selected . repository === entry . repository &&
1330- selected . host ?. toLowerCase ( ) === entry . host . toLowerCase ( ) &&
1331- selected . number === entry . number
1332- }
1333- onSelect = { selectEntry }
1334- speedMode = { speedMode }
1335- hostActions = { hostActionsOf ( entry ) }
1336- onActed = { onSpeedAction }
1337- closing = { closingKeys . has ( entryKey ) }
1338- sweeping = { closeSweepKeys . has ( entryKey ) }
1339- onCloseSweepStart = { startCloseSweep }
1340- />
1341- ) ;
1342- } ) }
1343- </ div >
1344- ) ) }
1345- </ div >
1266+ < PullRequestListGroups
1267+ groups = { displayGroups }
1268+ environmentLabels = { capableEnvironments . length > 1 ? environmentLabels : null }
1269+ query = { typedParsed . text }
1270+ selected = { selected }
1271+ showProvider = { showProvider }
1272+ statsRef = { registerStatsRow }
1273+ onSelect = { selectEntry }
1274+ hostActionsOf = { hostActionsOf }
1275+ onActed = { onSpeedAction }
1276+ closingKeys = { closingKeys }
1277+ sweepingKeys = { closeSweepKeys }
1278+ onCloseSweepStart = { startCloseSweep }
1279+ />
13461280 ) }
13471281
13481282 { listQuery . error && shownCount > 0 ? (
0 commit comments