2023-02-04 14:38:13 +00:00
|
|
|
// hooks
|
2023-03-15 06:14:44 +00:00
|
|
|
import useProjectIssuesView from "hooks/use-issues-view";
|
2023-02-04 14:38:13 +00:00
|
|
|
// components
|
2023-02-05 11:27:37 +00:00
|
|
|
import { SingleBoard } from "components/core/board-view/single-board";
|
2023-02-04 14:38:13 +00:00
|
|
|
// types
|
2023-03-15 06:14:44 +00:00
|
|
|
import { IIssue, IState, UserAuth } from "types";
|
2023-02-04 14:38:13 +00:00
|
|
|
|
|
|
|
type Props = {
|
2023-02-05 11:27:37 +00:00
|
|
|
type: "issue" | "cycle" | "module";
|
|
|
|
states: IState[] | undefined;
|
2023-03-15 06:14:44 +00:00
|
|
|
addIssueToState: (groupTitle: string) => void;
|
2023-03-04 21:54:24 +00:00
|
|
|
makeIssueCopy: (issue: IIssue) => void;
|
2023-02-14 14:35:32 +00:00
|
|
|
handleEditIssue: (issue: IIssue) => void;
|
2023-02-05 11:27:37 +00:00
|
|
|
openIssuesListModal?: (() => void) | null;
|
|
|
|
handleDeleteIssue: (issue: IIssue) => void;
|
2023-02-13 05:02:02 +00:00
|
|
|
handleTrashBox: (isDragging: boolean) => void;
|
2023-02-14 14:35:32 +00:00
|
|
|
removeIssue: ((bridgeId: string) => void) | null;
|
2023-02-04 14:38:13 +00:00
|
|
|
userAuth: UserAuth;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const AllBoards: React.FC<Props> = ({
|
2023-02-05 11:27:37 +00:00
|
|
|
type,
|
|
|
|
states,
|
|
|
|
addIssueToState,
|
2023-03-04 21:54:24 +00:00
|
|
|
makeIssueCopy,
|
2023-02-14 14:35:32 +00:00
|
|
|
handleEditIssue,
|
2023-02-04 14:38:13 +00:00
|
|
|
openIssuesListModal,
|
|
|
|
handleDeleteIssue,
|
2023-02-13 05:02:02 +00:00
|
|
|
handleTrashBox,
|
2023-02-14 14:35:32 +00:00
|
|
|
removeIssue,
|
2023-02-04 14:38:13 +00:00
|
|
|
userAuth,
|
|
|
|
}) => {
|
2023-03-15 06:14:44 +00:00
|
|
|
const { groupedByIssues, groupByProperty: selectedGroup, orderBy } = useProjectIssuesView();
|
2023-02-04 14:38:13 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{groupedByIssues ? (
|
2023-03-15 06:14:44 +00:00
|
|
|
<div className="horizontal-scroll-enable flex h-[calc(100vh-140px)] gap-x-4">
|
|
|
|
{Object.keys(groupedByIssues).map((singleGroup, index) => {
|
|
|
|
const currentState =
|
|
|
|
selectedGroup === "state" ? states?.find((s) => s.id === singleGroup) : null;
|
2023-02-28 09:12:46 +00:00
|
|
|
|
2023-03-15 06:14:44 +00:00
|
|
|
return (
|
|
|
|
<SingleBoard
|
|
|
|
key={index}
|
|
|
|
type={type}
|
|
|
|
currentState={currentState}
|
|
|
|
groupTitle={singleGroup}
|
|
|
|
handleEditIssue={handleEditIssue}
|
|
|
|
makeIssueCopy={makeIssueCopy}
|
|
|
|
addIssueToState={() => addIssueToState(singleGroup)}
|
|
|
|
handleDeleteIssue={handleDeleteIssue}
|
|
|
|
openIssuesListModal={openIssuesListModal ?? null}
|
|
|
|
handleTrashBox={handleTrashBox}
|
|
|
|
removeIssue={removeIssue}
|
|
|
|
userAuth={userAuth}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
})}
|
2023-02-04 14:38:13 +00:00
|
|
|
</div>
|
2023-03-15 06:14:44 +00:00
|
|
|
) : null}
|
2023-02-04 14:38:13 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|