@@ -13,6 +13,7 @@ import { PatchViewerOptions } from './patch-viewer';
1313import { PreferencesDialog } from './preferences-dialog' ;
1414import { Field , Settings } from '../../shared/settings' ;
1515import { ThemeManager } from '../../shared/theme-manager' ;
16+ import { InputDialog } from './input-dialog' ;
1617
1718export interface AppState {
1819 repos : RepoState [ ] ;
@@ -46,6 +47,7 @@ export class App extends React.PureComponent<{}, AppState> {
4647 this . openInitRepoDialog = this . openInitRepoDialog . bind ( this ) ;
4748 this . openOpenRepoDialog = this . openOpenRepoDialog . bind ( this ) ;
4849 this . openCreateBranchDialog = this . openCreateBranchDialog . bind ( this ) ;
50+ this . openInputDialog = this . openInputDialog . bind ( this ) ;
4951 this . showNotification = this . showNotification . bind ( this ) ;
5052 this . closeModalWindow = this . closeModalWindow . bind ( this ) ;
5153 }
@@ -132,14 +134,16 @@ export class App extends React.PureComponent<{}, AppState> {
132134 // Modal components
133135
134136 openCloneRepoDialog ( ) {
135- const element = < CloneRepoDialog onCloneRepo = { this . cloneRepo } onClose = { this . closeModalWindow } />
137+ const element = < CloneRepoDialog onCloneRepo = { this . cloneRepo }
138+ onClose = { this . closeModalWindow } />
136139 this . setState ( {
137140 modalWindow : element
138141 } ) ;
139142 }
140143
141144 openInitRepoDialog ( ) {
142- const element = < InitRepoDialog onInitRepo = { this . initRepo } onClose = { this . closeModalWindow } />
145+ const element = < InitRepoDialog onInitRepo = { this . initRepo }
146+ onClose = { this . closeModalWindow } />
143147 this . setState ( {
144148 modalWindow : element
145149 } ) ;
@@ -166,7 +170,20 @@ export class App extends React.PureComponent<{}, AppState> {
166170 }
167171
168172 openCreateBranchDialog ( commit : Git . Commit ) {
169- const element = < CreateBranchDialog repo = { this . getCurrentRepo ( ) } commit = { commit } onClose = { this . closeModalWindow } /> ;
173+ const element = < CreateBranchDialog repo = { this . getCurrentRepo ( ) }
174+ commit = { commit }
175+ onClose = { this . closeModalWindow } /> ;
176+ this . setState ( {
177+ modalWindow : element
178+ } ) ;
179+ }
180+
181+ openInputDialog ( label : string , button : string , onSubmit : ( value : string ) => void , defaultValue ?: string ) {
182+ const element = < InputDialog label = { label }
183+ button = { button }
184+ defaultValue = { defaultValue }
185+ onSubmit = { onSubmit }
186+ onClose = { this . closeModalWindow } />
170187 this . setState ( {
171188 modalWindow : element
172189 } ) ;
@@ -190,6 +207,7 @@ export class App extends React.PureComponent<{}, AppState> {
190207 patchViewerOptions = { this . state . patchViewerOptions }
191208 onRepoClose = { ( ) => this . closeRepo ( i ) }
192209 onCreateBranch = { this . openCreateBranchDialog }
210+ onOpenInputDialog = { this . openInputDialog }
193211 key = { repo . path } /> ) ;
194212 return (
195213 < div id = 'app' >
0 commit comments