@@ -29,16 +29,24 @@ const useStyles = makeStyles((theme: Theme) => {
29
29
treeActiveIcon : {
30
30
color : theme . palette . type === 'light' ? theme . palette . common . black : theme . palette . common . white ,
31
31
} ,
32
+
32
33
showSelected : {
33
34
textAlign : 'right' ,
35
+ marginLeft : 'auto' ,
36
+ marginTop : '5px' ,
34
37
} ,
35
38
jumpCurrentPath : {
36
- paddingLeft : '16px' ,
37
39
cursor : 'pointer' ,
38
40
} ,
39
41
toolbar : {
40
42
display : 'flex' ,
41
43
alignItems : 'center' ,
44
+ paddingRight : '24px' ,
45
+ flexWrap : 'wrap' ,
46
+ marginBottom : '10px' ,
47
+ '& .MuiFormControl-root' : {
48
+ width : 'calc(100% - 48px)' ,
49
+ } ,
42
50
} ,
43
51
cancelButton : { } ,
44
52
currentLocationIcon : {
@@ -122,12 +130,8 @@ export const Picker: React.FunctionComponent<PickerProps<GenericContent>> = (pro
122
130
return ( ) => ac . abort ( )
123
131
} , [ term , props . repository , props . selectionRoots ] )
124
132
125
- const handleJumpToCurrentPath = async ( ) => {
126
- if ( ! props . currentPath ) {
127
- return
128
- }
129
-
130
- setNavigationPath ( props . currentPath )
133
+ const handleJumpToCurrentPath = ( path : string ) => {
134
+ setNavigationPath ( path )
131
135
}
132
136
133
137
return (
@@ -138,70 +142,88 @@ export const Picker: React.FunctionComponent<PickerProps<GenericContent>> = (pro
138
142
< div
139
143
style = { {
140
144
display : 'flex' ,
141
- flexDirection : 'row ' ,
142
- flexWrap : 'wrap ' ,
143
- height : '100 %' ,
145
+ flexDirection : 'column ' ,
146
+ flexWrap : 'nowrap ' ,
147
+ height : '85 %' ,
144
148
justifyContent : 'space-between' ,
145
149
} } >
146
- < PickerContainer >
147
- < Box className = { classes . toolbar } >
148
- < IconButton
149
- title = { props . localization ?. treeViewButton ?? 'Tree view' }
150
- onClick = { ( ) => setMode ( treePickerMode ) }
151
- className = { `${ classes . treeIcon } ${ mode === treePickerMode ? classes . treeActiveIcon : '' } ` } >
152
- < AccountTree />
153
- </ IconButton >
154
- < TextField
155
- fullWidth = { true }
156
- placeholder = { props . localization ?. searchPlaceholder ?? 'Search' }
157
- onFocus = { ( ) => setMode ( PickerModes . SEARCH ) }
158
- onChange = { ( ev ) => {
159
- debouncedQuery ( ev . target . value )
160
- } }
161
- />
162
- </ Box >
163
- < div style = { { display : 'flex' , justifyContent : 'space-between' , alignItems : 'center' } } >
164
- < Link variant = "body2" onClick = { handleJumpToCurrentPath } className = { classes . jumpCurrentPath } >
165
- Jumping to current path
166
- </ Link >
167
-
168
- < ShowSelectedButton
169
- className = { classes . showSelected }
170
- handleClick = { ( ) => setMode ( PickerModes . SELECTION ) }
171
- localization = { { label : props . localization ?. showSelected ?? 'Show selected' } }
172
- />
150
+ < Box className = { classes . toolbar } >
151
+ < IconButton
152
+ title = { props . localization ?. treeViewButton ?? 'Tree view' }
153
+ onClick = { ( ) => setMode ( treePickerMode ) }
154
+ className = { `${ classes . treeIcon } ${ mode === treePickerMode ? classes . treeActiveIcon : '' } ` } >
155
+ < AccountTree />
156
+ </ IconButton >
157
+ < TextField
158
+ fullWidth = { true }
159
+ placeholder = { props . localization ?. searchPlaceholder ?? 'Search' }
160
+ onFocus = { ( ) => setMode ( PickerModes . SEARCH ) }
161
+ onChange = { ( ev ) => {
162
+ debouncedQuery ( ev . target . value )
163
+ } }
164
+ />
165
+ < ShowSelectedButton
166
+ className = { classes . showSelected }
167
+ handleClick = { ( ) => setMode ( PickerModes . SELECTION ) }
168
+ localization = { { label : props . localization ?. showSelected ?? 'Show selected' } }
169
+ />
170
+ </ Box >
171
+
172
+ < div className = "selection-container" style = { { width : '100%' , display : 'flex' } } >
173
+ < div
174
+ style = { {
175
+ display : 'flex' ,
176
+ flexDirection : 'column' ,
177
+ justifyContent : 'flex-start' ,
178
+ alignItems : 'center' ,
179
+ rowGap : '10px' ,
180
+ width : '140px' ,
181
+ paddingInline : '10px' ,
182
+ } } >
183
+ { props . helperPaths ?. map ( ( path ) => (
184
+ < Link
185
+ key = { path }
186
+ variant = "body2"
187
+ onClick = { ( ) => handleJumpToCurrentPath ( path ) }
188
+ className = { classes . jumpCurrentPath } >
189
+ { path === props . contextPath ? 'Current Content' : path }
190
+ </ Link >
191
+ ) ) }
173
192
</ div >
174
- { mode === PickerModes . TREE && (
175
- < TreePicker setNavigationPath = { setNavigationPath } navigationPath = { navigationPath } { ...props } />
176
- ) }
177
- { mode === PickerModes . COPY_MOVE_TREE && < CopyMoveTreePicker { ...props } /> }
178
- { mode === PickerModes . SEARCH && < SearchPicker { ...props } items = { result } error = { searchError } /> }
179
- { mode === PickerModes . SELECTION && < SelectionList { ...props } /> }
180
- </ PickerContainer >
181
- < SelectionContext . Consumer >
182
- { ( { selection } ) =>
183
- props . renderActions ? (
184
- props . renderActions ( selection )
185
- ) : (
186
- < ActionsContainer style = { { marginLeft : 'auto' , width : '100%' } } >
187
- < Button
188
- aria-label = { props . localization ?. cancelButton ?? 'Cancel' }
189
- className = { classes . cancelButton }
190
- disabled = { ! ! props . isExecInProgress }
191
- onClick = { ( ) => props . handleCancel ?.( ) } >
192
- { props . localization ?. cancelButton ?? 'Cancel' }
193
- </ Button >
194
- < SaveButton
195
- data-test = "picker-submit"
196
- disabled = { ( props . required && selection . length < props . required ) || ! ! props . isExecInProgress }
197
- localization = { { label : props . localization ?. submitButton ?? 'Submit' } }
198
- onClick = { ( ) => props . handleSubmit ?.( selection ) }
199
- />
200
- </ ActionsContainer >
201
- )
202
- }
203
- </ SelectionContext . Consumer >
193
+
194
+ < PickerContainer style = { { height : '545px' , paddingTop : 0 , position : 'relative' , top : '-7px' } } >
195
+ { mode === PickerModes . TREE && (
196
+ < TreePicker setNavigationPath = { setNavigationPath } navigationPath = { navigationPath } { ...props } />
197
+ ) }
198
+ { mode === PickerModes . COPY_MOVE_TREE && < CopyMoveTreePicker { ...props } /> }
199
+ { mode === PickerModes . SEARCH && < SearchPicker { ...props } items = { result } error = { searchError } /> }
200
+ { mode === PickerModes . SELECTION && < SelectionList { ...props } /> }
201
+ </ PickerContainer >
202
+ </ div >
204
203
</ div >
204
+ < SelectionContext . Consumer >
205
+ { ( { selection } ) =>
206
+ props . renderActions ? (
207
+ props . renderActions ( selection )
208
+ ) : (
209
+ < ActionsContainer style = { { marginLeft : 'auto' , width : '100%' } } >
210
+ < Button
211
+ aria-label = { props . localization ?. cancelButton ?? 'Cancel' }
212
+ className = { classes . cancelButton }
213
+ disabled = { ! ! props . isExecInProgress }
214
+ onClick = { ( ) => props . handleCancel ?.( ) } >
215
+ { props . localization ?. cancelButton ?? 'Cancel' }
216
+ </ Button >
217
+ < SaveButton
218
+ data-test = "picker-submit"
219
+ disabled = { ( props . required && selection . length < props . required ) || ! ! props . isExecInProgress }
220
+ localization = { { label : props . localization ?. submitButton ?? 'Submit' } }
221
+ onClick = { ( ) => props . handleSubmit ?.( selection ) }
222
+ />
223
+ </ ActionsContainer >
224
+ )
225
+ }
226
+ </ SelectionContext . Consumer >
205
227
</ SelectionProvider >
206
228
)
207
229
}
0 commit comments