File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
apps/desktop/src/components/main/body Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export const TabItemEmpty: TabItem<Extract<Tab, { type: "empty" }>> = ({
2222 icon = { < AppWindowIcon className = "w-4 h-4" /> }
2323 title = "New tab"
2424 selected = { tab . active }
25+ isEmptyTab
2526 tabIndex = { tabIndex }
2627 handleCloseThis = { ( ) => handleCloseThis ( tab ) }
2728 handleSelectThis = { ( ) => handleSelectThis ( tab ) }
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ type TabItemBaseProps = {
2020 title : React . ReactNode ;
2121 selected : boolean ;
2222 active ?: boolean ;
23+ isEmptyTab ?: boolean ;
2324 tabIndex ?: number ;
2425} & {
2526 handleCloseThis : ( ) => void ;
@@ -37,6 +38,7 @@ export function TabItemBase({
3738 title,
3839 selected,
3940 active = false ,
41+ isEmptyTab = false ,
4042 tabIndex,
4143 handleCloseThis,
4244 handleSelectThis,
@@ -55,11 +57,17 @@ export function TabItemBase({
5557 } ;
5658
5759 const contextMenu = ! active
58- ? [
59- { id : "close-tab" , text : "close tab" , action : handleCloseThis } ,
60- { id : "close-others" , text : "close others" , action : handleCloseOthers } ,
61- { id : "close-all" , text : "close all" , action : handleCloseAll } ,
62- ]
60+ ? selected && ! isEmptyTab
61+ ? [ { id : "close-tab" , text : "Close" , action : handleCloseThis } ]
62+ : [
63+ { id : "close-tab" , text : "Close" , action : handleCloseThis } ,
64+ {
65+ id : "close-others" ,
66+ text : "Close others" ,
67+ action : handleCloseOthers ,
68+ } ,
69+ { id : "close-all" , text : "Close all" , action : handleCloseAll } ,
70+ ]
6371 : undefined ;
6472
6573 const showShortcut = isCmdPressed && tabIndex !== undefined ;
You can’t perform that action at this time.
0 commit comments