diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index f2e09f581..fda372722 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -283,7 +283,7 @@
"quicklaunch": {
"bookmark": "Bookmark",
"service": "Service",
- "searchGoogle": "Search Google"
+ "search": "Search"
},
"wmo": {
"0-day": "Sunny",
diff --git a/src/components/quicklaunch.jsx b/src/components/quicklaunch.jsx
index b7dbba458..877b98e54 100644
--- a/src/components/quicklaunch.jsx
+++ b/src/components/quicklaunch.jsx
@@ -6,7 +6,7 @@ import ResolvedIcon from "./resolvedicon";
import { SettingsContext } from "utils/contexts/settings";
-export default function QuickLaunch({servicesAndBookmarks, searchString, setSearchString, isOpen, close, searchDescriptions}) {
+export default function QuickLaunch({servicesAndBookmarks, searchString, setSearchString, isOpen, close, searchDescriptions, searchProvider}) {
const { t } = useTranslation();
const { settings } = useContext(SettingsContext);
@@ -76,15 +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
- }
- )
+ if (searchProvider) {
+ newResults.push(
+ {
+ href: searchProvider.url + encodeURIComponent(searchString),
+ name: `${searchProvider.name} ${t("quicklaunch.search")} `,
+ type: 'search',
+ }
+ )
+ }
setResults(newResults);
@@ -92,7 +92,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
setCurrentItemIndex(0);
}
}
- }, [searchString, servicesAndBookmarks, searchDescriptions, t]);
+ }, [searchString, servicesAndBookmarks, searchDescriptions, searchProvider, t]);
const [hidden, setHidden] = useState(true);
@@ -145,10 +145,10 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
i === currentItemIndex && "bg-theme-300/50 dark:bg-theme-700/50",
)} onClick={handleItemClick}>
-
+ {(r.icon || r.abbr) &&
{r.icon && }
{r.abbr && r.abbr}
-
+
}
{r.name}
{r.description &&
@@ -158,7 +158,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
}
- {r.type === 'service' ? t("quicklaunch.service") : t("quicklaunch.bookmark")}
+ {t(`quicklaunch.${r.type ? r.type.toLowerCase() : 'bookmark'}`)}
))}
diff --git a/src/components/widgets/search/search.jsx b/src/components/widgets/search/search.jsx
index 11cd7e606..dfb18367e 100644
--- a/src/components/widgets/search/search.jsx
+++ b/src/components/widgets/search/search.jsx
@@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
import { FiSearch } from "react-icons/fi";
import { SiDuckduckgo, SiMicrosoftbing, SiGoogle, SiBaidu, SiBrave } from "react-icons/si";
-const providers = {
+export const searchProviders = {
google: {
name: "Google",
url: "https://www.google.com/search?q=",
@@ -39,7 +39,7 @@ const providers = {
export default function Search({ options }) {
const { t } = useTranslation();
- const provider = providers[options.provider];
+ const provider = searchProviders[options.provider];
const [query, setQuery] = useState("");
if (!provider) {
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index b6a1881ae..7db02ef44 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -22,6 +22,7 @@ import { bookmarksResponse, servicesResponse, widgetsResponse } from "utils/conf
import ErrorBoundary from "components/errorboundry";
import themes from "utils/styles/themes";
import QuickLaunch from "components/quicklaunch";
+import { searchProviders } from "components/widgets/search/search";
const ThemeToggle = dynamic(() => import("components/toggles/theme"), {
ssr: false,
@@ -193,6 +194,11 @@ function Home({ initialSettings }) {
const [searching, setSearching] = useState(false);
const [searchString, setSearchString] = useState("");
+ let searchProvider = null;
+ const searchWidget = Object.values(widgets).find(w => w.type === "search");
+ if (searchWidget) {
+ searchProvider = searchProviders[searchWidget.options?.provider];
+ }
useEffect(() => {
function handleKeyDown(e) {
@@ -251,6 +257,7 @@ function Home({ initialSettings }) {
isOpen={searching}
close={setSearching}
searchDescriptions={settings.quicklaunch?.searchDescriptions}
+ searchProvider={settings.quicklaunch?.hideInternetSearch ? null : searchProvider}
/>
{widgets && (
<>