import { FC } from "react"; import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input } from "@plane/ui"; // types import { IFormattedInstanceConfiguration } from "types/instance"; // hooks import useToast from "hooks/use-toast"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // icons import { Copy } from "lucide-react"; export interface IInstanceGithubConfigForm { config: IFormattedInstanceConfiguration; } export interface GithubConfigFormValues { GITHUB_CLIENT_ID: string; GITHUB_CLIENT_SECRET: string; } export const InstanceGithubConfigForm: FC = (props) => { const { config } = props; // store const { instance: instanceStore } = useMobxStore(); // toast const { setToastAlert } = useToast(); // form data const { handleSubmit, control, formState: { errors, isSubmitting }, } = useForm({ defaultValues: { GITHUB_CLIENT_ID: config["GITHUB_CLIENT_ID"], GITHUB_CLIENT_SECRET: config["GITHUB_CLIENT_SECRET"], }, }); const onSubmit = async (formData: GithubConfigFormValues) => { const payload: Partial = { ...formData }; await instanceStore .updateInstanceConfigurations(payload) .then(() => setToastAlert({ title: "Success", type: "success", message: "Github Configuration Settings updated successfully", }) ) .catch((err) => console.error(err)); }; const originURL = typeof window !== "undefined" ? window.location.origin : ""; return ( <>

Client ID

( )} />

Client Secret

( )} />

Origin URL

*paste this URL in your Github console.

); };