import { RepoForkedIcon } from '@primer/octicons-react' import { useFetcher } from '@remix-run/react' import { useState } from 'react' import Dialog from '~/components/Dialog' import TextField from '~/components/TextField' import NumberField from '~/components/NumberField' import Tooltip from '~/components/Tooltip' import Select from '~/components/Select' import Switch from '~/components/Switch' import Link from '~/components/Link' import Spinner from '~/components/Spinner' import { cn } from '~/utils/cn' import { User } from '~/types' interface Props { users: User[] } // TODO: Tags export default function AddPreAuthKey(data: Props) { const fetcher = useFetcher() const [user, setUser] = useState('') const [reusable, setReusable] = useState(false) const [ephemeral, setEphemeral] = useState(false) const [aclTags, setAclTags] = useState([]) const [expiry, setExpiry] = useState(90) return ( Create pre-auth key {close => ( <> Generate auth key { fetcher.submit(e.currentTarget) close() }}> User Attach this key to a user Key Expiration Set this key to expire between 1 and 90 days.
Reusable Use this key to authenticate more than one device.
{ setReusable(!reusable) }} />
Ephemeral Devices authenticated with this key will be automatically removed once they go offline. {' '} Learn more
{ setEphemeral(!ephemeral) }} />
Cancel {fetcher.state === 'idle' ? undefined : ( )} Generate
)}
) }