chore: update profile and God mode routes (#2860)

* chore: update profile and god mode routes

* fix: profile activity loader

* chore: update profile route in the change password page
This commit is contained in:
Aaryan Khandelwal 2023-11-24 12:16:37 +05:30 committed by sriram veeraghanta
parent 86de38d3a0
commit 267cf75004
18 changed files with 233 additions and 243 deletions

View file

@ -19,7 +19,7 @@ export const ProfileSettingsHeader: FC<IProfileSettingHeader> = (props) => {
type="text"
label="My Profile"
icon={<Settings className="h-4 w-4 text-custom-text-300" />}
link={`/me/profile`}
link="/profile"
/>
<Breadcrumbs.BreadcrumbItem type="text" label={title} />
</Breadcrumbs>

View file

@ -6,7 +6,7 @@ export const UserProfileHeader = () => (
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis">
<div>
<Breadcrumbs>
<Breadcrumbs.BreadcrumbItem type="text" label="Activity Overview" link="/me/profile" />
<Breadcrumbs.BreadcrumbItem type="text" label="Activity Overview" link="/profile" />
</Breadcrumbs>
</div>
</div>

View file

@ -4,7 +4,7 @@ import { useTheme } from "next-themes";
import { observer } from "mobx-react-lite";
import Link from "next/link";
import { Menu, Transition } from "@headlessui/react";
import { Cog, LogIn, LogOut, Settings, UserCircle2 } from "lucide-react";
import { Cog, LogIn, LogOut, Settings } from "lucide-react";
import { mutate } from "swr";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
@ -16,16 +16,12 @@ import { AuthService } from "services/auth.service";
import { Avatar, Tooltip } from "@plane/ui";
// Static Data
const profileLinks = (workspaceSlug: string, userId: string) => [
{
name: "View profile",
icon: UserCircle2,
link: `/${workspaceSlug}/profile/${userId}`,
},
const PROFILE_LINKS = [
{
key: "settings",
name: "Settings",
icon: Settings,
link: `/me/profile`,
link: `/profile`,
},
];
@ -123,8 +119,8 @@ export const InstanceSidebarDropdown = observer(() => {
>
<div className="flex flex-col gap-2.5 pb-2">
<span className="px-2 text-custom-sidebar-text-200">{currentUser?.email}</span>
{profileLinks(workspaceSlug?.toString() ?? "", currentUser?.id ?? "").map((link, index) => (
<Menu.Item key={index} as="button" type="button">
{PROFILE_LINKS.map((link) => (
<Menu.Item key={link.key} as="button" type="button">
<Link href={link.link}>
<a className="flex w-full items-center gap-2 rounded px-2 py-1 hover:bg-custom-sidebar-background-80">
<link.icon className="h-4 w-4 stroke-[1.5]" />

View file

@ -12,25 +12,25 @@ const INSTANCE_ADMIN_LINKS = [
Icon: Cog,
name: "General",
description: "General settings here",
href: `/admin`,
href: `/god-mode`,
},
{
Icon: Mail,
name: "Email",
description: "Email related settings will go here",
href: `/admin/email`,
href: `/god-mode/email`,
},
{
Icon: Lock,
name: "Authorization",
description: "Autorization",
href: `/admin/authorization`,
href: `/god-mode/authorization`,
},
{
Icon: BrainCog,
name: "OpenAI",
description: "OpenAI configurations",
href: `/admin/openai`,
href: `/god-mode/openai`,
},
];

View file

@ -67,7 +67,7 @@ export const ProfileSidebar = () => {
<div className="relative h-32">
{user?.id === userId && (
<div className="absolute top-3.5 right-3.5 h-5 w-5 bg-white rounded grid place-items-center">
<Link href="me/profile">
<Link href="/profile">
<a className="grid place-items-center text-black">
<Pencil className="h-3 w-3" />
</a>

View file

@ -42,7 +42,7 @@ const profileLinks = (workspaceSlug: string, userId: string) => [
{
name: "Settings",
icon: Settings,
link: "/me/profile",
link: "/profile",
},
];
@ -291,7 +291,7 @@ export const WorkspaceSidebarDropdown = observer(() => {
</Menu.Item>
))}
</div>
<div className="py-2">
<div className={`pt-2 ${isUserInstanceAdmin ? "pb-2" : ""}`}>
<Menu.Item
as="button"
type="button"
@ -305,7 +305,7 @@ export const WorkspaceSidebarDropdown = observer(() => {
{isUserInstanceAdmin && (
<div className="p-2 pb-0">
<Menu.Item as="button" type="button" className="w-full">
<Link href="/admin">
<Link href="/god-mode">
<a className="flex w-full items-center justify-center rounded px-2 py-1 text-sm font-medium text-custom-primary-100 hover:text-custom-primary-200 bg-custom-primary-10 hover:bg-custom-primary-20">
God Mode
</a>