Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb96e7fd

Browse files
committed
fix: improve organization autocomplete
1 parentf959a08 commitb96e7fd

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

‎site/src/components/OrganizationAutocomplete/OrganizationAutocomplete.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type { Organization } from "api/typesGenerated";
1414
import{Avatar}from"components/Avatar/Avatar";
1515
import{AvatarData}from"components/AvatarData/AvatarData";
1616
import{useDebouncedFunction}from"hooks/debounce";
17-
// import { prepareQuery } from "utils/filters";
1817

1918
exporttypeOrganizationAutocompleteProps={
2019
value:Organization|null;
@@ -38,14 +37,6 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
3837
value:value?.name??"",
3938
open:false,
4039
});
41-
// const usersQuery = useQuery({
42-
// ...users({
43-
// q: prepareQuery(encodeURI(autoComplete.value)),
44-
// limit: 25,
45-
// }),
46-
// enabled: autoComplete.open,
47-
// keepPreviousData: true,
48-
// });
4940
constorganizationsQuery=useQuery(organizations());
5041

5142
const{debounced:debouncedInputOnChange}=useDebouncedFunction(
@@ -60,10 +51,8 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
6051

6152
return(
6253
<Autocomplete
63-
// Since the values are filtered by the API we don't need to filter them
64-
// in the FE because it can causes some mismatches.
6554
filterOptions={(organization)=>organization}
66-
noOptionsText="Nousers found"
55+
noOptionsText="Noorganizations found"
6756
className={className}
6857
options={organizationsQuery.data??[]}
6958
loading={organizationsQuery.isLoading}
@@ -88,14 +77,14 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
8877
isOptionEqualToValue={(option:Organization,value:Organization)=>
8978
option.name===value.name
9079
}
91-
getOptionLabel={(option)=>option.name}
80+
getOptionLabel={(option)=>option.display_name}
9281
renderOption={(props,option)=>{
9382
const{ key, ...optionProps}=props;
9483
return(
9584
<likey={key}{...optionProps}>
9685
<AvatarData
97-
title={option.name}
98-
subtitle={option.display_name}
86+
title={option.display_name}
87+
subtitle={option.name}
9988
src={option.icon}
10089
/>
10190
</li>
@@ -107,12 +96,14 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
10796
fullWidth
10897
size={size}
10998
label={label}
99+
autoFocus
110100
placeholder="Organization name"
111101
css={{
112102
"&:not(:has(label))":{
113103
margin:0,
114104
},
115105
}}
106+
required
116107
InputProps={{
117108
...params.InputProps,
118109
onChange:debouncedInputOnChange,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp