import { FC, useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { Eye, EyeOff } from "lucide-react"; // ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // types // hooks import { useApplication } from "hooks/store"; export interface IInstanceImageConfigForm { config: IFormattedInstanceConfiguration; } export interface ImageConfigFormValues { UNSPLASH_ACCESS_KEY: string; } export const InstanceImageConfigForm: 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: { UNSPLASH_ACCESS_KEY: config["UNSPLASH_ACCESS_KEY"], }, }); const onSubmit = async (formData: ImageConfigFormValues) => { const payload: Partial = { ...formData }; await instanceStore .updateInstanceConfigurations(payload) .then(() => setToast({ title: "Success", type: TOAST_TYPE.SUCCESS, message: "Image Configuration Settings updated successfully", }) ) .catch((err) => console.error(err)); }; return ( <>

Access key from your Unsplash account

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

You will find your access key in your Unsplash developer console.{" "} Learn more.

); };