Skip to content

Commit

Permalink
feat: not search builtin keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Apr 24, 2023
1 parent 6c25819 commit 7ef9ccc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/app/src/components/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Resource } from 'animegarden';

import { Command } from 'cmdk';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';

import '../styles/cmdk.css';

Expand All @@ -26,8 +26,14 @@ export default function Search() {
const onSearchChange = useCallback((value: string) => {
setSearch(value);
if (value) {
setLoading(true);
searchResources(value);
const hasBuiltin =
fansubs.some((f) => f.name.includes(value)) || types.some((t) => t.includes(value));
if (!hasBuiltin) {
setLoading(true);
searchResources(value);
} else {
setLoading(false);
}
}
}, []);

Expand Down

0 comments on commit 7ef9ccc

Please sign in to comment.