Added search to quicklaunch

pull/897/head
Alex Sinelnikov 2 years ago
parent 5af01d2436
commit 4e17628f97

@ -282,7 +282,8 @@
},
"quicklaunch": {
"bookmark": "Bookmark",
"service": "Service"
"service": "Service",
"searchGoogle": "Search Google"
},
"wmo": {
"0-day": "Sunny",

@ -50,6 +50,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
}
}
function handleItemHover(event) {
setCurrentItemIndex(parseInt(event.target?.dataset?.index, 10));
}
@ -75,6 +76,15 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
if (searchDescriptions) {
newResults = newResults.sort((a, b) => b.priority - a.priority);
}
newResults.push(
{
name: searchString,
href: `http://google.com/search?q=${searchString}`,
description: t("quicklaunch.searchGoogle"),
type: 'service',
weight: 1
}
)
setResults(newResults);
@ -82,7 +92,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
setCurrentItemIndex(0);
}
}
}, [searchString, servicesAndBookmarks, searchDescriptions]);
}, [searchString, servicesAndBookmarks, searchDescriptions, t]);
const [hidden, setHidden] = useState(true);

Loading…
Cancel
Save