From 0b4dd8c78ff945949b4bfd89a663317d6042555d Mon Sep 17 00:00:00 2001 From: axolotle Date: Sat, 20 Jan 2024 14:38:38 +0100 Subject: [PATCH] home: add search engine bar --- assets/icons/magnify.svg | 1 + composables/states.ts | 2 ++ locales/en.json | 2 ++ pages/index.vue | 31 ++++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 assets/icons/magnify.svg diff --git a/assets/icons/magnify.svg b/assets/icons/magnify.svg new file mode 100644 index 0000000..3cb7089 --- /dev/null +++ b/assets/icons/magnify.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/composables/states.ts b/composables/states.ts index 3207e7d..ff2f32b 100644 --- a/composables/states.ts +++ b/composables/states.ts @@ -84,6 +84,8 @@ export interface Settings { portal_logo?: string portal_theme: string portal_title?: string + search_engine?: string + search_engine_name?: string show_other_domains_apps: 0 | 1 portal_user_intro: string portal_public_intro: string diff --git a/locales/en.json b/locales/en.json index e304870..69306e2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -45,6 +45,8 @@ "primary_mail_adress": "Primary mail adress", "remove": "Remove", "save": "Save", + "search": "Search", + "search_engine_placeholder": "Search on {engine}", "skip_link": { "main_content": "Skip to main content", "footer": "Skip to footer" diff --git a/pages/index.vue b/pages/index.vue index 24820b4..280103d 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -3,7 +3,7 @@ definePageMeta({ public: true, }) -const { t } = useI18n() +const { t, locale } = useI18n() const isLoggedIn = await useIsLoggedIn() const settings = await useSettings() const appsData = await useApps() @@ -28,12 +28,41 @@ const apps = Object.entries(appsData.value).map(([id, app]) => { description: app.description[locale.value] || app.description.en } }) + +const search = ref('') + +async function onSearchSubmit() { + await navigateTo( + settings.value.search_engine + search.value, + { + open: { + target: '_blank', + } + } + ) +}