66 MoreIcon ,
77} from "./icons" ;
88import * as api from "../api/commands" ;
9+ import type { ResetMode } from "../api/commands" ;
910import type { PlatformType } from "../hooks/usePlatform" ;
1011import type { BranchInfo , RepoOpenLocation , RepoOpenLocationKind } from "../types" ;
1112import "./Titlebar.css" ;
@@ -38,6 +39,7 @@ type TitlebarProps = {
3839 pushDisabled ?: boolean ;
3940 pushTitle ?: string ;
4041 onStash : ( ) => void ;
42+ onReset : ( mode : Extract < ResetMode , "mixed" | "hard" > ) => void ;
4143 onImportPatch : ( ) => void ;
4244 onExportPatch : ( scope : "staged" | "unstaged" | "all" | "selected" ) => void ;
4345 selectedPatchExportEnabled : boolean ;
@@ -63,7 +65,7 @@ export function Titlebar({
6365 identityInitials, identityAvatarUrl, recentRepos, searchQuery, searchInputRef,
6466 onSearchChange, onAboutClick, onSettingsClick, onIdentityClick, onCloneClick, onInitRepoClick, onOpenExistingClick,
6567 onRepoSelect, onOpenRepoLocation, onFetch, onPull, onPush, pushLabel, pushDisabled = false , pushTitle, onStash,
66- onImportPatch, onExportPatch, selectedPatchExportEnabled,
68+ onReset , onImportPatch, onExportPatch, selectedPatchExportEnabled,
6769 identityOpen, remoteOp,
6870} : TitlebarProps ) {
6971 const { t } = useTranslation ( "titlebar" ) ;
@@ -159,6 +161,7 @@ export function Titlebar({
159161 < ActionBtn icon = { < StashIcon size = { 18 } className = "titlebar__toolbar-icon" /> } label = { t ( "actions.stash" ) } onClick = { onStash } disabled = { ! repoPath } />
160162 < MoreDropdown
161163 repoPath = { repoPath }
164+ onReset = { onReset }
162165 onImportPatch = { onImportPatch }
163166 onExportPatch = { onExportPatch }
164167 selectedPatchExportEnabled = { selectedPatchExportEnabled }
@@ -231,8 +234,9 @@ export function Titlebar({
231234 ) ;
232235}
233236
234- function MoreDropdown ( { repoPath, onImportPatch, onExportPatch, selectedPatchExportEnabled } : {
237+ function MoreDropdown ( { repoPath, onReset , onImportPatch, onExportPatch, selectedPatchExportEnabled } : {
235238 repoPath : string | null ;
239+ onReset : ( mode : Extract < ResetMode , "mixed" | "hard" > ) => void ;
236240 onImportPatch : ( ) => void ;
237241 onExportPatch : ( scope : "staged" | "unstaged" | "all" | "selected" ) => void ;
238242 selectedPatchExportEnabled : boolean ;
@@ -304,6 +308,13 @@ function MoreDropdown({ repoPath, onImportPatch, onExportPatch, selectedPatchExp
304308 </ div >
305309 </ div >
306310 </ div >
311+ < div className = "titlebar__open-menu-heading" > { t ( "reset.heading" ) } </ div >
312+ < div className = "titlebar__open-menu-item" onClick = { ( ) => run ( ( ) => onReset ( "mixed" ) ) } >
313+ < span > { t ( "reset.mixed" ) } </ span >
314+ </ div >
315+ < div className = "titlebar__open-menu-item" onClick = { ( ) => run ( ( ) => onReset ( "hard" ) ) } >
316+ < span > { t ( "reset.hard" ) } </ span >
317+ </ div >
307318 </ div >
308319 ) }
309320 </ div >
0 commit comments