plane/apps/app/components/workspace/sidebar-menu.tsx
Dakshesh Jain 16a7bd3bda
feat: user issue notifications (#1523)
* feat: added new issue subscriber table

* dev: notification model

* feat: added CRUD operation for issue subscriber

* Revert "feat: added CRUD operation for issue subscriber"

This reverts commit b22e062576.

* feat: added CRUD operation for issue subscriber

* dev: notification models and operations

* dev: remove delete endpoint response data

* dev: notification endpoints and fix bg worker for saving notifications

* feat: added list and unsubscribe function in issue subscriber

* dev: filter by snoozed and response update for list and permissions

* dev: update issue notifications

* dev: notification  segregation

* dev: update notifications

* dev: notification filtering

* dev: add issue name in notifications

* dev: notification new endpoints

* fix: pushing local settings

* feat: notification workflow setup and made basic UI

* style: improved UX with toast alerts and other interactions

refactor: changed classnames according to new theme structure, changed all icons to material icons

* feat: showing un-read notification count

* feat: not showing 'subscribe' button on issue created by user & assigned to user

not showing 'Create by you' for view & guest of the workspace

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
2023-07-18 12:07:55 +05:30

81 lines
2.2 KiB
TypeScript

import React from "react";
import Link from "next/link";
import { useRouter } from "next/router";
// hooks
import useTheme from "hooks/use-theme";
import { NotificationPopover } from "components/notifications";
const workspaceLinks = (workspaceSlug: string) => [
{
icon: "grid_view",
name: "Dashboard",
href: `/${workspaceSlug}`,
},
{
icon: "bar_chart",
name: "Analytics",
href: `/${workspaceSlug}/analytics`,
},
{
icon: "work",
name: "Projects",
href: `/${workspaceSlug}/projects`,
},
{
icon: "task_alt",
name: "My Issues",
href: `/${workspaceSlug}/me/my-issues`,
},
];
// components
import { Icon, Tooltip } from "components/ui";
export const WorkspaceSidebarMenu = () => {
const router = useRouter();
const { workspaceSlug } = router.query;
// theme context
const { collapsed: sidebarCollapse } = useTheme();
return (
<div className="w-full cursor-pointer space-y-2 px-4 mt-5">
{workspaceLinks(workspaceSlug as string).map((link, index) => {
const isActive =
link.name === "Settings"
? router.asPath.includes(link.href)
: router.asPath === link.href;
return (
<Link key={index} href={link.href}>
<a className="block w-full">
<Tooltip
tooltipContent={link.name}
position="right"
className="ml-2"
disabled={!sidebarCollapse}
>
<div
className={`group flex w-full items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium outline-none ${
isActive
? "bg-custom-primary-100/10 text-custom-primary-100"
: "text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:bg-custom-sidebar-background-80"
} ${sidebarCollapse ? "justify-center" : ""}`}
>
<Icon iconName={`${link.icon}`} />
{!sidebarCollapse && link.name}
</div>
</Tooltip>
</a>
</Link>
);
})}
<NotificationPopover />
</div>
);
};