diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 0c8071c83..cff74d57a 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -15,6 +15,7 @@ import { Tabs, MultiSelect, ScrollArea, + Switch, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { useEffect, useState } from 'react'; @@ -22,7 +23,7 @@ import { IconApps as Apps } from '@tabler/icons'; import { v4 as uuidv4 } from 'uuid'; import { useDebouncedValue } from '@mantine/hooks'; import { useConfig } from '../../tools/state'; -import { ServiceTypeList, StatusCodes, Targets } from '../../tools/types'; +import { ServiceTypeList, StatusCodes } from '../../tools/types'; export function AddItemShelfButton(props: any) { const [opened, setOpened] = useState(false); @@ -117,7 +118,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & password: props.password ?? (undefined as unknown as string), openedUrl: props.openedUrl ?? (undefined as unknown as string), status: props.status ?? ['200'], - target: props.target ?? '_blank', + newTab: props.newTab ?? true, }, validate: { apiKey: () => null, @@ -181,8 +182,8 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & if (JSON.stringify(form.values.status) === JSON.stringify(['200'])) { form.values.status = undefined; } - if (form.values.target === '_blank') { - form.values.target = undefined; + if (form.values.newTab === true) { + form.values.newTab = undefined; } // If service already exists, update it. if (config.services && config.services.find((s) => s.id === form.values.id)) { @@ -208,155 +209,154 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & form.reset(); })} > - - - - - + + + + + - - - - { - e.preventDefault(); - }} - getCreateLabel={(query) => `+ Create "${query}"`} - onCreate={(query) => {}} - {...form.getInputProps('category')} - /> - - {(form.values.type === 'Sonarr' || - form.values.type === 'Radarr' || - form.values.type === 'Lidarr' || - form.values.type === 'Readarr') && ( - <> { - form.setFieldValue('apiKey', event.currentTarget.value); - }} - error={form.errors.apiKey && 'Invalid API key'} - /> - - Tip: Get your API key{' '} - - here. - - - - )} - {form.values.type === 'qBittorrent' && ( - <> - { - form.setFieldValue('username', event.currentTarget.value); - }} - error={form.errors.username && 'Invalid username'} + label="Icon URL" + placeholder="/favicon.svg" + {...form.getInputProps('icon')} /> { - form.setFieldValue('password', event.currentTarget.value); - }} - error={form.errors.password && 'Invalid password'} + label="Service URL" + placeholder="http://localhost:7575" + {...form.getInputProps('url')} /> - - )} - {(form.values.type === 'Deluge' || form.values.type === 'Transmission') && ( - <> { - form.setFieldValue('password', event.currentTarget.value); - }} - error={form.errors.password && 'Invalid password'} + label="On Click URL" + placeholder="http://sonarr.example.com" + {...form.getInputProps('openedUrl')} /> - - )} - - - - - - - +