[WEB-5472] refactor: components of project creation flow (#8462)
This commit is contained in:
parent
866338289e
commit
9141a9377f
8 changed files with 70 additions and 48 deletions
|
|
@ -1,24 +1,23 @@
|
|||
import { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { PROJECT_TRACKER_EVENTS, RANDOM_EMOJI_CODES } from "@plane/constants";
|
||||
import { PROJECT_TRACKER_EVENTS } from "@plane/constants";
|
||||
import { useTranslation } from "@plane/i18n";
|
||||
import { observer } from "mobx-react";
|
||||
import { useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
// ui
|
||||
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
|
||||
import { EFileAssetType } from "@plane/types";
|
||||
import type { IProject } from "@plane/types";
|
||||
// constants
|
||||
import ProjectCommonAttributes from "@/components/project/create/common-attributes";
|
||||
import ProjectCreateHeader from "@/components/project/create/header";
|
||||
import ProjectCreateButtons from "@/components/project/create/project-create-buttons";
|
||||
// hooks
|
||||
import { DEFAULT_COVER_IMAGE_URL, getCoverImageType, uploadCoverImage } from "@/helpers/cover-image.helper";
|
||||
import { getCoverImageType, uploadCoverImage } from "@/helpers/cover-image.helper";
|
||||
import { captureError, captureSuccess } from "@/helpers/event-tracker.helper";
|
||||
import { useProject } from "@/hooks/store/use-project";
|
||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||
// plane web types
|
||||
import type { TProject } from "@/plane-web/types/projects";
|
||||
import ProjectAttributes from "./attributes";
|
||||
import { ProjectAttributes } from "./attributes";
|
||||
import { getProjectFormValues } from "./utils";
|
||||
|
||||
export type TCreateProjectFormProps = {
|
||||
|
|
@ -37,7 +36,7 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
|
|||
const { t } = useTranslation();
|
||||
const { addProjectToFavorites, createProject, updateProject } = useProject();
|
||||
// states
|
||||
const [isChangeInIdentifierRequired, setIsChangeInIdentifierRequired] = useState(true);
|
||||
const [shouldAutoSyncIdentifier, setShouldAutoSyncIdentifier] = useState(true);
|
||||
// form info
|
||||
const methods = useForm<TProject>({
|
||||
defaultValues: { ...getProjectFormValues(), ...data },
|
||||
|
|
@ -167,7 +166,7 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
|
|||
|
||||
const handleClose = () => {
|
||||
onClose();
|
||||
setIsChangeInIdentifierRequired(true);
|
||||
setShouldAutoSyncIdentifier(true);
|
||||
setTimeout(() => {
|
||||
reset();
|
||||
}, 300);
|
||||
|
|
@ -182,8 +181,8 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
|
|||
<ProjectCommonAttributes
|
||||
setValue={setValue}
|
||||
isMobile={isMobile}
|
||||
isChangeInIdentifierRequired={isChangeInIdentifierRequired}
|
||||
setIsChangeInIdentifierRequired={setIsChangeInIdentifierRequired}
|
||||
shouldAutoSyncIdentifier={shouldAutoSyncIdentifier}
|
||||
setShouldAutoSyncIdentifier={setShouldAutoSyncIdentifier}
|
||||
/>
|
||||
<ProjectAttributes isMobile={isMobile} />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue