import { FC, useState } 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, Eye, EyeOff } 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; // states const [showPassword, setShowPassword] = useState(false); // 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

( )} />

You will get this from your{" "} GitHub OAuth application settings.

Client secret

( )} /> {showPassword ? ( ) : ( )}

Your client secret is also found in your{" "} GitHub OAuth application settings.

Origin URL

We will auto-generate this. Paste this into the Authorization callback URL field{" "} here.

); };