plane/apps/space/components/issues/navbar/issue-board-view.tsx
Dakshesh Jain 96399c7112
feat: public board (#2017)
* feat: filters in plane deploy

implemented multi-level dropdown for plane deploy

* style: spacing and fonts

* feat: plane deploy

implemented authentication/theming, created/modified all the required store & services

* devL reactions, voting, comments and theme
2023-08-30 12:49:15 +05:30

69 lines
2.4 KiB
TypeScript

"use client";
// next imports
import { useRouter, useParams, useSearchParams } from "next/navigation";
// mobx react lite
import { observer } from "mobx-react-lite";
// constants
import { issueViews } from "constants/data";
// interfaces
import { TIssueBoardKeys } from "store/types";
// mobx
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
export const NavbarIssueBoardView = observer(() => {
const store: RootStore = useMobxStore();
const router = useRouter();
const routerParams = useParams();
const { workspace_slug, project_slug } = routerParams as { workspace_slug: string; project_slug: string };
const handleCurrentBoardView = (boardView: TIssueBoardKeys) => {
store?.issue?.setCurrentIssueBoardView(boardView);
router.replace(
`/${workspace_slug}/${project_slug}?board=${boardView}${
store?.issue?.userSelectedLabels && store?.issue?.userSelectedLabels.length > 0
? `&labels=${store?.issue?.userSelectedLabels.join(",")}`
: ""
}${
store?.issue?.userSelectedPriorities && store?.issue?.userSelectedPriorities.length > 0
? `&priorities=${store?.issue?.userSelectedPriorities.join(",")}`
: ""
}${
store?.issue?.userSelectedStates && store?.issue?.userSelectedStates.length > 0
? `&states=${store?.issue?.userSelectedStates.join(",")}`
: ""
}`
);
};
return (
<>
{store?.project?.workspaceProjectSettings &&
issueViews &&
issueViews.length > 0 &&
issueViews.map(
(_view) =>
store?.project?.workspaceProjectSettings?.views[_view?.key] && (
<div
key={_view?.key}
className={`w-[28px] h-[28px] flex justify-center items-center rounded-sm cursor-pointer ${
_view?.key === store?.issue?.currentIssueBoardView
? `bg-custom-background-200 text-custom-text-200`
: `hover:bg-custom-background-200 text-custom-text-300`
}`}
onClick={() => handleCurrentBoardView(_view?.key)}
title={_view?.title}
>
<span className={`material-symbols-rounded text-[18px] ${_view?.className ? _view?.className : ``}`}>
{_view?.icon}
</span>
</div>
)
)}
</>
);
});