// react import { useCallback } from "react"; // react-hook-form import { Controller } from "react-hook-form"; import type { Control, UseFormRegister, UseFormSetError } from "react-hook-form"; // services import projectServices from "lib/services/project.service"; // hooks import useUser from "lib/hooks/useUser"; // ui import { Button, Input, Select, TextArea, EmojiIconPicker } from "ui"; // types import { IProject } from "types"; // constants import { debounce } from "constants/common"; type Props = { register: UseFormRegister; errors: any; setError: UseFormSetError; isSubmitting: boolean; control: Control; }; const NETWORK_CHOICES = { "0": "Secret", "2": "Public" }; const GeneralSettings: React.FC = ({ register, errors, setError, isSubmitting, control, }) => { const { activeWorkspace } = useUser(); const checkIdentifier = (slug: string, value: string) => { projectServices.checkProjectIdentifierAvailability(slug, value).then((response) => { console.log(response); if (response.exists) setError("identifier", { message: "Identifier already exists" }); }); }; // eslint-disable-next-line react-hooks/exhaustive-deps const checkIdentifierAvailability = useCallback(debounce(checkIdentifier, 1500), []); return ( <>

General

This information will be displayed to every member of the project.

Icon & Name

Select an icon and a name for the project.

( )} />

Description

Give a description to the project.