diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx index 072e70bad86..f94c06cbc99 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from "react"; +import Image from "next/image"; import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; @@ -15,6 +16,7 @@ import AppLayout from "layouts/app-layout"; import projectService from "services/project.service"; // components import { DeleteProjectModal } from "components/project"; +import { ImageUploadModal } from "components/core"; import EmojiIconPicker from "components/emoji-icon-picker"; // hooks import useToast from "hooks/use-toast"; @@ -44,6 +46,8 @@ const defaultValues: Partial = { const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGuest }) => { const [selectProject, setSelectedProject] = useState(null); + const [isImageUploading, setIsImageUploading] = useState(false); + const [isImageUploadModalOpen, setIsImageUploadModalOpen] = useState(false); const { setToastAlert } = useToast(); @@ -61,7 +65,9 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu register, handleSubmit, reset, + watch, control, + setValue, setError, formState: { errors, isSubmitting }, } = useForm({ @@ -116,6 +122,7 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu default_assignee: formData.default_assignee, project_lead: formData.project_lead, icon: formData.icon, + cover_image: formData.cover_image, }; if (projectDetails.identifier !== formData.identifier) @@ -150,6 +157,17 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu router.push(`/${workspaceSlug}/projects`); }} /> + setIsImageUploadModalOpen(false)} + onSuccess={(imageUrl) => { + setIsImageUploading(true); + setValue("cover_image", imageUrl); + setIsImageUploadModalOpen(false); + handleSubmit(onSubmit)().then(() => setIsImageUploading(false)); + }} + value={watch("cover_image")} + />
@@ -216,6 +234,40 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu )}
+
+
+

Cover Photo

+

Select your cover photo from the given library.

+
+
+ {watch("cover_image") ? ( +
+
+ {projectDetails?.name +
+ +
+
+
+ ) : ( + + + + )} +
+

Identifier