File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1933,6 +1933,7 @@ function MainApp() {
19331933 gitStatus,
19341934 fileStatus,
19351935 perFileDiffGroups,
1936+ hasActiveGitDiffs : activeDiffs . length > 0 ,
19361937 selectedDiffPath,
19371938 diffScrollRequestId,
19381939 onSelectDiff : handleSelectDiff ,
@@ -2134,9 +2135,17 @@ function MainApp() {
21342135 setCenterMode ( "chat" ) ;
21352136 } ,
21362137 onShowSelectedDiff : ( ) => {
2137- if ( ! selectedDiffPath ) {
2138+ const fallbackPath =
2139+ selectedDiffPath ?? activeDiffs [ 0 ] ?. path ;
2140+
2141+ if ( ! fallbackPath ) {
21382142 return ;
21392143 }
2144+
2145+ if ( ! selectedDiffPath ) {
2146+ setSelectedDiffPath ( fallbackPath ) ;
2147+ }
2148+
21402149 setCenterMode ( "diff" ) ;
21412150 if ( isPhone ) {
21422151 setActiveTab ( "git" ) ;
Original file line number Diff line number Diff line change @@ -65,19 +65,17 @@ export function PhoneLayout({
6565 { activeTab === "git" && (
6666 < div className = "compact-panel" >
6767 { ! activeWorkspace && compactEmptyGitNode }
68- { activeWorkspace && showGitDetail && (
69- < >
70- { compactGitBackNode }
71- < div className = "compact-git-viewer" > { gitDiffViewerNode } </ div >
72- </ >
73- ) }
74- { activeWorkspace && ! showGitDetail && (
68+ { activeWorkspace && (
7569 < >
7670 < MainTopbar leftNode = { topbarLeftNode } className = "compact-topbar" />
7771 { compactGitBackNode }
78- < div className = "compact-git" >
79- < div className = "compact-git-list" > { gitDiffPanelNode } </ div >
80- </ div >
72+ { showGitDetail ? (
73+ < div className = "compact-git-viewer" > { gitDiffViewerNode } </ div >
74+ ) : (
75+ < div className = "compact-git" >
76+ < div className = "compact-git-list" > { gitDiffPanelNode } </ div >
77+ </ div >
78+ ) }
8179 </ >
8280 ) }
8381 </ div >
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export function buildSecondaryNodes(options: LayoutNodesOptions): SecondaryLayou
9494 type = "button"
9595 className = { `compact-git-switch-button${ compactGitDiffActive ? " active" : "" } ` }
9696 onClick = { options . onShowSelectedDiff }
97- disabled = { ! options . selectedDiffPath }
97+ disabled = { ! options . hasActiveGitDiffs }
9898 >
9999 Diff
100100 </ button >
Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ export type LayoutNodesOptions = {
260260 fileStatus : string ;
261261 perFileDiffGroups : PerFileDiffGroup [ ] ;
262262 selectedDiffPath : string | null ;
263+ hasActiveGitDiffs : boolean ;
263264 diffScrollRequestId : number ;
264265 onSelectDiff : ( path : string ) => void ;
265266 onSelectPerFileDiff : ( path : string ) => void ;
You can’t perform that action at this time.
0 commit comments