From d48abba0d0407e6e755bc789336c470f4fb055ff Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 13:48:52 +0530 Subject: [PATCH 01/13] chore: user layout and header updated --- .../(projects)/profile/[userId]/header.tsx | 11 +++++---- .../(projects)/profile/[userId]/layout.tsx | 16 +++++++++++-- web/core/components/profile/sidebar.tsx | 23 ++++++++----------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx index f39ebfc44f0..774ba52b35a 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx @@ -6,6 +6,7 @@ import { observer } from "mobx-react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { ChevronDown, PanelRight } from "lucide-react"; +import { IUserProfileProjectSegregation } from "@plane/types"; import { Breadcrumbs, CustomMenu } from "@plane/ui"; import { BreadcrumbLink } from "@/components/common"; // components @@ -14,11 +15,12 @@ import { cn } from "@/helpers/common.helper"; import { useAppTheme, useUser } from "@/hooks/store"; type TUserProfileHeader = { + userProjectsData: IUserProfileProjectSegregation | undefined; type?: string | undefined; }; export const UserProfileHeader: FC = observer((props) => { - const { type = undefined } = props; + const { userProjectsData, type = undefined } = props; // router const { workspaceSlug, userId } = useParams(); // store hooks @@ -34,15 +36,14 @@ export const UserProfileHeader: FC = observer((props) => { const isAuthorized = AUTHORIZED_ROLES.includes(currentWorkspaceRole); const tabsList = isAuthorized ? [...PROFILE_VIEWER_TAB, ...PROFILE_ADMINS_TAB] : PROFILE_VIEWER_TAB; + const userName = `${userProjectsData?.user_data?.first_name} ${userProjectsData?.user_data?.last_name}`; + return (
- } - /> + } />
= observer((props) => { const { membership: { currentWorkspaceRole }, } = useUser(); + + const { data: userProjectsData } = useSWR( + workspaceSlug && userId ? USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) : null, + workspaceSlug && userId + ? () => userService.getUserProfileProjectsSegregation(workspaceSlug.toString(), userId.toString()) + : null + ); // derived values const isAuthorized = currentWorkspaceRole && AUTHORIZED_ROLES.includes(currentWorkspaceRole); const isAuthorizedPath = @@ -44,7 +56,7 @@ const UseProfileLayout: React.FC = observer((props) => { {/* Passing the type prop from the current route value as we need the header as top most component. TODO: We are depending on the route path to handle the mobile header type. If the path changes, this logic will break. */} } + header={} mobileHeader={isIssuesTab && } /> @@ -59,7 +71,7 @@ const UseProfileLayout: React.FC = observer((props) => {
)}
- +
diff --git a/web/core/components/profile/sidebar.tsx b/web/core/components/profile/sidebar.tsx index 389060c286a..2353f79a0b5 100644 --- a/web/core/components/profile/sidebar.tsx +++ b/web/core/components/profile/sidebar.tsx @@ -1,20 +1,20 @@ "use client"; -import { useEffect, useRef } from "react"; +import { FC, useEffect, useRef } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { useParams } from "next/navigation"; -import useSWR from "swr"; // icons import { ChevronDown, Pencil } from "lucide-react"; // headless ui import { Disclosure, Transition } from "@headlessui/react"; +// types +import { IUserProfileProjectSegregation } from "@plane/types"; // plane ui import { Loader, Tooltip } from "@plane/ui"; // components import { Logo } from "@/components/common"; // fetch-keys -import { USER_PROFILE_PROJECT_SEGREGATION } from "@/constants/fetch-keys"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks @@ -22,29 +22,26 @@ import { useAppTheme, useProject, useUser } from "@/hooks/store"; import useOutsideClickDetector from "@/hooks/use-outside-click-detector"; import { usePlatformOS } from "@/hooks/use-platform-os"; // services -import { UserService } from "@/services/user.service"; // components import { ProfileSidebarTime } from "./time"; // services -const userService = new UserService(); -export const ProfileSidebar = observer(() => { +type TProfileSidebar = { + userProjectsData: IUserProfileProjectSegregation | undefined; +}; + +export const ProfileSidebar: FC = observer((props) => { + const { userProjectsData } = props; // refs const ref = useRef(null); // router - const { workspaceSlug, userId } = useParams(); + const { userId } = useParams(); // store hooks const { data: currentUser } = useUser(); const { profileSidebarCollapsed, toggleProfileSidebar } = useAppTheme(); const { getProjectById } = useProject(); const { isMobile } = usePlatformOS(); - const { data: userProjectsData } = useSWR( - workspaceSlug && userId ? USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) : null, - workspaceSlug && userId - ? () => userService.getUserProfileProjectsSegregation(workspaceSlug.toString(), userId.toString()) - : null - ); useOutsideClickDetector(ref, () => { if (profileSidebarCollapsed === false) { From 47aade0fb5764acee87c889c1da1ef5c70e06bf6 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 14:21:46 +0530 Subject: [PATCH 02/13] chore: user page sidebar improvement --- .../(projects)/profile/[userId]/layout.tsx | 39 +++++++++++-------- web/core/components/profile/sidebar.tsx | 9 ++++- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx index cdeb6bfdace..1080b30591e 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx @@ -55,25 +55,30 @@ const UseProfileLayout: React.FC = observer((props) => { <> {/* Passing the type prop from the current route value as we need the header as top most component. TODO: We are depending on the route path to handle the mobile header type. If the path changes, this logic will break. */} - } - mobileHeader={isIssuesTab && } - /> - -
-
- - {isAuthorized || !isAuthorizedPath ? ( -
{children}
- ) : ( -
- You do not have the permission to access this page. +
+
+ } + mobileHeader={isIssuesTab && } + /> + +
+
+ + {isAuthorized || !isAuthorizedPath ? ( +
{children}
+ ) : ( +
+ You do not have the permission to access this page. +
+ )}
- )} -
- + +
+
- + +
); }); diff --git a/web/core/components/profile/sidebar.tsx b/web/core/components/profile/sidebar.tsx index 2353f79a0b5..389f43e5289 100644 --- a/web/core/components/profile/sidebar.tsx +++ b/web/core/components/profile/sidebar.tsx @@ -16,6 +16,7 @@ import { Loader, Tooltip } from "@plane/ui"; import { Logo } from "@/components/common"; // fetch-keys // helpers +import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useAppTheme, useProject, useUser } from "@/hooks/store"; @@ -29,10 +30,11 @@ import { ProfileSidebarTime } from "./time"; type TProfileSidebar = { userProjectsData: IUserProfileProjectSegregation | undefined; + className?: string; }; export const ProfileSidebar: FC = observer((props) => { - const { userProjectsData } = props; + const { userProjectsData, className = "" } = props; // refs const ref = useRef(null); // router @@ -79,7 +81,10 @@ export const ProfileSidebar: FC = observer((props) => { return (
{userProjectsData ? ( From 757d2a7f0541176a644d88e8f4b9e297205a347e Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 14:22:16 +0530 Subject: [PATCH 03/13] fix: your work redirection --- web/core/components/workspace/sidebar/user-menu.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index 54d67e808cb..06120266431 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -34,6 +34,9 @@ export const SidebarUserMenu = observer(() => { // computed const workspaceMemberInfo = currentWorkspaceRole || EUserWorkspaceRoles.GUEST; + const getHref = (link: any) => + `/${workspaceSlug}${link.href}${link.key === "your-work" ? `/${currentUser?.id}` : ""}`; + const handleLinkClick = (itemKey: string) => { if (window.innerWidth < 768) { toggleSidebar(); @@ -67,12 +70,8 @@ export const SidebarUserMenu = observer(() => { disabled={!sidebarCollapsed} isMobile={isMobile} > - handleLinkClick(link.key)} - > + handleLinkClick(link.key)}> From 3300b90a17df4ae970ebebd164f66bdb7afa60fd Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 14:55:35 +0530 Subject: [PATCH 04/13] fix: profile section mobile navigation dropdown --- web/core/constants/profile.ts | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/web/core/constants/profile.ts b/web/core/constants/profile.ts index cf5066177e6..479cb825bd6 100644 --- a/web/core/constants/profile.ts +++ b/web/core/constants/profile.ts @@ -31,26 +31,26 @@ export const PROFILE_ACTION_LINKS: { Icon: Activity, }, { - key: "appearance", - label: "Appearance", - href: `/profile/appearance`, - highlight: (pathname: string) => pathname.includes("/profile/appearance"), - Icon: Settings2, - }, - { - key: "notifications", - label: "Notifications", - href: `/profile/notifications`, - highlight: (pathname: string) => pathname === "/profile/notifications/", - Icon: Bell, - }, + key: "appearance", + label: "Appearance", + href: `/profile/appearance`, + highlight: (pathname: string) => pathname.includes("/profile/appearance"), + Icon: Settings2, + }, + { + key: "notifications", + label: "Notifications", + href: `/profile/notifications`, + highlight: (pathname: string) => pathname === "/profile/notifications/", + Icon: Bell, + }, ]; export const PROFILE_VIEWER_TAB = [ { route: "", label: "Summary", - selected: "", + selected: "/", }, ]; @@ -58,21 +58,21 @@ export const PROFILE_ADMINS_TAB = [ { route: "assigned", label: "Assigned", - selected: "/assigned", + selected: "/assigned/", }, { route: "created", label: "Created", - selected: "/created", + selected: "/created/", }, { route: "subscribed", label: "Subscribed", - selected: "/subscribed", + selected: "/subscribed/", }, { route: "activity", label: "Activity", - selected: "/activity", + selected: "/activity/", }, ]; From 7e657b9907e3a5e406205a1cd0b1ad1eb017f3e6 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 14:56:36 +0530 Subject: [PATCH 05/13] chore: profile layout improvement --- .../(projects)/profile/[userId]/header.tsx | 5 ++++- .../(projects)/profile/[userId]/layout.tsx | 20 ++++++++++++++----- .../(projects)/profile/[userId]/navbar.tsx | 9 +++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx index 774ba52b35a..e82c4fc3382 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx @@ -10,6 +10,7 @@ import { IUserProfileProjectSegregation } from "@plane/types"; import { Breadcrumbs, CustomMenu } from "@plane/ui"; import { BreadcrumbLink } from "@/components/common"; // components +import { ProfileIssuesFilter } from "@/components/profile"; import { PROFILE_ADMINS_TAB, PROFILE_VIEWER_TAB } from "@/constants/profile"; import { cn } from "@/helpers/common.helper"; import { useAppTheme, useUser } from "@/hooks/store"; @@ -17,10 +18,11 @@ import { useAppTheme, useUser } from "@/hooks/store"; type TUserProfileHeader = { userProjectsData: IUserProfileProjectSegregation | undefined; type?: string | undefined; + showProfileIssuesFilter?: boolean; }; export const UserProfileHeader: FC = observer((props) => { - const { userProjectsData, type = undefined } = props; + const { userProjectsData, type = undefined, showProfileIssuesFilter } = props; // router const { workspaceSlug, userId } = useParams(); // store hooks @@ -45,6 +47,7 @@ export const UserProfileHeader: FC = observer((props) => { } /> +
{showProfileIssuesFilter && }
= observer((props) => { membership: { currentWorkspaceRole }, } = useUser(); + const windowSize = useSize(); + const isSmallerScreen = windowSize[0] >= 768; + const { data: userProjectsData } = useSWR( workspaceSlug && userId ? USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) : null, workspaceSlug && userId @@ -58,26 +62,32 @@ const UseProfileLayout: React.FC = observer((props) => {
} + header={ + + } mobileHeader={isIssuesTab && } />
- + {isAuthorized || !isAuthorizedPath ? ( -
{children}
+
{children}
) : (
You do not have the permission to access this page.
)}
- + {!isSmallerScreen && }
- + {isSmallerScreen && }
); diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx index c54cdfd568e..684d58c6d05 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx @@ -4,25 +4,23 @@ import Link from "next/link"; import { useParams, usePathname } from "next/navigation"; // components -import { ProfileIssuesFilter } from "@/components/profile"; // constants import { PROFILE_ADMINS_TAB, PROFILE_VIEWER_TAB } from "@/constants/profile"; type Props = { isAuthorized: boolean; - showProfileIssuesFilter?: boolean; }; export const ProfileNavbar: React.FC = (props) => { - const { isAuthorized, showProfileIssuesFilter } = props; + const { isAuthorized } = props; const { workspaceSlug, userId } = useParams(); -const pathname = usePathname(); + const pathname = usePathname(); const tabsList = isAuthorized ? [...PROFILE_VIEWER_TAB, ...PROFILE_ADMINS_TAB] : PROFILE_VIEWER_TAB; return ( -
+
{tabsList.map((tab) => ( @@ -38,7 +36,6 @@ const pathname = usePathname(); ))}
- {showProfileIssuesFilter && }
); }; From a5598c4773397fe36ab1a5ba6f4b313c21209c4f Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 16:55:53 +0530 Subject: [PATCH 06/13] chore: profile header improvement --- .../[workspaceSlug]/(projects)/profile/[userId]/header.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx index e82c4fc3382..a3a845acd26 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx @@ -29,6 +29,7 @@ export const UserProfileHeader: FC = observer((props) => { const { toggleProfileSidebar, profileSidebarCollapsed } = useAppTheme(); const { membership: { currentWorkspaceRole }, + data: currentUser, } = useUser(); // derived values const AUTHORIZED_ROLES = [20, 15, 10]; @@ -40,12 +41,16 @@ export const UserProfileHeader: FC = observer((props) => { const userName = `${userProjectsData?.user_data?.first_name} ${userProjectsData?.user_data?.last_name}`; + const isCurrentUser = currentUser?.id === userId; + + const breadcrumbLabel = `${isCurrentUser ? "Your" : userName} Activity`; + return (
- } /> + } />
{showProfileIssuesFilter && }
From c598343fbe8c4fa2aefb2e2a5506aee54a2aaae0 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 16:56:40 +0530 Subject: [PATCH 07/13] fix: profile section header improvement --- web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx index 684d58c6d05..39fe4c6d58a 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx @@ -26,7 +26,7 @@ export const ProfileNavbar: React.FC = (props) => { Date: Tue, 23 Jul 2024 16:57:12 +0530 Subject: [PATCH 08/13] fix: app sidebar your work active indicator --- web/core/components/workspace/sidebar/user-menu.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index 06120266431..2de52d71b66 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -37,6 +37,9 @@ export const SidebarUserMenu = observer(() => { const getHref = (link: any) => `/${workspaceSlug}${link.href}${link.key === "your-work" ? `/${currentUser?.id}` : ""}`; + const currentUserPath = `/${workspaceSlug}/profile/${currentUser?.id}`; + const isCurrentUser = pathname.includes(currentUserPath); + const handleLinkClick = (itemKey: string) => { if (window.innerWidth < 768) { toggleSidebar(); @@ -73,7 +76,7 @@ export const SidebarUserMenu = observer(() => { handleLinkClick(link.key)}>
From 8f5a1f8c98aa4637ea393378d6c3d015bc06571c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 23 Jul 2024 18:33:24 +0530 Subject: [PATCH 09/13] chore: profile sidebar improvement --- web/core/components/profile/sidebar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/components/profile/sidebar.tsx b/web/core/components/profile/sidebar.tsx index 389f43e5289..3d533601ae7 100644 --- a/web/core/components/profile/sidebar.tsx +++ b/web/core/components/profile/sidebar.tsx @@ -89,7 +89,7 @@ export const ProfileSidebar: FC = observer((props) => { > {userProjectsData ? ( <> -
+
{currentUser?.id === userId && (
@@ -102,7 +102,7 @@ export const ProfileSidebar: FC = observer((props) => { {userProjectsData.user_data?.display_name}
{userProjectsData.user_data?.avatar && userProjectsData.user_data?.avatar !== "" ? ( From 169f2770b2a42dd2733ee59795e948dffca9c9f0 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 24 Jul 2024 17:10:41 +0530 Subject: [PATCH 10/13] chore: user menu code refactor --- web/core/components/workspace/sidebar/user-menu.tsx | 5 +---- web/core/constants/dashboard.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index 2de52d71b66..f22eb1493a6 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -37,9 +37,6 @@ export const SidebarUserMenu = observer(() => { const getHref = (link: any) => `/${workspaceSlug}${link.href}${link.key === "your-work" ? `/${currentUser?.id}` : ""}`; - const currentUserPath = `/${workspaceSlug}/profile/${currentUser?.id}`; - const isCurrentUser = pathname.includes(currentUserPath); - const handleLinkClick = (itemKey: string) => { if (window.innerWidth < 768) { toggleSidebar(); @@ -76,7 +73,7 @@ export const SidebarUserMenu = observer(() => { handleLinkClick(link.key)}>
diff --git a/web/core/constants/dashboard.ts b/web/core/constants/dashboard.ts index 6bf2b1ca6ea..7006df8810f 100644 --- a/web/core/constants/dashboard.ts +++ b/web/core/constants/dashboard.ts @@ -293,12 +293,16 @@ export const SIDEBAR_WORKSPACE_MENU_ITEMS: { }, ]; +type TLinkOptions = { + id: string | undefined; +}; + export const SIDEBAR_USER_MENU_ITEMS: { key: string; label: string; href: string; access: EUserWorkspaceRoles; - highlight: (pathname: string, baseUrl: string) => boolean; + highlight: (pathname: string, baseUrl: string, options?: TLinkOptions) => boolean; Icon: React.FC; }[] = [ { @@ -314,7 +318,8 @@ export const SIDEBAR_USER_MENU_ITEMS: { label: "Your work", href: "/profile", access: EUserWorkspaceRoles.GUEST, - highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/profile/`), + highlight: (pathname: string, baseUrl: string, options?: TLinkOptions) => + options?.id ? pathname.includes(`${baseUrl}/profile/${options?.id}`) : false, Icon: UserActivityIcon, }, { From cae2cde86b260019ae8cdb0184e73bb63c930031 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 24 Jul 2024 17:11:13 +0530 Subject: [PATCH 11/13] chore: header code refactor --- .../[workspaceSlug]/(projects)/profile/[userId]/header.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx index a3a845acd26..743108dd49f 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx @@ -12,6 +12,7 @@ import { BreadcrumbLink } from "@/components/common"; // components import { ProfileIssuesFilter } from "@/components/profile"; import { PROFILE_ADMINS_TAB, PROFILE_VIEWER_TAB } from "@/constants/profile"; +import { EUserWorkspaceRoles } from "@/constants/workspace"; import { cn } from "@/helpers/common.helper"; import { useAppTheme, useUser } from "@/hooks/store"; @@ -32,11 +33,10 @@ export const UserProfileHeader: FC = observer((props) => { data: currentUser, } = useUser(); // derived values - const AUTHORIZED_ROLES = [20, 15, 10]; + const isAuthorized = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.VIEWER; if (!currentWorkspaceRole) return null; - const isAuthorized = AUTHORIZED_ROLES.includes(currentWorkspaceRole); const tabsList = isAuthorized ? [...PROFILE_VIEWER_TAB, ...PROFILE_ADMINS_TAB] : PROFILE_VIEWER_TAB; const userName = `${userProjectsData?.user_data?.first_name} ${userProjectsData?.user_data?.last_name}`; From be8ebbd1498d63581e3a838099e69c8dcf89dc89 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 24 Jul 2024 17:15:16 +0530 Subject: [PATCH 12/13] chore: user menu code refactor --- web/core/components/workspace/sidebar/user-menu.tsx | 2 +- web/core/constants/dashboard.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index f22eb1493a6..dccb50f64d7 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -73,7 +73,7 @@ export const SidebarUserMenu = observer(() => { handleLinkClick(link.key)}>
diff --git a/web/core/constants/dashboard.ts b/web/core/constants/dashboard.ts index 7006df8810f..a723a40ba6f 100644 --- a/web/core/constants/dashboard.ts +++ b/web/core/constants/dashboard.ts @@ -294,7 +294,7 @@ export const SIDEBAR_WORKSPACE_MENU_ITEMS: { ]; type TLinkOptions = { - id: string | undefined; + userId: string | undefined; }; export const SIDEBAR_USER_MENU_ITEMS: { @@ -319,7 +319,7 @@ export const SIDEBAR_USER_MENU_ITEMS: { href: "/profile", access: EUserWorkspaceRoles.GUEST, highlight: (pathname: string, baseUrl: string, options?: TLinkOptions) => - options?.id ? pathname.includes(`${baseUrl}/profile/${options?.id}`) : false, + options?.userId ? pathname.includes(`${baseUrl}/profile/${options?.userId}`) : false, Icon: UserActivityIcon, }, { From b1637934f21f0a6c0b60c97ce735092d163c596c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 24 Jul 2024 17:42:23 +0530 Subject: [PATCH 13/13] fix: build error --- packages/types/src/issues/issue.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/types/src/issues/issue.d.ts b/packages/types/src/issues/issue.d.ts index c9cd133ef06..41763ffeb9a 100644 --- a/packages/types/src/issues/issue.d.ts +++ b/packages/types/src/issues/issue.d.ts @@ -1,7 +1,7 @@ -import {TIssuePriorities} from "../issues"; -import {TIssueAttachment} from "./issue_attachment"; -import {TIssueLink} from "./issue_link"; -import {TIssueReaction} from "./issue_reaction"; +import { TIssuePriorities } from "../issues"; +import { TIssueAttachment } from "./issue_attachment"; +import { TIssueLink } from "./issue_link"; +import { TIssueReaction } from "./issue_reaction"; // new issue structure types @@ -42,7 +42,7 @@ export type TBaseIssue = { export type TIssue = TBaseIssue & { description_html?: string; is_subscribed?: boolean; - parent?: Partial; + parent?: partial; issue_reactions?: TIssueReaction[]; issue_attachment?: TIssueAttachment[]; issue_link?: TIssueLink[];