diff --git a/src/modules/spotlight/SpotlightModule.tsx b/src/modules/spotlight/SpotlightModule.tsx index c6526257b..3fb03528e 100644 --- a/src/modules/spotlight/SpotlightModule.tsx +++ b/src/modules/spotlight/SpotlightModule.tsx @@ -1,8 +1,21 @@ -import { Button, Group } from '@mantine/core'; -import { IconSearch, IconBrandYoutube, IconDownload, IconMovie } from '@tabler/icons'; -import { SpotlightProvider, openSpotlight } from '@mantine/spotlight'; -import type { SpotlightAction } from '@mantine/spotlight'; -import { useState } from 'react'; +import { + ActionIcon, + Group, + Kbd, + Select, + Text, + TextInput, +} from '@mantine/core'; +import { + IconSearch, + IconBrandYoutube, + IconDownload, + IconMovie, + IconBrandGoogle, +} from '@tabler/icons'; +import { forwardRef, useState } from 'react'; +import { useHotkeys } from '@mantine/hooks'; +import { showNotification } from '@mantine/notifications'; import { IModule } from '../ModuleTypes'; export const SpotlightModule: IModule = { @@ -12,95 +25,157 @@ export const SpotlightModule: IModule = { id: 'spotlight', }; -interface SearchEngine { - name: string; - enabled: boolean; - description: string; - icon: React.ReactNode; - url: string; - shortcut: string; -} -const searchEngines: SearchEngine[] = [ +const searchEngines = [ { - name: 'Google', - enabled: true, + label: 'Google', + disabled: false, description: 'Search using your search engine (defined in settings)', icon: , url: 'https://www.google.com/search?q=', shortcut: 'g', }, { - name: 'Youtube', - enabled: true, + label: 'Youtube', + disabled: false, description: 'Search Youtube', icon: , url: 'https://www.youtube.com/results?search_query=', shortcut: 'y', }, { - name: 'Download', - enabled: true, + label: 'Download', + disabled: false, description: 'Search for torrents', icon: , url: 'https://1337x.to/search/', shortcut: 't', }, { - name: 'Movies', + label: 'Movies', + disabled: true, + description: 'Search for movies using Overseerr', icon: , - enabled: false, + url: 'https://www.imdb.com/find?q=', + shortcut: 'm', + }, +]; + +const data: ItemProps[] = [ + { + icon: , + disabled: false, + label: 'Google', + value: 'google', + description: 'Search using your search engine (defined in settings)', + url: 'https://www.google.com/search?q=', + shortcut: 'g', + }, + + { + icon: , + disabled: false, + label: 'Download', + value: 'download', + description: 'Search for torrents', + url: 'https://1337x.to/search/', + shortcut: 't', + }, + { + icon: , + disabled: false, + label: 'Youtube', + value: 'youtube', + description: 'Search Youtube', + url: 'https://www.youtube.com/results?search_query=', + shortcut: 'y', + }, + { + icon: , + disabled: true, + label: 'Movies', + value: 'movies', description: 'Search for movies using Overseerr', url: 'https://www.imdb.com/find?q=', shortcut: 'm', }, ]; -function SpotlightControl() { +interface ItemProps extends React.ComponentPropsWithoutRef<'div'> { + label: string; + disabled: boolean; + value: string; + description: string; + icon: React.ReactNode; + url: string; + shortcut: string; +} + +export function SpotlightModuleComponent(props: any) { + const [selectedSearchEngine, setSearchEngine] = useState(data[0]); + + const SelectItem = forwardRef( + ({ icon, label, description, shortcut, ...others }: ItemProps, ref) => ( +
+ + + {icon} +
+ {label} + + {description} + +
+
+ {shortcut} +
+
+ ) + ); + + const [opened, setOpened] = useState(false); + useHotkeys([['mod+K', () => setOpened(!opened)]]); return ( - - + +