2023-06-16 13:27:17 +00:00
|
|
|
import { useRouter } from "next/router";
|
|
|
|
|
|
|
|
// hooks
|
|
|
|
import useInboxView from "hooks/use-inbox-view";
|
|
|
|
// components
|
2023-06-21 12:02:56 +00:00
|
|
|
import { InboxIssueCard, InboxFiltersList } from "components/inbox";
|
2023-06-16 13:27:17 +00:00
|
|
|
// ui
|
|
|
|
import { Loader } from "components/ui";
|
|
|
|
|
|
|
|
export const IssuesListSidebar = () => {
|
|
|
|
const router = useRouter();
|
|
|
|
const { inboxIssueId } = router.query;
|
|
|
|
|
2023-06-23 14:00:53 +00:00
|
|
|
const { issues: inboxIssues, filtersLength } = useInboxView();
|
2023-06-16 13:27:17 +00:00
|
|
|
|
|
|
|
return (
|
2023-06-21 12:02:56 +00:00
|
|
|
<div className="h-full flex flex-col overflow-hidden">
|
|
|
|
<InboxFiltersList />
|
2023-06-16 13:27:17 +00:00
|
|
|
{inboxIssues ? (
|
|
|
|
inboxIssues.length > 0 ? (
|
2023-07-17 10:58:23 +00:00
|
|
|
<div className="divide-y divide-custom-border-200 overflow-auto h-full">
|
2023-06-16 13:27:17 +00:00
|
|
|
{inboxIssues.map((issue) => (
|
|
|
|
<InboxIssueCard
|
|
|
|
key={issue.id}
|
|
|
|
active={issue.bridge_id === inboxIssueId}
|
|
|
|
issue={issue}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
) : (
|
2023-07-10 07:17:00 +00:00
|
|
|
<div className="h-full p-4 grid place-items-center text-center text-sm text-custom-text-200">
|
2023-06-23 14:00:53 +00:00
|
|
|
{filtersLength > 0 &&
|
|
|
|
"No issues found for the selected filters. Try changing the filters."}
|
2023-06-16 13:27:17 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
) : (
|
|
|
|
<Loader className="p-4 space-y-4">
|
|
|
|
<Loader.Item height="50px" />
|
|
|
|
<Loader.Item height="50px" />
|
|
|
|
<Loader.Item height="50px" />
|
|
|
|
<Loader.Item height="50px" />
|
|
|
|
</Loader>
|
|
|
|
)}
|
2023-06-21 12:02:56 +00:00
|
|
|
</div>
|
2023-06-16 13:27:17 +00:00
|
|
|
);
|
|
|
|
};
|