✏ Fix typos

This commit is contained in:
Aj - Thomas
2022-05-16 12:38:46 +02:00
committed by ajnart
parent 509873db55
commit e786b1e44f
2 changed files with 18 additions and 17 deletions

View File

@@ -8,11 +8,11 @@ export default function SearchBar(props: any) {
const { config, setConfig } = useConfig(); const { config, setConfig } = useConfig();
const [opened, setOpened] = useState(false); const [opened, setOpened] = useState(false);
const [icon, setIcon] = useState(<Search />); const [icon, setIcon] = useState(<Search />);
const querryUrl = config.settings.searchUrl || 'https://www.google.com/search?q='; const queryUrl = config.settings.searchUrl || 'https://www.google.com/search?q=';
const form = useForm({ const form = useForm({
initialValues: { initialValues: {
querry: '', query: '',
}, },
}); });
@@ -29,10 +29,10 @@ export default function SearchBar(props: any) {
> >
<form <form
onChange={() => { onChange={() => {
// If querry contains !yt or !t add "Searching on YouTube" or "Searching torrent" // If query contains !yt or !t add "Searching on YouTube" or "Searching torrent"
const querry = form.values.querry.trim(); const query = form.values.query.trim();
const isYoutube = querry.startsWith('!yt'); const isYoutube = query.startsWith('!yt');
const isTorrent = querry.startsWith('!t'); const isTorrent = query.startsWith('!t');
if (isYoutube) { if (isYoutube) {
setIcon(<BrandYoutube size={22} />); setIcon(<BrandYoutube size={22} />);
} else if (isTorrent) { } else if (isTorrent) {
@@ -42,16 +42,16 @@ export default function SearchBar(props: any) {
} }
}} }}
onSubmit={form.onSubmit((values) => { onSubmit={form.onSubmit((values) => {
// Find if querry is prefixed by !yt or !t // Find if query is prefixed by !yt or !t
const querry = values.querry.trim(); const query = values.query.trim();
const isYoutube = querry.startsWith('!yt'); const isYoutube = query.startsWith('!yt');
const isTorrent = querry.startsWith('!t'); const isTorrent = query.startsWith('!t');
if (isYoutube) { if (isYoutube) {
window.open(`https://www.youtube.com/results?search_query=${querry.substring(3)}`); window.open(`https://www.youtube.com/results?search_query=${query.substring(3)}`);
} else if (isTorrent) { } else if (isTorrent) {
window.open(`https://bitsearch.to/search?q=${querry.substring(3)}`); window.open(`https://bitsearch.to/search?q=${query.substring(3)}`);
} else { } else {
window.open(`${querryUrl}${values.querry}`); window.open(`${queryUrl}${values.query}`);
} }
})} })}
> >
@@ -76,7 +76,7 @@ export default function SearchBar(props: any) {
size="md" size="md"
placeholder="Search the web" placeholder="Search the web"
{...props} {...props}
{...form.getInputProps('querry')} {...form.getInputProps('query')}
/> />
} }
> >

View File

@@ -74,8 +74,8 @@ function SettingsMenu(props: any) {
/> />
{searchUrl === 'Custom' && ( {searchUrl === 'Custom' && (
<TextInput <TextInput
label="Querry URL" label="Query URL"
placeholder="Custom querry url" placeholder="Custom query url"
value={customSearchUrl} value={customSearchUrl}
onChange={(event) => { onChange={(event) => {
setCustomSearchUrl(event.currentTarget.value); setCustomSearchUrl(event.currentTarget.value);
@@ -142,7 +142,8 @@ export function SettingsMenuButton(props: any) {
return ( return (
<> <>
<Modal <Modal
size="md" size="xl"
radius="md"
title={<Title order={3}>Settings</Title>} title={<Title order={3}>Settings</Title>}
opened={props.opened || opened} opened={props.opened || opened}
onClose={() => setOpened(false)} onClose={() => setOpened(false)}