diff --git a/src/components/Settings/Common/SearchEngineEnabledSwitch.tsx b/src/components/Settings/Common/SearchEngineEnabledSwitch.tsx deleted file mode 100644 index 147d63d79..000000000 --- a/src/components/Settings/Common/SearchEngineEnabledSwitch.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Switch } from '@mantine/core'; -import { useTranslation } from 'next-i18next'; -import { useState } from 'react'; -import { useConfigContext } from '../../../config/provider'; -import { useConfigStore } from '../../../config/store'; -import { SearchEngineCommonSettingsType } from '../../../types/settings'; - -interface SearchEnabledSwitchProps { - defaultValue: boolean | undefined; -} - -export function SearchEnabledSwitch({ defaultValue }: SearchEnabledSwitchProps) { - const { t } = useTranslation('settings/general/search-engine'); - const { name: configName } = useConfigContext(); - const updateConfig = useConfigStore((x) => x.updateConfig); - - const [enabled, setEnabled] = useState(defaultValue ?? true); - - if (!configName) return null; - - const toggleEnabled = () => { - setEnabled(!enabled); - updateConfig(configName, (prev) => ({ - ...prev, - settings: { - ...prev.settings, - common: { - ...prev.settings.common, - searchEngine: { - ...prev.settings.common.searchEngine, - properties: { - ...prev.settings.common.searchEngine.properties, - enabled: !enabled, - }, - } as SearchEngineCommonSettingsType, - }, - }, - })); - }; - - return ( - - ); -} diff --git a/src/components/Settings/Common/SearchEngineSelector.tsx b/src/components/Settings/Common/SearchEngineSelector.tsx index 763e177e4..5f25a1044 100644 --- a/src/components/Settings/Common/SearchEngineSelector.tsx +++ b/src/components/Settings/Common/SearchEngineSelector.tsx @@ -1,4 +1,4 @@ -import { Alert, Paper, SegmentedControl, Stack, TextInput, Title } from '@mantine/core'; +import { Alert, Paper, SegmentedControl, Space, Stack, TextInput, Title } from '@mantine/core'; import { IconInfoCircle } from '@tabler/icons'; import { useTranslation } from 'next-i18next'; import { ChangeEventHandler, useState } from 'react'; @@ -9,12 +9,12 @@ import { SearchEngineCommonSettingsType, } from '../../../types/settings'; import Tip from '../../layout/Tip'; +import { SearchNewTabSwitch } from './SearchNewTabSwitch'; interface Props { searchEngine: SearchEngineCommonSettingsType; } -// TODO: discuss with @manuel-rw the design of the search engine export const SearchEngineSelector = ({ searchEngine }: Props) => { const { t } = useTranslation(['settings/general/search-engine']); const { updateSearchEngineConfig } = useUpdateSearchEngineConfig(); @@ -49,18 +49,26 @@ export const SearchEngineSelector = ({ searchEngine }: Props) => { onChange={onEngineChange} data={searchEngineOptions} /> - {engine === 'custom' && ( - - {t('customEngine.title')} - {t('tips.placeholderTip')} - - - )} + + + Search engine configuration + + + + + {engine === 'custom' && ( + <> + + + + )} + } color="blue"> {t('tips.generalTip')} @@ -87,10 +95,11 @@ const useUpdateSearchEngineConfig = () => { const { name: configName } = useConfigContext(); const updateConfig = useConfigStore((x) => x.updateConfig); - if (!configName) + if (!configName) { return { updateSearchEngineConfig: () => {}, }; + } const updateSearchEngineConfig = (engine: EngineType, searchUrl: string) => { updateConfig(configName, (prev) => ({ diff --git a/src/components/Settings/Common/SearchNewTabSwitch.tsx b/src/components/Settings/Common/SearchNewTabSwitch.tsx index d30292fe7..a3d5cdc72 100644 --- a/src/components/Settings/Common/SearchNewTabSwitch.tsx +++ b/src/components/Settings/Common/SearchNewTabSwitch.tsx @@ -42,7 +42,6 @@ export function SearchNewTabSwitch({ defaultValue }: SearchNewTabSwitchProps) { ); diff --git a/src/components/Settings/CommonSettings.tsx b/src/components/Settings/CommonSettings.tsx index c8b8159d4..cdbef53f7 100644 --- a/src/components/Settings/CommonSettings.tsx +++ b/src/components/Settings/CommonSettings.tsx @@ -3,7 +3,6 @@ import { useConfigContext } from '../../config/provider'; import ConfigChanger from '../Config/ConfigChanger'; import ConfigActions from './Common/ConfigActions'; import LanguageSelect from './Common/LanguageSelect'; -import { SearchEnabledSwitch } from './Common/SearchEngineEnabledSwitch'; import { SearchEngineSelector } from './Common/SearchEngineSelector'; import { SearchNewTabSwitch } from './Common/SearchNewTabSwitch'; @@ -21,10 +20,6 @@ export default function CommonSettings() { return ( - - diff --git a/src/components/layout/header/Search.tsx b/src/components/layout/header/Search.tsx index e9641cc2b..e9b5f6a84 100644 --- a/src/components/layout/header/Search.tsx +++ b/src/components/layout/header/Search.tsx @@ -56,6 +56,8 @@ export function Search() { const [debounced, cancel] = useDebouncedValue(searchQuery, 250); // TODO: ask manuel-rw about overseerr + // Answer: We can simply check if there is a service of the type overseer and display results if there is one. + // Overseerr is not use anywhere else, so it makes no sense to add a standalone toggle for displaying results const isOverseerrEnabled = false; //config?.settings.common.enabledModules.overseerr; const overseerrService = config?.services.find( (service) =>