import { RepoForkedIcon } from '@primer/octicons-react'; import { useFetcher } from 'react-router'; 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 type { 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 after a certain number of 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
)}
); }