mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
27f78dd283
* chore: project issues topbar * style: theming and minor UI fixes * refactor: file structure * chore: layout wise authorization added * style: filter dropdowns * chore: add fetch keys
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useRouter } from "next/router";
|
|
|
|
// mobx
|
|
import { observer } from "mobx-react-lite";
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { DisplayFiltersSelection, FilterSelection, IssueDropdown, LayoutSelection } from "components/issue-layouts";
|
|
// types
|
|
import { TIssueLayouts } from "types";
|
|
|
|
export const ProjectIssuesHeader = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { issueFilter: issueFilterStore } = useMobxStore();
|
|
|
|
const handleLayoutChange = (layout: TIssueLayouts) => {
|
|
if (!workspaceSlug || !projectId) return;
|
|
|
|
issueFilterStore.updateUserFilters(workspaceSlug.toString(), projectId.toString(), {
|
|
display_filters: {
|
|
layout,
|
|
},
|
|
});
|
|
};
|
|
|
|
return (
|
|
<div className="flex items-center gap-2">
|
|
<LayoutSelection
|
|
layouts={["calendar", "gantt_chart", "kanban", "list", "spreadsheet"]}
|
|
onChange={(layout) => handleLayoutChange(layout)}
|
|
selectedLayout={issueFilterStore.userDisplayFilters.layout ?? "list"}
|
|
/>
|
|
<IssueDropdown title="Filters">
|
|
<FilterSelection workspaceSlug={workspaceSlug?.toString() ?? ""} projectId={projectId?.toString() ?? ""} />
|
|
</IssueDropdown>
|
|
<IssueDropdown title="View">
|
|
<DisplayFiltersSelection />
|
|
</IssueDropdown>
|
|
</div>
|
|
);
|
|
});
|