diff --git a/apps/app/components/onboarding/user-details.tsx b/apps/app/components/onboarding/user-details.tsx index adff0fc11..febfc0a39 100644 --- a/apps/app/components/onboarding/user-details.tsx +++ b/apps/app/components/onboarding/user-details.tsx @@ -11,7 +11,7 @@ import { CustomSelect, Input, PrimaryButton } from "components/ui"; // types import { IUser } from "types"; // constant -import { USER_ROLE } from "constants/workspace"; +import { USER_ROLES } from "constants/workspace"; const defaultValues: Partial = { first_name: "", @@ -106,7 +106,7 @@ export const UserDetails: React.FC = ({ user, setStep }) => { input width="w-full" > - {USER_ROLE?.map((item) => ( + {USER_ROLES.map((item) => ( {item.label} diff --git a/apps/app/constants/workspace.ts b/apps/app/constants/workspace.ts index 2d8960c37..6533e08cf 100644 --- a/apps/app/constants/workspace.ts +++ b/apps/app/constants/workspace.ts @@ -18,7 +18,7 @@ export const COMPANY_SIZE = [ { value: 50, label: "50" }, ]; -export const USER_ROLE = [ +export const USER_ROLES = [ { value: "Founder or leadership team", label: "Founder or leadership team" }, { value: "Product manager", label: "Product manager" }, { value: "Designer", label: "Designer" }, diff --git a/apps/app/pages/[workspaceSlug]/me/profile/index.tsx b/apps/app/pages/[workspaceSlug]/me/profile/index.tsx index af5487e41..ce692b69e 100644 --- a/apps/app/pages/[workspaceSlug]/me/profile/index.tsx +++ b/apps/app/pages/[workspaceSlug]/me/profile/index.tsx @@ -1,10 +1,9 @@ import React, { useEffect, useState } from "react"; -import Link from "next/link"; import Image from "next/image"; // react-hook-form -import { useForm } from "react-hook-form"; +import { Controller, useForm } from "react-hook-form"; // lib import { requiredAuth } from "lib/auth"; // services @@ -18,27 +17,22 @@ import AppLayout from "layouts/app-layout"; // components import { ImageUploadModal } from "components/core"; // ui -import { DangerButton, Input, SecondaryButton, Spinner } from "components/ui"; +import { CustomSelect, DangerButton, Input, SecondaryButton, Spinner } from "components/ui"; import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; // icons -import { - ChevronRightIcon, - PencilIcon, - RectangleStackIcon, - UserIcon, - UserPlusIcon, - XMarkIcon, -} from "@heroicons/react/24/outline"; +import { UserIcon } from "@heroicons/react/24/outline"; // types import type { NextPage, GetServerSidePropsContext } from "next"; import type { IUser } from "types"; -import { useRouter } from "next/dist/client/router"; +// constants +import { USER_ROLES } from "constants/workspace"; const defaultValues: Partial = { avatar: "", first_name: "", last_name: "", email: "", + role: "", }; const Profile: NextPage = () => { @@ -46,20 +40,18 @@ const Profile: NextPage = () => { const [isRemoving, setIsRemoving] = useState(false); const [isImageUploadModalOpen, setIsImageUploadModalOpen] = useState(false); - const router = useRouter(); - const { workspaceSlug } = router.query; - const { register, handleSubmit, reset, watch, setValue, + control, formState: { errors, isSubmitting }, } = useForm({ defaultValues }); const { setToastAlert } = useToast(); - const { user: myProfile, mutateUser, assignedIssuesLength, workspaceInvitesLength } = useUser(); + const { user: myProfile, mutateUser } = useUser(); useEffect(() => { reset({ ...defaultValues, ...myProfile }); @@ -70,6 +62,7 @@ const Profile: NextPage = () => { first_name: formData.first_name, last_name: formData.last_name, avatar: formData.avatar, + role: formData.role, }; await userService @@ -130,23 +123,6 @@ const Profile: NextPage = () => { }); }; - const quickLinks = [ - { - icon: RectangleStackIcon, - title: "Assigned Issues", - number: assignedIssuesLength, - description: "View issues assigned to you.", - href: `/${workspaceSlug}/me/my-issues`, - }, - { - icon: UserPlusIcon, - title: "Workspace Invitations", - number: workspaceInvitesLength, - description: "View your workspace invitations.", - href: "/invitations", - }, - ]; - return ( {

Role

-

The email address that you are using.

+

Add your role.

- ( + + {USER_ROLES.map((item) => ( + + {item.label} + + ))} + + )} />