import { DownloadClient } from "../../domain/interfaces"; import { useToggle } from "../../hooks/hooks"; import { Switch } from "@headlessui/react"; import { useQuery } from "react-query"; import { classNames } from "../../styles/utils"; import { DownloadClientAddForm, DownloadClientUpdateForm } from "../../forms"; import EmptySimple from "../../components/empty/EmptySimple"; import APIClient from "../../api/APIClient"; import { DownloadClientTypeNameMap } from "../../domain/constants"; interface DownloadLClientSettingsListItemProps { client: DownloadClient; idx: number; } function DownloadClientSettingsListItem({ client, idx }: DownloadLClientSettingsListItemProps) { const [updateClientIsOpen, toggleUpdateClient] = useToggle(false) return ( {updateClientIsOpen && } Use setting {client.name} {client.host} {DownloadClientTypeNameMap[client.type]} Edit ) } function DownloadClientSettings() { const [addClientIsOpen, toggleAddClient] = useToggle(false) const { error, data } = useQuery('downloadClients', APIClient.download_clients.getAll, { refetchOnWindowFocus: false }) if (error) return (

'An error has occurred: '

); return (
{addClientIsOpen && }

Clients

Manage download clients.

{data && data.length > 0 ?
{data && data.map((client, idx) => ( ))}
Enabled Name Host Type Edit
: }
) } export default DownloadClientSettings;