"use client"; import { FC } from "react"; import { useForm } from "react-hook-form"; import { IFormattedInstanceConfiguration, TInstanceImageConfigurationKeys } from "@plane/types"; import { Button, TOAST_TYPE, setToast } from "@plane/ui"; // components import { ControllerInput } from "@/components/common"; // hooks import { useInstance } from "@/hooks/store"; type IInstanceImageConfigForm = { config: IFormattedInstanceConfiguration; }; type ImageConfigFormValues = Record; export const InstanceImageConfigForm: FC = (props) => { const { config } = props; // store hooks const { updateInstanceConfigurations } = useInstance(); // 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 updateInstanceConfigurations(payload) .then(() => setToast({ type: TOAST_TYPE.SUCCESS, title: "Success", message: "Image Configuration Settings updated successfully", }) ) .catch((err) => console.error(err)); }; return (
You will find your access key in your Unsplash developer console.  Learn more. } placeholder="oXgq-sdfadsaeweqasdfasdf3234234rassd" error={Boolean(errors.UNSPLASH_ACCESS_KEY)} required />
); };