fix: peek overview sub issue operation (#4002)

This commit is contained in:
Anmol Singh Bhatia 2024-03-20 20:00:34 +05:30 committed by GitHub
parent 054dd2bb7d
commit 37c5ce54d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View File

@ -45,6 +45,8 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
setPeekIssue, setPeekIssue,
issue: { getIssueById }, issue: { getIssueById },
subIssues: { subIssueHelpersByIssueId, setSubIssueHelpers }, subIssues: { subIssueHelpersByIssueId, setSubIssueHelpers },
toggleCreateIssueModal,
toggleDeleteIssueModal,
} = useIssueDetail(); } = useIssueDetail();
const project = useProject(); const project = useProject();
const { getProjectStates } = useProjectState(); const { getProjectStates } = useProjectState();
@ -139,7 +141,12 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
<div className="flex-shrink-0 text-sm"> <div className="flex-shrink-0 text-sm">
<CustomMenu placement="bottom-end" ellipsis> <CustomMenu placement="bottom-end" ellipsis>
{disabled && ( {disabled && (
<CustomMenu.MenuItem onClick={() => handleIssueCrudState("update", parentIssueId, { ...issue })}> <CustomMenu.MenuItem
onClick={() => {
handleIssueCrudState("update", parentIssueId, { ...issue });
toggleCreateIssueModal(true);
}}
>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Pencil className="h-3.5 w-3.5" strokeWidth={2} /> <Pencil className="h-3.5 w-3.5" strokeWidth={2} />
<span>Edit issue</span> <span>Edit issue</span>
@ -148,7 +155,12 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
)} )}
{disabled && ( {disabled && (
<CustomMenu.MenuItem onClick={() => handleIssueCrudState("delete", parentIssueId, issue)}> <CustomMenu.MenuItem
onClick={() => {
handleIssueCrudState("delete", parentIssueId, issue);
toggleDeleteIssueModal(true);
}}
>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Trash className="h-3.5 w-3.5" strokeWidth={2} /> <Trash className="h-3.5 w-3.5" strokeWidth={2} />
<span>Delete issue</span> <span>Delete issue</span>

View File

@ -57,6 +57,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
toggleCreateIssueModal, toggleCreateIssueModal,
isSubIssuesModalOpen, isSubIssuesModalOpen,
toggleSubIssuesModal, toggleSubIssuesModal,
toggleDeleteIssueModal,
} = useIssueDetail(); } = useIssueDetail();
const { setTrackElement, captureIssueEvent } = useEventTracker(); const { setTrackElement, captureIssueEvent } = useEventTracker();
// state // state
@ -496,6 +497,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
isOpen={issueCrudState?.update?.toggle} isOpen={issueCrudState?.update?.toggle}
onClose={() => { onClose={() => {
handleIssueCrudState("update", null, null); handleIssueCrudState("update", null, null);
toggleCreateIssueModal(false);
}} }}
data={issueCrudState?.update?.issue ?? undefined} data={issueCrudState?.update?.issue ?? undefined}
onSubmit={async (_issue: TIssue) => { onSubmit={async (_issue: TIssue) => {
@ -521,6 +523,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
isOpen={issueCrudState?.delete?.toggle} isOpen={issueCrudState?.delete?.toggle}
handleClose={() => { handleClose={() => {
handleIssueCrudState("delete", null, null); handleIssueCrudState("delete", null, null);
toggleDeleteIssueModal(false);
}} }}
data={issueCrudState?.delete?.issue as TIssue} data={issueCrudState?.delete?.issue as TIssue}
onSubmit={async () => onSubmit={async () =>