/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable unicorn/no-keyword-prefix */ import { Dialog } from '@headlessui/react' import { useFetcher } from '@remix-run/react' import { useState } from 'react' type Properties = { readonly name: string; } export default function Modal({ name }: Properties) { const [isOpen, setIsOpen] = useState(false) const [newName, setNewName] = useState(name) const fetcher = useFetcher() return ( <> { setIsOpen(true) }} > Rename Tailnet... { setIsOpen(false) }} > Rename {name} Keep in mind that changing this can lead to all sorts of unexpected behavior and may break existing devices in your tailnet. { setNewName(event.target.value) }} /> { fetcher.submit({ 'dns_config.base_domain': newName }, { method: 'PATCH', encType: 'application/json' }) setIsOpen(false) setNewName(name) }} > Rename > ) }