"use client";
import { Fragment, useState } from "react";
import { api } from "~/trpc/react";
import { Listbox, Transition } from "@headlessui/react";
import { FaTrello } from "react-icons/fa";
import { HiChevronUpDown, HiXMark } from "react-icons/hi2";
import { useModal } from "~/app/providers/modal";
import { useFormik } from "formik";
interface TrelloFormValues {
apiKey: string;
token: string;
}
const sources = [{ source: "Trello" }];
const SelectSource = ({ handleNextStep }: { handleNextStep: () => void }) => {
const formik = useFormik({
initialValues: {
source: "Trello",
},
onSubmit: () => {
handleNextStep();
},
});
return (
);
};
interface ImportTrelloProps {
handleSetAuthDetails: (apiKey: string, token: string) => void;
}
const ImportTrello: React.FC = ({
handleSetAuthDetails,
}) => {
const formik = useFormik({
initialValues: {
apiKey: "",
token: "",
},
onSubmit: (values: TrelloFormValues) => {
handleSetAuthDetails(values.apiKey, values.token);
},
});
return (
);
};
export function ImportBoardsForm() {
// const utils = api.useUtils();
const { closeModal } = useModal();
const [step, setStep] = useState(1);
const [apiKey, setApiKey] = useState("");
const [token, setToken] = useState("");
const boards = api.import.trello.getBoards.useQuery(
{ apiKey, token },
{
enabled: apiKey && token ? true : false,
},
);
const handleSetAuthDetails = (apiKey: string, token: string) => {
setApiKey(apiKey);
setToken(token);
};
// const refetchBoards = () => utils.board.all.refetch();
return (
<>
New import
{step === 1 && setStep(step + 1)} />}
{step === 2 && (
)}
>
);
}