import { Dispatch, Fragment, SetStateAction, FC } from "react"; import { Control, Controller } from "react-hook-form"; import { Menu, Transition } from "@headlessui/react"; // ui import { ToggleSwitch } from "@plane/ui"; // types import { APIFormFields } from "./index"; interface APITokenExpiryProps { neverExpires: boolean; selectedExpiry: number; setSelectedExpiry: Dispatch>; setNeverExpire: Dispatch>; renderExpiry: () => string; control: Control; } export const EXPIRY_OPTIONS = [ { title: "7 Days", days: 7, }, { title: "30 Days", days: 30, }, { title: "1 Month", days: 30, }, { title: "3 Months", days: 90, }, { title: "1 Year", days: 365, }, ]; export const APITokenExpiry: FC = (props) => { const { neverExpires, selectedExpiry, setSelectedExpiry, setNeverExpire, renderExpiry, control } = props; return ( <>

Expiration Date

{EXPIRY_OPTIONS[selectedExpiry].title.toLocaleLowerCase()}

({renderExpiry()})

{EXPIRY_OPTIONS.map((option, index) => ( {({ active }) => (
)}
))}
Never Expires ( { onChange(val); setNeverExpire(val); }} size="sm" /> )} />
); };