mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: replacing onclick redirections with link tag. (#3263)
* fix: adding links to dashboard summary items * fix: adding links to workspace sidebar dropdown * fix: adding links to the sidebar
This commit is contained in:
parent
ff8008cbed
commit
685e62a72f
@ -253,32 +253,31 @@ export const ProjectSidebarListItem: React.FC<Props> = observer((props) => {
|
||||
)}
|
||||
|
||||
{project.archive_in > 0 && (
|
||||
<CustomMenu.MenuItem
|
||||
onClick={() => router.push(`/${workspaceSlug}/projects/${project?.id}/archived-issues/`)}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<ArchiveIcon className="h-3.5 w-3.5 stroke-[1.5]" />
|
||||
<span>Archived Issues</span>
|
||||
</div>
|
||||
<CustomMenu.MenuItem>
|
||||
<Link href={`/${workspaceSlug}/projects/${project?.id}/archived-issues/`}>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<ArchiveIcon className="h-3.5 w-3.5 stroke-[1.5]" />
|
||||
<span>Archived Issues</span>
|
||||
</div>
|
||||
</Link>
|
||||
</CustomMenu.MenuItem>
|
||||
)}
|
||||
<CustomMenu.MenuItem
|
||||
onClick={() => router.push(`/${workspaceSlug}/projects/${project?.id}/draft-issues`)}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<PenSquare className="h-3.5 w-3.5 stroke-[1.5] text-custom-text-300" />
|
||||
<span>Draft Issues</span>
|
||||
</div>
|
||||
<CustomMenu.MenuItem>
|
||||
<Link href={`/${workspaceSlug}/projects/${project?.id}/draft-issues/`}>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<PenSquare className="h-3.5 w-3.5 stroke-[1.5] text-custom-text-300" />
|
||||
<span>Draft Issues</span>
|
||||
</div>
|
||||
</Link>
|
||||
</CustomMenu.MenuItem>
|
||||
<CustomMenu.MenuItem
|
||||
onClick={() => router.push(`/${workspaceSlug}/projects/${project?.id}/settings`)}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<Settings className="h-3.5 w-3.5 stroke-[1.5]" />
|
||||
<span>Settings</span>
|
||||
</div>
|
||||
<CustomMenu.MenuItem>
|
||||
<Link href={`/${workspaceSlug}/projects/${project?.id}/settings`}>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<Settings className="h-3.5 w-3.5 stroke-[1.5]" />
|
||||
<span>Settings</span>
|
||||
</div>
|
||||
</Link>
|
||||
</CustomMenu.MenuItem>
|
||||
|
||||
{/* leave project */}
|
||||
{isViewerOrGuest && (
|
||||
<CustomMenu.MenuItem onClick={handleLeaveProject}>
|
||||
|
@ -7,6 +7,7 @@ import { Info } from "lucide-react";
|
||||
// types
|
||||
import { IUserWorkspaceDashboard } from "types";
|
||||
import { useRouter } from "next/router";
|
||||
import Link from "next/link";
|
||||
|
||||
type Props = {
|
||||
data: IUserWorkspaceDashboard | undefined;
|
||||
@ -19,61 +20,40 @@ export const IssuesStats: React.FC<Props> = ({ data }) => {
|
||||
<div className="grid grid-cols-1 rounded-[10px] border border-custom-border-200 bg-custom-background-100 lg:grid-cols-3">
|
||||
<div className="grid grid-cols-1 divide-y divide-custom-border-200 border-b border-custom-border-200 lg:border-b-0 lg:border-r">
|
||||
<div className="flex">
|
||||
<div className="basis-1/2 p-4">
|
||||
<h4 className="text-sm">Issues assigned to you</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">
|
||||
{data ? (
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => router.push(`/${workspaceSlug}/workspace-views/assigned`)}
|
||||
>
|
||||
{data.assigned_issues_count}
|
||||
</div>
|
||||
) : (
|
||||
<Loader>
|
||||
<Loader.Item height="25px" width="50%" />
|
||||
</Loader>
|
||||
)}
|
||||
</h5>
|
||||
</div>
|
||||
<div className="basis-1/2 border-l border-custom-border-200 p-4">
|
||||
<h4 className="text-sm">Pending issues</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">
|
||||
{data ? (
|
||||
data.pending_issues_count
|
||||
) : (
|
||||
<Loader>
|
||||
<Loader.Item height="25px" width="50%" />
|
||||
</Loader>
|
||||
)}
|
||||
</h5>
|
||||
</div>
|
||||
<Link className="basis-1/2 p-4" href={`/${workspaceSlug}/workspace-views/assigned`}>
|
||||
<div>
|
||||
<h4 className="text-sm">Issues assigned to you</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">
|
||||
<div className="cursor-pointer">{data?.assigned_issues_count}</div>
|
||||
</h5>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
className="basis-1/2 border-l border-custom-border-200 p-4"
|
||||
href={`/${workspaceSlug}/workspace-views/all-issues`}
|
||||
>
|
||||
<div>
|
||||
<h4 className="text-sm">Pending issues</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">{data?.pending_issues_count}</h5>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="flex">
|
||||
<div className="basis-1/2 p-4">
|
||||
<h4 className="text-sm">Completed issues</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">
|
||||
{data ? (
|
||||
data.completed_issues_count
|
||||
) : (
|
||||
<Loader>
|
||||
<Loader.Item height="25px" width="50%" />
|
||||
</Loader>
|
||||
)}
|
||||
</h5>
|
||||
</div>
|
||||
<div className="basis-1/2 border-l border-custom-border-200 p-4">
|
||||
<h4 className="text-sm">Issues due by this week</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">
|
||||
{data ? (
|
||||
data.issues_due_week_count
|
||||
) : (
|
||||
<Loader>
|
||||
<Loader.Item height="25px" width="50%" />
|
||||
</Loader>
|
||||
)}
|
||||
</h5>
|
||||
</div>
|
||||
<Link className="basis-1/2 p-4" href={`/${workspaceSlug}/workspace-views/all-issues`}>
|
||||
<div>
|
||||
<h4 className="text-sm">Completed issues</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">{data?.completed_issues_count}</h5>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
className="basis-1/2 border-l border-custom-border-200 p-4"
|
||||
href={`/${workspaceSlug}/workspace-views/all-issues`}
|
||||
>
|
||||
<div>
|
||||
<h4 className="text-sm">Issues due by this week</h4>
|
||||
<h5 className="mt-2 text-2xl font-semibold">{data?.issues_due_week_count}</h5>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-4 lg:col-span-2">
|
||||
|
@ -16,7 +16,7 @@ import { Avatar, Loader } from "@plane/ui";
|
||||
import { IWorkspace } from "types";
|
||||
|
||||
// Static Data
|
||||
const userLinks = (workspaceSlug: string, userId: string) => [
|
||||
const WORKSPACE_DROPDOWN_ITEMS = (workspaceSlug: string, userId: string) => [
|
||||
{
|
||||
name: "Workspace Settings",
|
||||
href: `/${workspaceSlug}/settings`,
|
||||
@ -155,8 +155,8 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
||||
workspaces.map((workspace: IWorkspace) => (
|
||||
<Menu.Item key={workspace.id}>
|
||||
{() => (
|
||||
<button
|
||||
type="button"
|
||||
<Link
|
||||
href={`/${workspace.slug}`}
|
||||
onClick={() => handleWorkspaceNavigation(workspace)}
|
||||
className="flex w-full items-center justify-between gap-1 rounded-md p-1 text-sm text-custom-sidebar-text-100 hover:bg-custom-sidebar-background-80"
|
||||
>
|
||||
@ -190,7 +190,7 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
||||
<Check className="h-3 w-3.5 text-custom-sidebar-text-100" />
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</Link>
|
||||
)}
|
||||
</Menu.Item>
|
||||
))
|
||||
@ -198,17 +198,19 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
||||
<p>No workspace found!</p>
|
||||
)}
|
||||
<div className="sticky bottom-0 z-10 h-full w-full bg-custom-background-100">
|
||||
<Menu.Item
|
||||
as="button"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setTrackElement("APP_SIEDEBAR_WORKSPACE_DROPDOWN");
|
||||
router.push("/create-workspace");
|
||||
}}
|
||||
className="flex w-full items-center gap-2 px-2 py-1 text-sm text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80"
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
Create Workspace
|
||||
<Menu.Item>
|
||||
{() => (
|
||||
<Link
|
||||
href="/create-workspace"
|
||||
className="flex w-full items-center gap-2 px-2 py-1 text-sm text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80"
|
||||
onClick={() => {
|
||||
setTrackElement("APP_SIEDEBAR_WORKSPACE_DROPDOWN");
|
||||
}}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
Create Workspace
|
||||
</Link>
|
||||
)}
|
||||
</Menu.Item>
|
||||
</div>
|
||||
</div>
|
||||
@ -222,18 +224,20 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
||||
)}
|
||||
</div>
|
||||
<div className="flex w-full flex-col items-start justify-start gap-2 border-t border-custom-sidebar-border-200 px-3 py-2 text-sm">
|
||||
{userLinks(workspaceSlug?.toString() ?? "", currentUser?.id ?? "").map((link, index) => (
|
||||
<Menu.Item
|
||||
key={index}
|
||||
as="div"
|
||||
onClick={() => {
|
||||
router.push(link.href);
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center justify-start rounded px-2 py-1 text-sm text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80"
|
||||
>
|
||||
{link.name}
|
||||
</Menu.Item>
|
||||
))}
|
||||
{WORKSPACE_DROPDOWN_ITEMS(workspaceSlug?.toString() ?? "", currentUser?.id ?? "").map(
|
||||
(link, index) => (
|
||||
<Menu.Item key={index} as="div" className="flex w-full">
|
||||
{() => (
|
||||
<Link
|
||||
className="flex w-full cursor-pointer items-center justify-start rounded px-2 py-1 text-sm text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80"
|
||||
href={link.href}
|
||||
>
|
||||
{link.name}
|
||||
</Link>
|
||||
)}
|
||||
</Menu.Item>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
<div className="w-full border-t border-t-custom-sidebar-border-100 px-3 py-2">
|
||||
<Menu.Item
|
||||
|
Loading…
Reference in New Issue
Block a user