@@ -5,9 +5,8 @@ import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicato
5
5
import { hasEveryAccess } from 'sentry/components/acl/access' ;
6
6
import { ProjectAvatar } from 'sentry/components/core/avatar/projectAvatar' ;
7
7
import { Button } from 'sentry/components/core/button' ;
8
+ import { CompactSelect , type SelectOption } from 'sentry/components/core/compactSelect' ;
8
9
import { Tooltip } from 'sentry/components/core/tooltip' ;
9
- import DropdownAutoComplete from 'sentry/components/dropdownAutoComplete' ;
10
- import DropdownButton from 'sentry/components/dropdownButton' ;
11
10
import EmptyMessage from 'sentry/components/emptyMessage' ;
12
11
import LoadingError from 'sentry/components/loadingError' ;
13
12
import LoadingIndicator from 'sentry/components/loadingIndicator' ;
@@ -16,7 +15,6 @@ import Panel from 'sentry/components/panels/panel';
16
15
import PanelBody from 'sentry/components/panels/panelBody' ;
17
16
import PanelHeader from 'sentry/components/panels/panelHeader' ;
18
17
import PanelItem from 'sentry/components/panels/panelItem' ;
19
- import TextOverflow from 'sentry/components/textOverflow' ;
20
18
import { IconFlag , IconSubtract } from 'sentry/icons' ;
21
19
import { t } from 'sentry/locale' ;
22
20
import ProjectsStore from 'sentry/stores/projectsStore' ;
@@ -96,15 +94,11 @@ function TeamProjects({team, location, params}: TeamProjectsProps) {
96
94
const otherProjects = useMemo ( ( ) => {
97
95
return unlinkedProjects
98
96
. filter ( p => p . access . includes ( 'project:write' ) )
99
- . map ( p => ( {
97
+ . map < SelectOption < string > > ( p => ( {
100
98
value : p . id ,
101
- searchKey : p . slug ,
102
- label : (
103
- < ProjectListElement >
104
- < ProjectAvatar project = { p } size = { 16 } />
105
- < TextOverflow > { p . slug } </ TextOverflow >
106
- </ ProjectListElement >
107
- ) ,
99
+ leadingItems : < ProjectAvatar project = { p } size = { 16 } /> ,
100
+ label : p . slug ,
101
+ hideCheck : true ,
108
102
} ) ) ;
109
103
} , [ unlinkedProjects ] ) ;
110
104
@@ -118,28 +112,29 @@ function TeamProjects({team, location, params}: TeamProjectsProps) {
118
112
< Panel >
119
113
< PanelHeader hasButtons >
120
114
< div > { t ( 'Projects' ) } </ div >
121
- < div style = { { textTransform : 'none' , fontWeight : 'normal' } } >
122
- < DropdownAutoComplete
123
- items = { otherProjects }
124
- minWidth = { 300 }
125
- onChange = { evt => setQuery ( evt . target . value ) }
126
- onSelect = { selection => {
115
+ < div >
116
+ < CompactSelect
117
+ size = "xs"
118
+ menuWidth = { 300 }
119
+ options = { otherProjects }
120
+ value = ""
121
+ disabled = { false }
122
+ onClose = { ( ) => setQuery ( '' ) }
123
+ onChange = { selection => {
127
124
const project = unlinkedProjects . find ( p => p . id === selection . value ) ;
128
125
if ( project ) {
129
126
handleLinkProject ( project , 'add' ) ;
130
127
}
131
128
} }
132
- onClose = { ( ) => setQuery ( '' ) }
133
- busy = { loadingUnlinkedProjects }
134
- emptyMessage = { t ( 'You are not an admin for any other projects' ) }
135
- alignMenu = "right"
136
- >
137
- { ( { isOpen} ) => (
138
- < DropdownButton isOpen = { isOpen } size = "xs" >
139
- { t ( 'Add Project' ) }
140
- </ DropdownButton >
141
- ) }
142
- </ DropdownAutoComplete >
129
+ menuTitle = { t ( 'Projects' ) }
130
+ triggerLabel = { t ( 'Add Project' ) }
131
+ searchPlaceholder = { t ( 'Search Projects' ) }
132
+ emptyMessage = { t ( 'No projects' ) }
133
+ loading = { loadingUnlinkedProjects }
134
+ searchable
135
+ disableSearchFilter
136
+ onSearch = { setQuery }
137
+ />
143
138
</ div >
144
139
</ PanelHeader >
145
140
@@ -192,11 +187,4 @@ const StyledPanelItem = styled(PanelItem)`
192
187
max-width: 100%;
193
188
` ;
194
189
195
- const ProjectListElement = styled ( 'div' ) `
196
- display: flex;
197
- align-items: center;
198
- gap: ${ space ( 0.5 ) } ;
199
- padding: ${ space ( 0.25 ) } 0;
200
- ` ;
201
-
202
190
export default TeamProjects ;
0 commit comments