Apps and tags are suggested in global search.

This commit is contained in:
Roland 2023-11-20 11:29:14 -07:00
parent d042b06e8b
commit fdfb8797fe
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
7 changed files with 68 additions and 15 deletions

View file

@ -413,10 +413,10 @@ export function SearchInput({
onClear = null,
onChange = null,
results = null,
handleResultSelect = null,
...props
}) {
const [value, setValue] = useState(searchStr || '');
const navigate = useNavigate();
const handleChange = (e) => {
if (e) {
@ -455,19 +455,13 @@ export function SearchInput({
}
}
const localHandleResultSelect = (e, {result}) => {
const localHandleResultSelect = (e, data) => {
if (e) {
e.preventDefault();
}
if (!result) {
return;
}
if (result['type'] === 'channel') {
navigate(`/videos/channel/${result['id']}/video`);
} else if (result['type'] === 'domain') {
navigate(`/archive?domain=${result['domain']}`);
console.debug(`Selected result`, data);
if (handleResultSelect) {
handleResultSelect(data);
}
}