mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
651b252c23
* chore: svg icons added in plane/ui package * chore: swap priority and state icon with plane/ui icons * chore: replace core folder icons with lucide and plane ui icons * style: priority icon size * chore: replace icons with lucide and plane/ui icons * chore: replace cycle folder icons with lucide and plane/ui icons * chore: replace existing icons with lucide and plane/ui icons * chore: replace existing icons with lucide and plane/ui icons * chore: replace existing icons with lucide and plane/ui icons * chore: replace existing icons with lucide and plane/ui icons * chore: replace existing icons with lucide and plane/ui icons * fix: build error * fix: build error * fix: build error
125 lines
3.2 KiB
TypeScript
125 lines
3.2 KiB
TypeScript
import React, { useEffect } from "react";
|
|
|
|
import { useRouter } from "next/router";
|
|
|
|
// icons
|
|
import { Plus } from "lucide-react";
|
|
// layouts
|
|
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout-legacy";
|
|
// hooks
|
|
import useMyIssuesFilters from "hooks/my-issues/use-my-issues-filter";
|
|
// components
|
|
import { MyIssuesView, MyIssuesViewOptions } from "components/issues";
|
|
// ui
|
|
import { Button } from "@plane/ui";
|
|
import { Breadcrumbs, BreadcrumbItem } from "components/breadcrumbs";
|
|
// types
|
|
import type { NextPage } from "next";
|
|
import useUser from "hooks/use-user";
|
|
|
|
const MyIssuesPage: NextPage = () => {
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
|
|
const { user } = useUser();
|
|
|
|
const { filters, setFilters } = useMyIssuesFilters(workspaceSlug?.toString());
|
|
|
|
const tabsList = [
|
|
{
|
|
key: "assigned",
|
|
label: "Assigned",
|
|
selected: (filters?.assignees ?? []).length > 0,
|
|
onClick: () => {
|
|
setFilters({
|
|
assignees: [user?.id ?? ""],
|
|
created_by: null,
|
|
subscriber: null,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
key: "created",
|
|
label: "Created",
|
|
selected: (filters?.created_by ?? []).length > 0,
|
|
onClick: () => {
|
|
setFilters({
|
|
assignees: null,
|
|
created_by: [user?.id ?? ""],
|
|
subscriber: null,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
key: "subscribed",
|
|
label: "Subscribed",
|
|
selected: (filters?.subscriber ?? []).length > 0,
|
|
onClick: () => {
|
|
setFilters({
|
|
assignees: null,
|
|
created_by: null,
|
|
subscriber: [user?.id ?? ""],
|
|
});
|
|
},
|
|
},
|
|
];
|
|
|
|
useEffect(() => {
|
|
if (!filters || !user) return;
|
|
|
|
if (!filters.assignees && !filters.created_by && !filters.subscriber) {
|
|
setFilters({
|
|
assignees: [user.id],
|
|
});
|
|
return;
|
|
}
|
|
}, [filters, setFilters, user]);
|
|
|
|
return (
|
|
<WorkspaceAuthorizationLayout
|
|
breadcrumbs={
|
|
<Breadcrumbs>
|
|
<BreadcrumbItem title="My Issues" />
|
|
</Breadcrumbs>
|
|
}
|
|
right={
|
|
<div className="flex items-center gap-2">
|
|
<MyIssuesViewOptions />
|
|
<Button
|
|
variant="primary"
|
|
prependIcon={<Plus />}
|
|
onClick={() => {
|
|
const e = new KeyboardEvent("keydown", { key: "c" });
|
|
document.dispatchEvent(e);
|
|
}}
|
|
>
|
|
Add Issue
|
|
</Button>
|
|
</div>
|
|
}
|
|
>
|
|
<div className="h-full w-full flex flex-col overflow-hidden">
|
|
<div className="px-4 sm:px-5 border-b border-custom-border-300">
|
|
<div className="flex items-center overflow-x-scroll">
|
|
{tabsList.map((tab) => (
|
|
<button
|
|
key={tab.key}
|
|
type="button"
|
|
onClick={tab.onClick}
|
|
className={`border-b-2 p-4 text-sm font-medium outline-none whitespace-nowrap ${
|
|
tab.selected ? "border-custom-primary-100 text-custom-primary-100" : "border-transparent"
|
|
}`}
|
|
>
|
|
{tab.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
<MyIssuesView />
|
|
</div>
|
|
</WorkspaceAuthorizationLayout>
|
|
);
|
|
};
|
|
|
|
export default MyIssuesPage;
|