import { FC, useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { Copy, Eye, EyeOff } from "lucide-react"; import { IFormattedInstanceConfiguration } from "@plane/types"; // ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // types import { useApplication } from "@/hooks/store"; // hooks 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 hooks const { instance: instanceStore } = useApplication(); // 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(() => setToast({ title: "Success!", type: TOAST_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.

); };