Support custom search in quicklaunch web search

pull/899/head
shamoon 2 years ago
parent 9b8e01971f
commit 1f5912c232

@ -283,7 +283,8 @@
"quicklaunch": { "quicklaunch": {
"bookmark": "Bookmark", "bookmark": "Bookmark",
"service": "Service", "service": "Service",
"search": "Search" "search": "Search",
"custom": "Custom"
}, },
"wmo": { "wmo": {
"0-day": "Sunny", "0-day": "Sunny",

@ -80,7 +80,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
newResults.push( newResults.push(
{ {
href: searchProvider.url + encodeURIComponent(searchString), href: searchProvider.url + encodeURIComponent(searchString),
name: `${searchProvider.name} ${t("quicklaunch.search")} `, name: `${searchProvider.name ?? t("quicklaunch.custom")} ${t("quicklaunch.search")} `,
type: 'search', type: 'search',
} }
) )

@ -197,8 +197,14 @@ function Home({ initialSettings }) {
let searchProvider = null; let searchProvider = null;
const searchWidget = Object.values(widgets).find(w => w.type === "search"); const searchWidget = Object.values(widgets).find(w => w.type === "search");
if (searchWidget) { if (searchWidget) {
if (searchWidget.options?.provider === 'custom') {
searchProvider = {
url: searchWidget.options.url
}
} else {
searchProvider = searchProviders[searchWidget.options?.provider]; searchProvider = searchProviders[searchWidget.options?.provider];
} }
}
useEffect(() => { useEffect(() => {
function handleKeyDown(e) { function handleKeyDown(e) {

Loading…
Cancel
Save