@@ -6,6 +6,7 @@ import { CommitHistoryDialog } from "./ui/components/commit-history-dialog"
66import { useGitTuiController } from "./hooks/use-git-tui-controller"
77import { CommitDialog } from "./ui/components/commit-dialog"
88import { DiffWorkspace } from "./ui/components/diff-workspace"
9+ import { DiscardDialog } from "./ui/components/discard-dialog"
910import { FooterBar } from "./ui/components/footer-bar"
1011import { MergeConflictDialog } from "./ui/components/merge-conflict-dialog"
1112import { ShortcutsDialog } from "./ui/components/shortcuts-dialog"
@@ -24,6 +25,7 @@ type ActiveScreen =
2425 | "history"
2526 | "shortcuts"
2627 | "sync"
28+ | "discard"
2729 | "merge-conflict"
2830
2931export function App ( { config } : AppProps ) {
@@ -33,17 +35,19 @@ export function App({ config }: AppProps) {
3335 const controller = useGitTuiController ( renderer , config )
3436 const activeScreen : ActiveScreen = controller . mergeConflictDialogOpen
3537 ? "merge-conflict"
36- : controller . syncDialogOpen
37- ? "sync"
38- : controller . branchDialogOpen
39- ? "branch"
40- : controller . commitDialogOpen
41- ? "commit"
42- : controller . historyDialogOpen
43- ? "history"
44- : controller . shortcutsDialogOpen
45- ? "shortcuts"
46- : "main"
38+ : controller . discardDialogOpen
39+ ? "discard"
40+ : controller . syncDialogOpen
41+ ? "sync"
42+ : controller . branchDialogOpen
43+ ? "branch"
44+ : controller . commitDialogOpen
45+ ? "commit"
46+ : controller . historyDialogOpen
47+ ? "history"
48+ : controller . shortcutsDialogOpen
49+ ? "shortcuts"
50+ : "main"
4751 const footerHint = resolveFooterHint ( {
4852 activeScreen,
4953 branchDialogMode : controller . branchDialogMode ,
@@ -252,6 +256,29 @@ export function App({ config }: AppProps) {
252256 />
253257 ) : null }
254258
259+ { activeScreen === "discard" ? (
260+ < DiscardDialog
261+ open = { true }
262+ focus = { controller . focus }
263+ terminalWidth = { terminalWidth }
264+ terminalHeight = { terminalHeight }
265+ path = { controller . discardPath ?? "" }
266+ options = { controller . discardOptions }
267+ optionIndex = { controller . discardOptionIndex }
268+ onOptionClick = { ( index ) => {
269+ controller . setDiscardSelection ( index )
270+ } }
271+ onOptionScroll = { ( direction ) => {
272+ if ( direction === "up" ) {
273+ controller . moveDiscardSelectionUp ( )
274+ } else {
275+ controller . moveDiscardSelectionDown ( )
276+ }
277+ } }
278+ theme = { theme }
279+ />
280+ ) : null }
281+
255282 { activeScreen === "merge-conflict" ? (
256283 < MergeConflictDialog
257284 open = { true }
@@ -314,6 +341,7 @@ function resolveFooterHint({
314341 if ( activeScreen === "commit" ) return "enter commit esc cancel"
315342 if ( activeScreen === "shortcuts" ) return "esc close"
316343 if ( activeScreen === "sync" ) return "enter choose esc back"
344+ if ( activeScreen === "discard" ) return "enter choose esc back"
317345 if ( activeScreen === "merge-conflict" ) return "enter open or finish tab next panel esc back"
318346 if ( activeScreen === "history" ) {
319347 if ( historyMode === "action" ) return "enter choose esc back"
0 commit comments