mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
1dac70ecbe
* chore: inbox issue status pill improvement * chore: loader inconsistancy resolved * chore: accepted and decline inbox issue validation * chore: removed clear all button in applied filters * chore: inbox issue create label improvement * chore: updated label filter * chore: updated fetching activites and comments * chore: inbox filters date * chore: removed the print statement * chore: inbox date filter updated * chore: handled custom date filter in inbox issue query params * chore: handled custom date filter in inbox issue single select * chore: inbox custom date filter updated * chore: inbox sidebar filter improvement * chore: inbox sidebar filter improvement * chore: duplicate issue detail * chore: duplicate inbox issue improvement * chore: lint issue resolved --------- Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import { FC } from "react";
|
|
import { observer } from "mobx-react";
|
|
import useSWR from "swr";
|
|
import { Inbox } from "lucide-react";
|
|
// components
|
|
import { EmptyState } from "@/components/empty-state";
|
|
import { InboxSidebar, InboxContentRoot } from "@/components/inbox";
|
|
import { InboxLayoutLoader } from "@/components/ui";
|
|
// constants
|
|
import { EmptyStateType } from "@/constants/empty-state";
|
|
// hooks
|
|
import { useProjectInbox } from "@/hooks/store";
|
|
|
|
type TInboxIssueRoot = {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
inboxIssueId: string | undefined;
|
|
inboxAccessible: boolean;
|
|
};
|
|
|
|
export const InboxIssueRoot: FC<TInboxIssueRoot> = observer((props) => {
|
|
const { workspaceSlug, projectId, inboxIssueId, inboxAccessible } = props;
|
|
// hooks
|
|
const { isLoading, error, fetchInboxIssues } = useProjectInbox();
|
|
|
|
useSWR(
|
|
inboxAccessible && workspaceSlug && projectId ? `PROJECT_INBOX_ISSUES_${workspaceSlug}_${projectId}` : null,
|
|
() => {
|
|
inboxAccessible && workspaceSlug && projectId && fetchInboxIssues(workspaceSlug.toString(), projectId.toString());
|
|
},
|
|
{ revalidateOnFocus: false, revalidateIfStale: false }
|
|
);
|
|
|
|
// loader
|
|
if (isLoading === "init-loading")
|
|
return (
|
|
<div className="relative flex w-full h-full flex-col">
|
|
<InboxLayoutLoader />
|
|
</div>
|
|
);
|
|
|
|
// error
|
|
if (error && error?.status === "init-error")
|
|
return (
|
|
<div className="relative w-full h-full flex flex-col gap-3 justify-center items-center">
|
|
<Inbox size={60} strokeWidth={1.5} />
|
|
<div className="text-custom-text-200">{error?.message}</div>
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<div className="relative w-full h-full flex overflow-hidden">
|
|
<InboxSidebar workspaceSlug={workspaceSlug.toString()} projectId={projectId.toString()} />
|
|
|
|
{inboxIssueId ? (
|
|
<InboxContentRoot
|
|
workspaceSlug={workspaceSlug.toString()}
|
|
projectId={projectId.toString()}
|
|
inboxIssueId={inboxIssueId.toString()}
|
|
/>
|
|
) : (
|
|
<div className="w-full h-full relative flex justify-center items-center">
|
|
<EmptyState type={EmptyStateType.INBOX_DETAIL_EMPTY_STATE} layout="screen-simple" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|