import { Form, useSubmit } from '@remix-run/react' import { type Dispatch, type SetStateAction, useState } from 'react' import Code from '~/components/Code' import Dialog from '~/components/Dialog' import Select from '~/components/Select' import { type Machine, User } from '~/types' interface MoveProps { readonly machine: Machine readonly users: User[] readonly state: [boolean, Dispatch>] readonly magic?: string } export default function Move({ machine, state, magic, users }: MoveProps) { const [owner, setOwner] = useState(machine.user.name) const submit = useSubmit() return ( {close => ( <> Change the owner of {' '} {machine.givenName} The owner of the machine is the user associated with it. When MagicDNS is enabled, the username of the owner will control the hostname of the machine.
{ submit(e.currentTarget) }} > {magic ? ( owner === machine.user.name ? (

This machine is accessible by the hostname {' '} {machine.givenName} . {owner} . {magic} .

) : (

This machine will be accessible by the hostname {' '} {machine.givenName} . {owner} . {magic} {'. '} The hostname {' '} {machine.givenName} . {machine.user.name} . {magic} {' '} will no longer point to this machine.

) ) : undefined}
Cancel Change owner
)}
) }