From 535bafaf358fe8a43a4959772d9ed3177d55d0e8 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Tue, 1 Aug 2023 12:36:29 +0530 Subject: [PATCH 1/2] chore: profile dropdown in the sidebar --- .../components/workspace/sidebar-dropdown.tsx | 280 +++++++++++------- 1 file changed, 166 insertions(+), 114 deletions(-) diff --git a/apps/app/components/workspace/sidebar-dropdown.tsx b/apps/app/components/workspace/sidebar-dropdown.tsx index b8f68cf9a24..36ed26afd70 100644 --- a/apps/app/components/workspace/sidebar-dropdown.tsx +++ b/apps/app/components/workspace/sidebar-dropdown.tsx @@ -16,7 +16,7 @@ import useToast from "hooks/use-toast"; import userService from "services/user.service"; import authenticationService from "services/authentication.service"; // components -import { Avatar, Loader } from "components/ui"; +import { Avatar, Icon, Loader } from "components/ui"; // icons import { CheckIcon, PlusIcon } from "@heroicons/react/24/outline"; // helpers @@ -40,6 +40,19 @@ const userLinks = (workspaceSlug: string, userId: string) => [ }, ]; +const profileLinks = (workspaceSlug: string, userId: string) => [ + { + name: "View Profile", + icon: "account_circle", + link: `/${workspaceSlug}/profile/${userId}`, + }, + { + name: "Settings", + icon: "settings", + link: `/${workspaceSlug}/me/profile`, + }, +]; + export const WorkspaceSidebarDropdown = () => { const router = useRouter(); const { workspaceSlug } = router.query; @@ -90,8 +103,8 @@ export const WorkspaceSidebarDropdown = () => { }; return ( - -
+
+
{
- {!sidebarCollapse && ( - - -
- -
-
- - )} -
- - - -
-
{user?.email}
- Workspace - {workspaces ? ( -
- {workspaces.length > 0 ? ( - workspaces.map((workspace) => ( - - {({ active }) => ( - + )} + + )) + ) : ( +

No workspace found!

+ )} + { + router.push("/create-workspace"); + }} + className="flex w-full items-center gap-1 text-sm text-custom-sidebar-text-200" + > + + Create Workspace + +
+ ) : ( +
+ + + + +
+ )} +
+
+ {userLinks(workspaceSlug?.toString() ?? "", user?.id ?? "").map((link, index) => ( + + + {link.name} + + + ))} +
+
+ + Sign out + +
+
+
+
+ + {!sidebarCollapse && ( + + + + -
- {truncateText(workspace.name, 18)} -
- - - - - - )} + + +
+ {profileLinks(workspaceSlug?.toString() ?? "", user?.id ?? "").map( + (link, index) => ( + + + + + {link.name} + + - )) - ) : ( -

No workspace found!

+ ) )} +
+
{ - router.push("/create-workspace"); - }} - className="flex w-full items-center gap-1 text-sm text-custom-sidebar-text-200" + className="flex w-full items-center gap-2 rounded px-2 py-1 hover:bg-custom-sidebar-background-80" + onClick={handleSignOut} > - - Create Workspace + + Log Out
- ) : ( -
- - - - -
- )} - -
- {userLinks(workspaceSlug?.toString() ?? "", user?.id ?? "").map((link, index) => ( - - - {link.name} - - - ))} -
-
- - Sign out - -
-
-
-
+ + + + )} + ); }; From e4eb895eeb0bf07315a836b63f56c20018ece82f Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Tue, 1 Aug 2023 12:42:08 +0530 Subject: [PATCH 2/2] style: update spacing and font sizes --- apps/app/components/workspace/sidebar-dropdown.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/app/components/workspace/sidebar-dropdown.tsx b/apps/app/components/workspace/sidebar-dropdown.tsx index 36ed26afd70..c9addf8db49 100644 --- a/apps/app/components/workspace/sidebar-dropdown.tsx +++ b/apps/app/components/workspace/sidebar-dropdown.tsx @@ -42,7 +42,7 @@ const userLinks = (workspaceSlug: string, userId: string) => [ const profileLinks = (workspaceSlug: string, userId: string) => [ { - name: "View Profile", + name: "View profile", icon: "account_circle", link: `/${workspaceSlug}/profile/${userId}`, }, @@ -260,9 +260,9 @@ export const WorkspaceSidebarDropdown = () => { > -
+
{profileLinks(workspaceSlug?.toString() ?? "", user?.id ?? "").map( (link, index) => ( @@ -276,7 +276,7 @@ export const WorkspaceSidebarDropdown = () => { ) )}
-
+
{ onClick={handleSignOut} > - Log Out + Log out