diff --git a/apps/app/pages/[workspaceSlug]/settings/index.tsx b/apps/app/pages/[workspaceSlug]/settings/index.tsx index 0a690592f..b3a547c4c 100644 --- a/apps/app/pages/[workspaceSlug]/settings/index.tsx +++ b/apps/app/pages/[workspaceSlug]/settings/index.tsx @@ -7,15 +7,13 @@ import useSWR, { mutate } from "swr"; // react-hook-form import { Controller, useForm } from "react-hook-form"; -// react-dropzone -import Dropzone from "react-dropzone"; + // icons import { LinkIcon } from "@heroicons/react/24/outline"; // lib import { requiredWorkspaceAdmin } from "lib/auth"; // services import workspaceService from "services/workspace.service"; -import fileServices from "services/file.service"; // layouts import AppLayout from "layouts/app-layout"; // hooks @@ -52,7 +50,6 @@ type TWorkspaceSettingsProps = { const WorkspaceSettings: NextPage = (props) => { const [isOpen, setIsOpen] = useState(false); - const [image, setImage] = useState(null); const [isImageUploading, setIsImageUploading] = useState(false); const [isImageUploadModalOpen, setIsImageUploadModalOpen] = useState(false); @@ -122,9 +119,11 @@ const WorkspaceSettings: NextPage = (props) => { setIsImageUploadModalOpen(false)} - onSuccess={() => { + onSuccess={(imageUrl) => { + setIsImageUploading(true); + setValue("logo", imageUrl); setIsImageUploadModalOpen(false); - handleSubmit(onSubmit)(); + handleSubmit(onSubmit)().then(() => setIsImageUploading(false)); }} value={watch("logo")} /> @@ -147,62 +146,31 @@ const WorkspaceSettings: NextPage = (props) => {

Logo

- { - setImage(files[0]); - }} - > - {({ getRootProps, getInputProps }) => ( -
- -
- {(watch("logo") && watch("logo") !== null && watch("logo") !== "") || - (image && image !== null) ? ( -
- Workspace Logo -
- ) : ( -
- {activeWorkspace?.name?.charAt(0) ?? "N"} -
- )} -
+

Max file size is 5MB. Supported file types are .jpg and .png.