[WEB-3868] fix: issue detail widget modals #6933
This commit is contained in:
parent
608da1465c
commit
48557cb670
2 changed files with 28 additions and 17 deletions
|
|
@ -12,16 +12,18 @@ import { IssueLinkCreateUpdateModal } from "../issue-detail/links/create-update-
|
||||||
// helpers
|
// helpers
|
||||||
import { useLinkOperations } from "./links/helper";
|
import { useLinkOperations } from "./links/helper";
|
||||||
import { useSubIssueOperations } from "./sub-issues/helper";
|
import { useSubIssueOperations } from "./sub-issues/helper";
|
||||||
|
import { TWorkItemWidgets } from ".";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
issueId: string;
|
issueId: string;
|
||||||
issueServiceType: TIssueServiceType;
|
issueServiceType: TIssueServiceType;
|
||||||
|
hideWidgets?: TWorkItemWidgets[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IssueDetailWidgetModals: FC<Props> = observer((props) => {
|
export const IssueDetailWidgetModals: FC<Props> = observer((props) => {
|
||||||
const { workspaceSlug, projectId, issueId, issueServiceType } = props;
|
const { workspaceSlug, projectId, issueId, issueServiceType, hideWidgets } = props;
|
||||||
// store hooks
|
// store hooks
|
||||||
const {
|
const {
|
||||||
isIssueLinkModalOpen,
|
isIssueLinkModalOpen,
|
||||||
|
|
@ -134,21 +136,27 @@ export const IssueDetailWidgetModals: FC<Props> = observer((props) => {
|
||||||
|
|
||||||
// render conditions
|
// render conditions
|
||||||
const shouldRenderExistingIssuesModal =
|
const shouldRenderExistingIssuesModal =
|
||||||
|
!hideWidgets?.includes("sub-work-items") &&
|
||||||
issueCrudOperationState?.existing?.toggle &&
|
issueCrudOperationState?.existing?.toggle &&
|
||||||
issueCrudOperationState?.existing?.parentIssueId &&
|
issueCrudOperationState?.existing?.parentIssueId &&
|
||||||
isSubIssuesModalOpen;
|
isSubIssuesModalOpen;
|
||||||
|
|
||||||
const shouldRenderCreateUpdateModal =
|
const shouldRenderCreateUpdateModal =
|
||||||
issueCrudOperationState?.create?.toggle && issueCrudOperationState?.create?.parentIssueId && isCreateIssueModalOpen;
|
!hideWidgets?.includes("sub-work-items") &&
|
||||||
|
issueCrudOperationState?.create?.toggle &&
|
||||||
|
issueCrudOperationState?.create?.parentIssueId &&
|
||||||
|
isCreateIssueModalOpen;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{!hideWidgets?.includes("links") && (
|
||||||
<IssueLinkCreateUpdateModal
|
<IssueLinkCreateUpdateModal
|
||||||
isModalOpen={isIssueLinkModalOpen}
|
isModalOpen={isIssueLinkModalOpen}
|
||||||
handleOnClose={handleIssueLinkModalOnClose}
|
handleOnClose={handleIssueLinkModalOnClose}
|
||||||
linkOperations={handleLinkOperations}
|
linkOperations={handleLinkOperations}
|
||||||
issueServiceType={issueServiceType}
|
issueServiceType={issueServiceType}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{shouldRenderCreateUpdateModal && (
|
{shouldRenderCreateUpdateModal && (
|
||||||
<CreateUpdateIssueModal
|
<CreateUpdateIssueModal
|
||||||
|
|
@ -171,6 +179,7 @@ export const IssueDetailWidgetModals: FC<Props> = observer((props) => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!hideWidgets?.includes("relations") && (
|
||||||
<ExistingIssuesListModal
|
<ExistingIssuesListModal
|
||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
|
|
@ -180,6 +189,7 @@ export const IssueDetailWidgetModals: FC<Props> = observer((props) => {
|
||||||
handleOnSubmit={handleExistingIssueModalOnSubmit}
|
handleOnSubmit={handleExistingIssueModalOnSubmit}
|
||||||
workspaceLevelToggle
|
workspaceLevelToggle
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ export const IssueDetailWidgets: FC<Props> = (props) => {
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
issueId={issueId}
|
issueId={issueId}
|
||||||
issueServiceType={issueServiceType}
|
issueServiceType={issueServiceType}
|
||||||
|
hideWidgets={hideWidgets}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue