diff --git a/components/AppShelf/AddAppShelfItem.tsx b/components/AppShelf/AddAppShelfItem.tsx index e8eee7d87..2501ffbe8 100644 --- a/components/AppShelf/AddAppShelfItem.tsx +++ b/components/AppShelf/AddAppShelfItem.tsx @@ -22,15 +22,6 @@ export default function AddItemShelfItem(props: any) { const { addService } = useConfig(); const [opened, setOpened] = useState(false); const theme = useMantineTheme(); - const form = useForm({ - initialValues: { - type: 'Other', - name: '', - icon: '', - url: '', - apiKey: undefined as unknown as string, - }, - }); return ( <> setOpened(false)} title="Add a service" > -
- Placeholder -
-
{ - addService(form.values); - setOpened(false); - form.reset(); - })} - > - - form.setFieldValue('name', event.currentTarget.value)} - error={form.errors.name && 'Invalid name'} - /> - - { - form.setFieldValue('icon', event.currentTarget.value); - }} - error={form.errors.icon && 'Icon url is invalid'} - /> - form.setFieldValue('url', event.currentTarget.value)} - error={form.errors.url && 'Service url is invalid'} - /> - form.setFieldValue('type', value ?? 'Other')} + data={ServiceTypeList} + /> + {(form.values.type === 'Sonarr' || form.values.type === 'Radarr') && ( + form.setFieldValue('apiKey', event.currentTarget.value)} + error={form.errors.apiKey && 'Invalid API key'} + /> + )} + + + + + +
+ + ); +} diff --git a/components/AppShelf/AppShelf.tsx b/components/AppShelf/AppShelf.tsx index e78404a90..bf47a7c4c 100644 --- a/components/AppShelf/AppShelf.tsx +++ b/components/AppShelf/AppShelf.tsx @@ -103,7 +103,7 @@ export function AppShelfItem(props: any) { opacity: hovering ? 1 : 0, }} > - + diff --git a/components/AppShelf/AppShelfMenu.tsx b/components/AppShelf/AppShelfMenu.tsx index d11b7c2e7..95042ddf1 100644 --- a/components/AppShelf/AppShelfMenu.tsx +++ b/components/AppShelf/AppShelfMenu.tsx @@ -1,47 +1,63 @@ -import { Menu, Text } from '@mantine/core'; +import { Menu, Modal, Text } from '@mantine/core'; import { showNotification } from '@mantine/notifications'; +import { useState } from 'react'; import { Check, Edit, Trash } from 'tabler-icons-react'; +import { AddAppShelfItemForm } from './AddAppShelfItem'; export default function AppShelfMenu(props: any) { - const { name, removeitem: removeItem } = props; + const { service, removeitem: removeItem } = props; + const [opened, setOpened] = useState(false); return ( - - Settings - } - // TODO: #2 Add the ability to edit the service. - onClick={() => { - showNotification({ - color: 'red', - title: Feature not yet implemented, - message: `${name} could not be edited`, - }); - }} + <> + setOpened(false)} + title="Modify a service" > - Rename - - Danger zone - { - removeItem(name); - showNotification({ - autoClose: 5000, - title: ( - - Service {name} removed successfully - - ), - color: 'green', - icon: , - message: undefined, - }); - }} - icon={} - > - Delete - - + +
+ + Settings + } + // TODO: #2 Add the ability to edit the service. + onClick={() => setOpened(true)} + > + Edit + + Danger zone + { + removeItem(service.name); + showNotification({ + autoClose: 5000, + title: ( + + Service {service.name} removed successfully + + ), + color: 'green', + icon: , + message: undefined, + }); + }} + icon={} + > + Delete + + + ); }