From b5540a9958f4e2baf83c3a48318c4c50acdaa59d Mon Sep 17 00:00:00 2001 From: Aimsucks Date: Tue, 14 Jun 2022 17:01:30 +0000 Subject: [PATCH 01/21] :bug: Origin URL in calendar to includes path Changed the origin variable in the calendar module to use the entire URL instead of just the origin domain --- src/pages/api/modules/calendar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/modules/calendar.ts b/src/pages/api/modules/calendar.ts index 7c48008b585..70d2c2f4cf4 100644 --- a/src/pages/api/modules/calendar.ts +++ b/src/pages/api/modules/calendar.ts @@ -44,7 +44,7 @@ async function Post(req: NextApiRequest, res: NextApiResponse) { }); } // Get the origin URL - const { origin } = new URL(service.url); + const { href: origin } = new URL(service.url); const pined = `${origin}${url?.url}?apiKey=${service.apiKey}&end=${nextMonth}&start=${lastMonth}`; const data = await axios.get( `${origin}${url?.url}?apiKey=${service.apiKey}&end=${nextMonth}&start=${lastMonth}` From bd920dfc869ad085885c96e4094701f5a947eae9 Mon Sep 17 00:00:00 2001 From: Aimsucks Date: Tue, 14 Jun 2022 17:45:22 +0000 Subject: [PATCH 02/21] :sparkles: App card width slider Added a slider to determine the XL app card width --- src/components/AppShelf/AppShelf.tsx | 9 +++- src/components/Settings/AdvancedSettings.tsx | 2 + .../Settings/AppCardWidthSelector.tsx | 41 +++++++++++++++++++ src/tools/types.ts | 1 + 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/components/Settings/AppCardWidthSelector.tsx diff --git a/src/components/AppShelf/AppShelf.tsx b/src/components/AppShelf/AppShelf.tsx index 97b02899750..b46259291c0 100644 --- a/src/components/AppShelf/AppShelf.tsx +++ b/src/components/AppShelf/AppShelf.tsx @@ -101,7 +101,14 @@ const AppShelf = (props: any) => { {filtered.map((service) => ( - + ))} diff --git a/src/components/Settings/AdvancedSettings.tsx b/src/components/Settings/AdvancedSettings.tsx index b00a1193335..ad45174579a 100644 --- a/src/components/Settings/AdvancedSettings.tsx +++ b/src/components/Settings/AdvancedSettings.tsx @@ -3,6 +3,7 @@ import { useForm } from '@mantine/form'; import { useConfig } from '../../tools/state'; import { ColorSelector } from './ColorSelector'; import { OpacitySelector } from './OpacitySelector'; +import { AppCardWidthSelector } from './AppCardWidthSelector'; import { ShadeSelector } from './ShadeSelector'; export default function TitleChanger() { @@ -58,6 +59,7 @@ export default function TitleChanger() { + ); } diff --git a/src/components/Settings/AppCardWidthSelector.tsx b/src/components/Settings/AppCardWidthSelector.tsx new file mode 100644 index 00000000000..5d1b9a06659 --- /dev/null +++ b/src/components/Settings/AppCardWidthSelector.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import { Group, Text, Slider } from '@mantine/core'; +import { useConfig } from '../../tools/state'; + +export function AppCardWidthSelector() { + const { config, setConfig } = useConfig(); + + const MARKS = [ + { value: 1, label: '1' }, + { value: 2, label: '2' }, + { value: 3, label: '3' }, + { value: 4, label: '4' }, + { value: 6, label: '6' }, + { value: 12, label: '12' }, + ]; + + const setappCardWidth = (appCardWidth: number) => { + setConfig({ + ...config, + settings: { + ...config.settings, + appCardWidth, + }, + }); + }; + + return ( + + App Width + setappCardWidth(value)} + /> + + ); +} diff --git a/src/tools/types.ts b/src/tools/types.ts index 92d5345acb7..4cb8a8291bd 100644 --- a/src/tools/types.ts +++ b/src/tools/types.ts @@ -12,6 +12,7 @@ export interface Settings { background?: string; appOpacity?: number; widgetPosition?: string; + appCardWidth?: number; } export interface Config { From 8ec2b9d0cdc361dac9f4f260bb679c2920202ddf Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 14 Jun 2022 20:33:26 +0200 Subject: [PATCH 03/21] =?UTF-8?q?=F0=9F=94=A7=20Make=20credentials=20non-r?= =?UTF-8?q?equired=20for=20torrents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #201 --- src/components/AppShelf/AddAppShelfItem.tsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index be6034f6bf7..9b86ab5faef 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -276,7 +276,9 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & )} - {form.values.type === 'qBittorrent' && ( + {(form.values.type === 'Deluge' || + form.values.type === 'Transmission' || + form.values.type === 'qBittorrent') && ( <> void } & error={form.errors.username && 'Invalid username'} /> { - form.setFieldValue('password', event.currentTarget.value); - }} - error={form.errors.password && 'Invalid password'} - /> - - )} - {(form.values.type === 'Deluge' || form.values.type === 'Transmission') && ( - <> - Date: Tue, 14 Jun 2022 20:50:11 +0200 Subject: [PATCH 04/21] =?UTF-8?q?=E2=9C=A8=20Configure=20calendar=20widget?= =?UTF-8?q?=20to=20show=20Sunday=20first=20Fixes=20#217?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/calendar/CalendarModule.tsx | 16 ++++++++++++++++ src/components/modules/moduleWrapper.tsx | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/modules/calendar/CalendarModule.tsx b/src/components/modules/calendar/CalendarModule.tsx index a0b6574d178..1d230858607 100644 --- a/src/components/modules/calendar/CalendarModule.tsx +++ b/src/components/modules/calendar/CalendarModule.tsx @@ -29,6 +29,12 @@ export const CalendarModule: IModule = { 'A calendar module for displaying upcoming releases. It interacts with the Sonarr and Radarr API.', icon: CalendarIcon, component: CalendarComponent, + options: { + sundaystart: { + name: 'Start the week on Sunday', + value: false, + }, + }, }; export default function CalendarComponent(props: any) { @@ -104,8 +110,11 @@ export default function CalendarComponent(props: any) { }); }, [config.services]); + const weekStartsAtSunday = + (config?.modules?.[CalendarModule.title]?.options?.sundaystart?.value as boolean) ?? false; return ( {}} dayStyle={(date) => date.getDay() === today.getDay() && date.getDate() === today.getDate() @@ -115,6 +124,13 @@ export default function CalendarComponent(props: any) { } : {} } + styles={{ + calendarHeader: { + marginRight: 15, + marginLeft: 15, + }, + }} + allowLevelChange={false} dayClassName={(date, modifiers) => cx({ [classes.weekend]: modifiers.weekend })} renderDay={(renderdate) => ( From 4981823c37df39ea7dc610ac95edadb8a19945a2 Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 14 Jun 2022 22:09:30 +0200 Subject: [PATCH 05/21] =?UTF-8?q?=F0=9F=94=A7=20Tweak=20values=20on=20the?= =?UTF-8?q?=20slider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Settings/AppCardWidthSelector.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/Settings/AppCardWidthSelector.tsx b/src/components/Settings/AppCardWidthSelector.tsx index 5d1b9a06659..f2f30ff01ee 100644 --- a/src/components/Settings/AppCardWidthSelector.tsx +++ b/src/components/Settings/AppCardWidthSelector.tsx @@ -6,12 +6,12 @@ export function AppCardWidthSelector() { const { config, setConfig } = useConfig(); const MARKS = [ - { value: 1, label: '1' }, - { value: 2, label: '2' }, - { value: 3, label: '3' }, - { value: 4, label: '4' }, - { value: 6, label: '6' }, - { value: 12, label: '12' }, + { value: 0.8 }, + { value: 1 }, + { value: 1.2 }, + { value: 1.4 }, + { value: 1.6 }, + { value: 2 }, ]; const setappCardWidth = (appCardWidth: number) => { @@ -28,10 +28,11 @@ export function AppCardWidthSelector() { App Width setappCardWidth(value)} From ca2713a12c7371dd7f619a219c5c3e6fa14f9e4e Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 14 Jun 2022 22:11:55 +0200 Subject: [PATCH 06/21] =?UTF-8?q?=F0=9F=90=9B=20Cannot=20open=20"New=20Tab?= =?UTF-8?q?=20URL"=20on=20mobile=20Fixes=20#202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppShelf/AppShelfItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AppShelf/AppShelfItem.tsx b/src/components/AppShelf/AppShelfItem.tsx index 8ad389a190c..ea8fb4fcebc 100644 --- a/src/components/AppShelf/AppShelfItem.tsx +++ b/src/components/AppShelf/AppShelfItem.tsx @@ -84,7 +84,7 @@ export function AppShelfItem(props: any) { From 5133286e04f24ffdf137496b53cf79f5bab65f7e Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 14 Jun 2022 22:45:31 +0200 Subject: [PATCH 07/21] =?UTF-8?q?=F0=9F=90=9BTiles=20could=20be=20moved=20?= =?UTF-8?q?accidentally=20on=20mobiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #214 --- src/components/AppShelf/AppShelf.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/AppShelf/AppShelf.tsx b/src/components/AppShelf/AppShelf.tsx index 97b02899750..b32454c4730 100644 --- a/src/components/AppShelf/AppShelf.tsx +++ b/src/components/AppShelf/AppShelf.tsx @@ -44,11 +44,16 @@ const AppShelf = (props: any) => { const { colorScheme } = useMantineColorScheme(); const sensors = useSensors( - useSensor(TouchSensor, {}), + useSensor(TouchSensor, { + activationConstraint: { + delay: 500, + tolerance: 5, + }, + }), useSensor(MouseSensor, { // Require the mouse to move by 10 pixels before activating activationConstraint: { - delay: 250, + delay: 500, tolerance: 5, }, }) From 4980254e89bb28a9b33902f4208e8c0847477da0 Mon Sep 17 00:00:00 2001 From: Larvey Date: Tue, 14 Jun 2022 21:14:26 -0400 Subject: [PATCH 08/21] Update DownloadsModule.tsx --- src/components/modules/downloads/DownloadsModule.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/modules/downloads/DownloadsModule.tsx b/src/components/modules/downloads/DownloadsModule.tsx index f6db402ab70..042ad4b7466 100644 --- a/src/components/modules/downloads/DownloadsModule.tsx +++ b/src/components/modules/downloads/DownloadsModule.tsx @@ -158,7 +158,7 @@ export default function DownloadComponent() { Date: Wed, 15 Jun 2022 06:47:53 +0200 Subject: [PATCH 09/21] =?UTF-8?q?=F0=9F=90=9B=20Fix=20required=20username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppShelf/AddAppShelfItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 9b86ab5faef..1106bb0db76 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -281,7 +281,6 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & form.values.type === 'qBittorrent') && ( <> Date: Thu, 16 Jun 2022 21:02:30 -0400 Subject: [PATCH 10/21] Fix CalendarModule.tsx Fix no content showing when 1 of the same service is down. --- src/components/modules/calendar/CalendarModule.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/modules/calendar/CalendarModule.tsx b/src/components/modules/calendar/CalendarModule.tsx index 1d230858607..f7bf5fe3a13 100644 --- a/src/components/modules/calendar/CalendarModule.tsx +++ b/src/components/modules/calendar/CalendarModule.tsx @@ -73,6 +73,8 @@ export default function CalendarComponent(props: any) { sonarrServices.map((service) => getMedias(service, 'sonarr').then((res) => { currentSonarrMedias.push(...res.data); + }).catch(() => { + currentSonarrMedias.push([]); }) ) ).then(() => { @@ -83,6 +85,8 @@ export default function CalendarComponent(props: any) { radarrServices.map((service) => getMedias(service, 'radarr').then((res) => { currentRadarrMedias.push(...res.data); + }).catch(() => { + currentRadarrMedias.push([]); }) ) ).then(() => { @@ -93,6 +97,8 @@ export default function CalendarComponent(props: any) { lidarrServices.map((service) => getMedias(service, 'lidarr').then((res) => { currentLidarrMedias.push(...res.data); + }).catch(() => { + currentLidarrMedias.push([]); }) ) ).then(() => { @@ -103,6 +109,8 @@ export default function CalendarComponent(props: any) { readarrServices.map((service) => getMedias(service, 'readarr').then((res) => { currentReadarrMedias.push(...res.data); + }).catch(() => { + currentReadarrMedias.push([]); }) ) ).then(() => { From 4516dde1f4fd86125691f407bf99966043824cec Mon Sep 17 00:00:00 2001 From: Larvey Date: Thu, 16 Jun 2022 15:38:50 -0400 Subject: [PATCH 11/21] Reworked AddAppShelfItem Adds: - Advanced Options tab - Changed which ping status codes identify as "Online" - Change if service opens in new tab or not Fixes: - Deluge and Transmission Password requirement --- src/components/AppShelf/AddAppShelfItem.tsx | 264 +++++++++++------- src/components/AppShelf/AppShelfItem.tsx | 13 +- src/components/AppShelf/AppShelfMenu.tsx | 2 + .../modules/ping/PingModule.story.tsx | 1 + src/components/modules/ping/PingModule.tsx | 31 +- src/pages/api/modules/downloads.ts | 4 +- src/pages/api/modules/ping.ts | 4 +- src/tools/types.ts | 28 ++ 8 files changed, 230 insertions(+), 117 deletions(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 1106bb0db76..e1d70382db4 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -12,6 +12,8 @@ import { Title, Anchor, Text, + Tabs, + MultiSelect, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { useEffect, useState } from 'react'; @@ -19,7 +21,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 } from '../../tools/types'; +import { ServiceTypeList, statusCodes, targets } from '../../tools/types'; export function AddItemShelfButton(props: any) { const [opened, setOpened] = useState(false); @@ -113,6 +115,8 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & username: props.username ?? (undefined as unknown as string), password: props.password ?? (undefined as unknown as string), openedUrl: props.openedUrl ?? (undefined as unknown as string), + status: props.status ?? ['200'], + target: props.target ?? '_blank', }, validate: { apiKey: () => null, @@ -133,6 +137,12 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & } return null; }, + status: (value: string[]) => { + if (!value.length) { + return 'Please select a status code'; + } + return null; + }, }, }); @@ -191,117 +201,165 @@ 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'} + label="Icon URL" + placeholder="/favicon.svg" + {...form.getInputProps('icon')} /> - - Tip: Get your API key{' '} - - here. - - - - )} - {(form.values.type === 'Deluge' || - form.values.type === 'Transmission' || - form.values.type === 'qBittorrent') && ( - <> { - form.setFieldValue('username', event.currentTarget.value); - }} - error={form.errors.username && 'Invalid username'} + required + label="Service URL" + placeholder="http://localhost:7575" + {...form.getInputProps('url')} /> { - form.setFieldValue('password', event.currentTarget.value); + label="New tab URL" + placeholder="http://sonarr.example.com" + {...form.getInputProps('openedUrl')} + /> + { + e.preventDefault(); }} - error={form.errors.password && 'Invalid password'} + 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'} + /> + { + form.setFieldValue('password', event.currentTarget.value); + }} + error={form.errors.password && 'Invalid password'} + /> + + )} + {(form.values.type === 'Deluge' || + form.values.type === 'Transmission' || + form.values.type === 'qBittorrent') && ( + <> + { + form.setFieldValue('username', event.currentTarget.value); + }} + error={form.errors.username && 'Invalid username'} + /> + { + form.setFieldValue('password', event.currentTarget.value); + }} + error={form.errors.password && 'Invalid password'} + /> + + )} + + + + + Date: Thu, 16 Jun 2022 16:54:07 -0400 Subject: [PATCH 13/21] declutter config file --- src/components/AppShelf/AddAppShelfItem.tsx | 145 ++++++++++-------- .../modules/ping/PingModule.story.tsx | 1 + 2 files changed, 80 insertions(+), 66 deletions(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 50013e63915..e8fa3973040 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -178,6 +178,12 @@ 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 service already exists, update it. if (config.services && config.services.find((s) => s.id === form.values.id)) { setConfig({ @@ -202,7 +208,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & form.reset(); })} > - + @@ -213,70 +219,77 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & {...form.getInputProps('name')} /> - - - - { - 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'} - /> - + + + { + 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. @@ -332,12 +345,12 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } & placeholder="Select valid status codes" clearButtonLabel="Clear selection" nothingFound="Nothing found" + defaultValue={['200']} clearable searchable {...form.getInputProps('status')} /> Date: Mon, 20 Jun 2022 09:52:05 +0200 Subject: [PATCH 15/21] =?UTF-8?q?=F0=9F=94=A7=20Tweak=20UI=20and=20change?= =?UTF-8?q?=20the=20name=20of=20the=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppShelf/AddAppShelfItem.tsx | 282 ++++++++++---------- src/components/AppShelf/AppShelfItem.tsx | 12 +- src/components/AppShelf/AppShelfMenu.tsx | 13 +- src/pages/api/modules/ping.ts | 6 +- src/tools/types.ts | 4 +- 5 files changed, 153 insertions(+), 164 deletions(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 0c8071c83c2..cff74d57aea 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'} + label="Service name" + placeholder="Plex" + {...form.getInputProps('name')} /> - - 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); + label="On Click URL" + placeholder="http://sonarr.example.com" + {...form.getInputProps('openedUrl')} + /> + { + e.preventDefault(); }} - error={form.errors.password && 'Invalid password'} + getCreateLabel={(query) => `+ Create "${query}"`} + onCreate={(query) => {}} + {...form.getInputProps('category')} /> - - )} - - - - - - -