mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): edge cases in starter models search
This commit is contained in:
parent
46dc8c6641
commit
1072b74c0e
@ -30,7 +30,7 @@ export const StarterModelsResultItem = ({ result }: Props) => {
|
||||
<Flex alignItems="center" justifyContent="space-between" w="100%" gap={3}>
|
||||
<Flex fontSize="sm" flexDir="column">
|
||||
<Flex gap={3}>
|
||||
<Badge h="min-content">{result.type.replace('_', ' ')}</Badge>
|
||||
<Badge h="min-content">{result.type.replaceAll('_', ' ')}</Badge>
|
||||
<ModelBaseBadge base={result.base} />
|
||||
<Text fontWeight="semibold">{result.name}</Text>
|
||||
</Flex>
|
||||
|
@ -18,14 +18,18 @@ export const StarterModelsResults = ({ results }: StarterModelsResultsProps) =>
|
||||
|
||||
const filteredResults = useMemo(() => {
|
||||
return results.filter((result) => {
|
||||
const trimmedSearchTerm = searchTerm.trim().toLowerCase();
|
||||
const name = result.name.toLowerCase();
|
||||
const type = result.type.toLowerCase();
|
||||
return name.includes(searchTerm.toLowerCase()) || type.includes(searchTerm.toLowerCase());
|
||||
const description = result.description.toLowerCase();
|
||||
return (
|
||||
name.includes(trimmedSearchTerm) || type.includes(trimmedSearchTerm) || description.includes(trimmedSearchTerm)
|
||||
);
|
||||
});
|
||||
}, [results, searchTerm]);
|
||||
|
||||
const handleSearch: ChangeEventHandler<HTMLInputElement> = useCallback((e) => {
|
||||
setSearchTerm(e.target.value.trim());
|
||||
setSearchTerm(e.target.value);
|
||||
}, []);
|
||||
|
||||
const clearSearch = useCallback(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user