mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
2f10f35191
* refactor: updated preloaded function for the list view quick add * fix: resolved bug in the assignee dropdown * chore: issue sidebar link improvement * fix: resolved subscription store bug * chore: updated preloaded function for the kanban layout quick add * chore: resolved issues in the list filters and component * chore: filter store updated * fix: issue serializer changed * chore: quick add preload function updated * fix: build error * fix: serializer changed * fix: minor request change * chore: resolved build issues and updated the prepopulated data in the quick add issue. * fix: build fix and code refactor * fix: spreadsheet layout quick add fix * fix: issue peek overview link section updated * fix: cycle status bug fix * fix: serializer changes * fix: assignee and labels listing * chore: issue modal parent_id default value updated * fix: cycle and module issue serializer change * fix: cycle list serializer changed * chore: prepopulated validation in both list and kanban for quick add and group header add issues * chore: group header validation added * fix: issue response payload change * dev: make cycle and module issue create response simillar * chore: custom control link component added * dev: make issue create and update response simillar to list and retrieve * fix: build error * chore: control link component improvement * chore: globalise issue peek overview * chore: control link component improvement * chore: made changes and optimised the issue peek overview root * build-error: resolved build erros for issueId dependancy from issue detail store * chore: peek overview link fix * dev: update state nullable rule --------- Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import React, { useState } from "react";
|
|
|
|
import { useRouter } from "next/router";
|
|
// hooks
|
|
import { useIssueDetail, useIssues, useProject } from "hooks/store";
|
|
// components
|
|
import { ParentIssuesListModal } from "components/issues";
|
|
// icons
|
|
import { X } from "lucide-react";
|
|
// types
|
|
import { TIssue, ISearchIssueResponse } from "@plane/types";
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
type Props = {
|
|
onChange: (value: string) => void;
|
|
issueDetails: TIssue | undefined;
|
|
disabled?: boolean;
|
|
};
|
|
|
|
export const SidebarParentSelect: React.FC<Props> = observer(({ onChange, issueDetails, disabled = false }) => {
|
|
const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null);
|
|
|
|
const { isParentIssueModalOpen, toggleParentIssueModal } = useIssueDetail();
|
|
|
|
const router = useRouter();
|
|
const { projectId, issueId } = router.query;
|
|
|
|
// hooks
|
|
const { getProjectById } = useProject();
|
|
const { issueMap } = useIssues();
|
|
|
|
return (
|
|
<>
|
|
<ParentIssuesListModal
|
|
isOpen={isParentIssueModalOpen}
|
|
handleClose={() => toggleParentIssueModal(false)}
|
|
onChange={(issue) => {
|
|
onChange(issue.id);
|
|
setSelectedParentIssue(issue);
|
|
}}
|
|
issueId={issueId as string}
|
|
projectId={projectId as string}
|
|
/>
|
|
<button
|
|
className={`flex items-center gap-2 rounded bg-custom-background-80 px-2.5 py-0.5 text-xs w-max max-w-max" ${
|
|
disabled ? "cursor-not-allowed" : "cursor-pointer "
|
|
}`}
|
|
onClick={() => {
|
|
if (issueDetails?.parent_id) {
|
|
onChange("");
|
|
setSelectedParentIssue(null);
|
|
} else {
|
|
toggleParentIssueModal(true);
|
|
}
|
|
}}
|
|
disabled={disabled}
|
|
>
|
|
{selectedParentIssue && issueDetails?.parent_id ? (
|
|
`${selectedParentIssue.project__identifier}-${selectedParentIssue.sequence_id}`
|
|
) : !selectedParentIssue && issueDetails?.parent_id ? (
|
|
`${getProjectById(issueDetails.parent_id)?.identifier}-${issueMap[issueDetails.parent_id]?.sequence_id}`
|
|
) : (
|
|
<span className="text-custom-text-200">Select issue</span>
|
|
)}
|
|
{issueDetails?.parent_id && <X className="h-2.5 w-2.5" />}
|
|
</button>
|
|
</>
|
|
);
|
|
});
|