better search results and more intuitive
This commit is contained in:
@@ -244,16 +244,17 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
if (searchVal) {
|
if (searchVal) {
|
||||||
enqueueSnackbar('searching...', { variant: 'info' });
|
enqueueSnackbar('searching...', { variant: 'info' });
|
||||||
|
|
||||||
const results = await searchUsers(searchVal);
|
let results = await searchUsers(searchVal);
|
||||||
|
results = results.filter((userResult) => userResult.id !== user.uid);
|
||||||
setSearchUsersResults(results);
|
setSearchUsersResults(results);
|
||||||
|
|
||||||
console.warn(results);
|
console.warn('searched users', results);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
},
|
},
|
||||||
1000,
|
1000,
|
||||||
[searchVal, enqueueSnackbar, setSearchUsersResults],
|
[searchVal, enqueueSnackbar, setSearchUsersResults, user],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleChangeSearchInput = useCallback(
|
const handleChangeSearchInput = useCallback(
|
||||||
@@ -359,8 +360,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{searchVal ? (
|
{searchVal ? (
|
||||||
<ListPeople people={searchUsersResults} />
|
<ListPeople people={searchUsersResults} />
|
||||||
) : (
|
) : (
|
||||||
@@ -386,7 +385,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
spacing={1}
|
spacing={1}
|
||||||
direction={'row'}
|
direction={'row'}
|
||||||
@@ -507,16 +505,30 @@ function ListPeople({ people }: { people: User[] }) {
|
|||||||
pt: 2,
|
pt: 2,
|
||||||
}}
|
}}
|
||||||
subheader={
|
subheader={
|
||||||
<ListSubheader>
|
<ListSubheader
|
||||||
<Typography variant="subtitle2"> Search Results</Typography>
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography align={'center'} variant="subtitle2">
|
||||||
|
Search Results
|
||||||
|
</Typography>
|
||||||
</ListSubheader>
|
</ListSubheader>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{people.length === 0 && (
|
<ListItem
|
||||||
<Typography align="center" variant="caption">
|
sx={{
|
||||||
{`Can't find someone? Invite them!`}
|
display: 'flex',
|
||||||
</Typography>
|
justifyContent: 'center',
|
||||||
)}
|
}}
|
||||||
|
>
|
||||||
|
{people.length === 0 && (
|
||||||
|
<Typography align="center" variant="caption">
|
||||||
|
{`Can't find someone? Invite them!`}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
{people.map((person) => (
|
{people.map((person) => (
|
||||||
<ListItem key={`${person.uid}-searchUsers`}>
|
<ListItem key={`${person.uid}-searchUsers`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user