From 32d945be0d06caf48cbe2aeac577bc42df31b4e5 Mon Sep 17 00:00:00 2001
From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com>
Date: Fri, 15 Sep 2023 12:51:10 +0530
Subject: [PATCH] fix: edit/delete for draft issue (#2190)
* fix: edit/delete
* fix: build issue
* fix: draft issue modal opening in kanban card
---
.../core/filters/issues-view-filter.tsx | 44 +++++-
web/components/core/views/all-views.tsx | 6 +-
.../core/views/board-view/all-boards.tsx | 5 +-
.../core/views/board-view/single-board.tsx | 14 +-
.../core/views/board-view/single-issue.tsx | 91 +++++++----
web/components/core/views/issues-view.tsx | 54 +++++--
.../core/views/list-view/all-lists.tsx | 5 +-
.../core/views/list-view/single-issue.tsx | 80 +++++++---
.../core/views/list-view/single-list.tsx | 15 +-
.../issues/delete-draft-issue-modal.tsx | 145 ++++++++++++++++++
web/components/issues/form.tsx | 8 +-
web/components/issues/index.ts | 3 +
.../workspace/sidebar-quick-action.tsx | 9 +-
.../[projectId]/draft-issues/index.tsx | 2 +-
14 files changed, 403 insertions(+), 78 deletions(-)
create mode 100644 web/components/issues/delete-draft-issue-modal.tsx
diff --git a/web/components/core/filters/issues-view-filter.tsx b/web/components/core/filters/issues-view-filter.tsx
index 6354625dc..afb7eb2b0 100644
--- a/web/components/core/filters/issues-view-filter.tsx
+++ b/web/components/core/filters/issues-view-filter.tsx
@@ -52,10 +52,22 @@ const issueViewOptions: { type: TIssueViewOptions; Icon: any }[] = [
},
];
+const issueViewForDraftIssues: { type: TIssueViewOptions; Icon: any }[] = [
+ {
+ type: "list",
+ Icon: FormatListBulletedOutlined,
+ },
+ {
+ type: "kanban",
+ Icon: GridViewOutlined,
+ },
+];
+
export const IssuesFilterView: React.FC = () => {
const router = useRouter();
const { workspaceSlug, projectId, viewId } = router.query;
const isArchivedIssues = router.pathname.includes("archived-issues");
+ const isDraftIssues = router.pathname.includes("draft-issues");
const {
displayFilters,
@@ -75,7 +87,7 @@ export const IssuesFilterView: React.FC = () => {
return (
- {!isArchivedIssues && (
+ {!isArchivedIssues && !isDraftIssues && (
{issueViewOptions.map((option) => (
{
))}
)}
+ {isDraftIssues && (
+
+ {issueViewForDraftIssues.map((option) => (
+ {replaceUnderscoreIfSnakeCase(option.type)} View
+ }
+ position="bottom"
+ >
+
+
+ ))}
+
+ )}
{
diff --git a/web/components/core/views/all-views.tsx b/web/components/core/views/all-views.tsx
index a83ca322b..67804e5e6 100644
--- a/web/components/core/views/all-views.tsx
+++ b/web/components/core/views/all-views.tsx
@@ -49,7 +49,8 @@ type Props = {
};
secondaryButton?: React.ReactNode;
};
- handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit" | "updateDraft") => void;
+ handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
+ handleDraftIssueAction?: (issue: IIssue, action: "edit" | "delete") => void;
handleOnDragEnd: (result: DropResult) => Promise;
openIssuesListModal: (() => void) | null;
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
@@ -66,6 +67,7 @@ export const AllViews: React.FC = ({
dragDisabled = false,
emptyState,
handleIssueAction,
+ handleDraftIssueAction,
handleOnDragEnd,
openIssuesListModal,
removeIssue,
@@ -132,6 +134,7 @@ export const AllViews: React.FC = ({
states={states}
addIssueToGroup={addIssueToGroup}
handleIssueAction={handleIssueAction}
+ handleDraftIssueAction={handleDraftIssueAction}
openIssuesListModal={cycleId || moduleId ? openIssuesListModal : null}
removeIssue={removeIssue}
myIssueProjectId={myIssueProjectId}
@@ -149,6 +152,7 @@ export const AllViews: React.FC = ({
disableAddIssueOption={disableAddIssueOption}
dragDisabled={dragDisabled}
handleIssueAction={handleIssueAction}
+ handleDraftIssueAction={handleDraftIssueAction}
handleTrashBox={handleTrashBox}
openIssuesListModal={cycleId || moduleId ? openIssuesListModal : null}
myIssueProjectId={myIssueProjectId}
diff --git a/web/components/core/views/board-view/all-boards.tsx b/web/components/core/views/board-view/all-boards.tsx
index a172d466c..ea5ebb2b1 100644
--- a/web/components/core/views/board-view/all-boards.tsx
+++ b/web/components/core/views/board-view/all-boards.tsx
@@ -19,7 +19,8 @@ type Props = {
disableUserActions: boolean;
disableAddIssueOption?: boolean;
dragDisabled: boolean;
- handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit" | "updateDraft") => void;
+ handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
+ handleDraftIssueAction?: (issue: IIssue, action: "edit" | "delete") => void;
handleTrashBox: (isDragging: boolean) => void;
openIssuesListModal?: (() => void) | null;
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
@@ -37,6 +38,7 @@ export const AllBoards: React.FC = ({
disableAddIssueOption = false,
dragDisabled,
handleIssueAction,
+ handleDraftIssueAction,
handleTrashBox,
openIssuesListModal,
myIssueProjectId,
@@ -94,6 +96,7 @@ export const AllBoards: React.FC = ({
dragDisabled={dragDisabled}
groupTitle={singleGroup}
handleIssueAction={handleIssueAction}
+ handleDraftIssueAction={handleDraftIssueAction}
handleTrashBox={handleTrashBox}
openIssuesListModal={openIssuesListModal ?? null}
handleMyIssueOpen={handleMyIssueOpen}
diff --git a/web/components/core/views/board-view/single-board.tsx b/web/components/core/views/board-view/single-board.tsx
index 5b87f8aba..1981e1f7c 100644
--- a/web/components/core/views/board-view/single-board.tsx
+++ b/web/components/core/views/board-view/single-board.tsx
@@ -24,6 +24,7 @@ type Props = {
dragDisabled: boolean;
groupTitle: string;
handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
+ handleDraftIssueAction?: (issue: IIssue, action: "edit" | "delete") => void;
handleTrashBox: (isDragging: boolean) => void;
openIssuesListModal?: (() => void) | null;
handleMyIssueOpen?: (issue: IIssue) => void;
@@ -41,6 +42,7 @@ export const SingleBoard: React.FC = ({
disableAddIssueOption = false,
dragDisabled,
handleIssueAction,
+ handleDraftIssueAction,
handleTrashBox,
openIssuesListModal,
handleMyIssueOpen,
@@ -136,6 +138,16 @@ export const SingleBoard: React.FC = ({
editIssue={() => handleIssueAction(issue, "edit")}
makeIssueCopy={() => handleIssueAction(issue, "copy")}
handleDeleteIssue={() => handleIssueAction(issue, "delete")}
+ handleDraftIssueEdit={
+ handleDraftIssueAction
+ ? () => handleDraftIssueAction(issue, "edit")
+ : undefined
+ }
+ handleDraftIssueDelete={() =>
+ handleDraftIssueAction
+ ? handleDraftIssueAction(issue, "delete")
+ : undefined
+ }
handleTrashBox={handleTrashBox}
handleMyIssueOpen={handleMyIssueOpen}
removeIssue={() => {
@@ -155,7 +167,7 @@ export const SingleBoard: React.FC = ({
display: displayFilters?.order_by === "sort_order" ? "inline" : "none",
}}
>
- {provided.placeholder}
+ <>{provided.placeholder}>
{displayFilters?.group_by !== "created_by" && (
diff --git a/web/components/core/views/board-view/single-issue.tsx b/web/components/core/views/board-view/single-issue.tsx
index ffd4747d9..2c15f0a48 100644
--- a/web/components/core/views/board-view/single-issue.tsx
+++ b/web/components/core/views/board-view/single-issue.tsx
@@ -60,6 +60,8 @@ type Props = {
handleMyIssueOpen?: (issue: IIssue) => void;
removeIssue?: (() => void) | null;
handleDeleteIssue: (issue: IIssue) => void;
+ handleDraftIssueEdit?: () => void;
+ handleDraftIssueDelete?: () => void;
handleTrashBox: (isDragging: boolean) => void;
disableUserActions: boolean;
user: ICurrentUserResponse | undefined;
@@ -79,6 +81,8 @@ export const SingleBoardIssue: React.FC = ({
removeIssue,
groupTitle,
handleDeleteIssue,
+ handleDraftIssueEdit,
+ handleDraftIssueDelete,
handleTrashBox,
disableUserActions,
user,
@@ -99,6 +103,8 @@ export const SingleBoardIssue: React.FC = ({
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId } = router.query;
+ const isDraftIssue = router.pathname.includes("draft-issues");
+
const { setToastAlert } = useToast();
const partialUpdateIssue = useCallback(
@@ -211,29 +217,47 @@ export const SingleBoardIssue: React.FC = ({
>
{!isNotAllowed && (
<>
-
+ {
+ if (isDraftIssue && handleDraftIssueEdit) handleDraftIssueEdit();
+ else editIssue();
+ }}
+ >
Edit issue
-
- Make a copy...
-
- handleDeleteIssue(issue)}>
+ {!isDraftIssue && (
+
+ Make a copy...
+
+ )}
+ {
+ if (isDraftIssue && handleDraftIssueDelete) handleDraftIssueDelete();
+ else handleDeleteIssue(issue);
+ }}
+ >
Delete issue
>
)}
-
- Copy issue link
-
-
-
- Open issue in new tab
+ {!isDraftIssue && (
+
+ Copy issue link
-
+ )}
+ {!isDraftIssue && (
+
+
+ Open issue in new tab
+
+
+ )}
= ({
}
>
-
+ {
+ if (isDraftIssue && handleDraftIssueEdit) handleDraftIssueEdit();
+ else editIssue();
+ }}
+ >
- {type !== "issue" && removeIssue && (
+ {type !== "issue" && removeIssue && !isDraftIssue && (
@@ -282,18 +311,25 @@ export const SingleBoardIssue: React.FC
= ({
)}
- handleDeleteIssue(issue)}>
+ {
+ if (isDraftIssue && handleDraftIssueDelete) handleDraftIssueDelete();
+ else handleDeleteIssue(issue);
+ }}
+ >
Delete issue
-
-
-
- Copy issue Link
-
-
+ {!isDraftIssue && (
+
+
+
+ Copy issue Link
+
+
+ )}
)}
@@ -308,7 +344,10 @@ export const SingleBoardIssue: React.FC = ({
diff --git a/web/components/core/views/issues-view.tsx b/web/components/core/views/issues-view.tsx
index be6e20271..98b687207 100644
--- a/web/components/core/views/issues-view.tsx
+++ b/web/components/core/views/issues-view.tsx
@@ -22,6 +22,7 @@ import { FiltersList, AllViews } from "components/core";
import {
CreateUpdateIssueModal,
DeleteIssueModal,
+ DeleteDraftIssueModal,
IssuePeekOverview,
CreateUpdateDraftIssueModal,
} from "components/issues";
@@ -77,9 +78,11 @@ export const IssuesView: React.FC = ({
// selected draft issue
const [selectedDraftIssue, setSelectedDraftIssue] = useState(null);
+ const [selectedDraftForDelete, setSelectDraftForDelete] = useState(null);
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query;
+ const isDraftIssues = router.asPath.includes("draft-issues");
const { user } = useUserAuth();
@@ -114,7 +117,8 @@ export const IssuesView: React.FC = ({
[setDeleteIssueModal, setIssueToDelete]
);
- const handleDraftIssueClick = (issue: any) => setSelectedDraftIssue(issue);
+ const handleDraftIssueClick = useCallback((issue: any) => setSelectedDraftIssue(issue), []);
+ const handleDraftIssueDelete = useCallback((issue: any) => setSelectDraftForDelete(issue), []);
const handleOnDragEnd = useCallback(
async (result: DropResult) => {
@@ -345,15 +349,22 @@ export const IssuesView: React.FC = ({
);
const handleIssueAction = useCallback(
- (issue: IIssue, action: "copy" | "edit" | "delete" | "updateDraft") => {
+ (issue: IIssue, action: "copy" | "edit" | "delete") => {
if (action === "copy") makeIssueCopy(issue);
else if (action === "edit") handleEditIssue(issue);
else if (action === "delete") handleDeleteIssue(issue);
- else if (action === "updateDraft") handleDraftIssueClick(issue);
},
[makeIssueCopy, handleEditIssue, handleDeleteIssue]
);
+ const handleDraftIssueAction = useCallback(
+ (issue: IIssue, action: "edit" | "delete") => {
+ if (action === "edit") handleDraftIssueClick(issue);
+ else if (action === "delete") handleDraftIssueDelete(issue);
+ },
+ [handleDraftIssueClick, handleDraftIssueDelete]
+ );
+
const removeIssueFromCycle = useCallback(
(bridgeId: string, issueId: string) => {
if (!workspaceSlug || !projectId || !cycleId) return;
@@ -494,6 +505,11 @@ export const IssuesView: React.FC = ({
data={issueToDelete}
user={user}
/>
+ setSelectDraftForDelete(null)}
+ />
{areFiltersApplied && (
<>
@@ -550,23 +566,28 @@ export const IssuesView: React.FC = ({
displayFilters.group_by === "assignees"
}
emptyState={{
- title: cycleId
+ title: isDraftIssues
+ ? "Draft issues will appear here"
+ : cycleId
? "Cycle issues will appear here"
: moduleId
? "Module issues will appear here"
: "Project issues will appear here",
- description:
- "Issues help you track individual pieces of work. With Issues, keep track of what's going on, who is working on it, and what's done.",
- primaryButton: {
- icon: ,
- text: "New Issue",
- onClick: () => {
- const e = new KeyboardEvent("keydown", {
- key: "c",
- });
- document.dispatchEvent(e);
- },
- },
+ description: isDraftIssues
+ ? "Draft issues are issues that are not yet created."
+ : "Issues help you track individual pieces of work. With Issues, keep track of what's going on, who is working on it, and what's done.",
+ primaryButton: !isDraftIssues
+ ? {
+ icon: ,
+ text: "New Issue",
+ onClick: () => {
+ const e = new KeyboardEvent("keydown", {
+ key: "c",
+ });
+ document.dispatchEvent(e);
+ },
+ }
+ : undefined,
secondaryButton:
cycleId || moduleId ? (
= ({
}}
handleOnDragEnd={handleOnDragEnd}
handleIssueAction={handleIssueAction}
+ handleDraftIssueAction={handleDraftIssueAction}
openIssuesListModal={openIssuesListModal ?? null}
removeIssue={cycleId ? removeIssueFromCycle : moduleId ? removeIssueFromModule : null}
trashBox={trashBox}
diff --git a/web/components/core/views/list-view/all-lists.tsx b/web/components/core/views/list-view/all-lists.tsx
index c84684d61..58025b328 100644
--- a/web/components/core/views/list-view/all-lists.tsx
+++ b/web/components/core/views/list-view/all-lists.tsx
@@ -14,7 +14,8 @@ import { ICurrentUserResponse, IIssue, IIssueViewProps, IState, UserAuth } from
type Props = {
states: IState[] | undefined;
addIssueToGroup: (groupTitle: string) => void;
- handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit" | "updateDraft") => void;
+ handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
+ handleDraftIssueAction?: (issue: IIssue, action: "edit" | "delete") => void;
openIssuesListModal?: (() => void) | null;
myIssueProjectId?: string | null;
handleMyIssueOpen?: (issue: IIssue) => void;
@@ -36,6 +37,7 @@ export const AllLists: React.FC = ({
myIssueProjectId,
removeIssue,
states,
+ handleDraftIssueAction,
user,
userAuth,
viewProps,
@@ -82,6 +84,7 @@ export const AllLists: React.FC = ({
groupTitle={singleGroup}
currentState={currentState}
addIssueToGroup={() => addIssueToGroup(singleGroup)}
+ handleDraftIssueAction={handleDraftIssueAction}
handleIssueAction={handleIssueAction}
handleMyIssueOpen={handleMyIssueOpen}
openIssuesListModal={openIssuesListModal}
diff --git a/web/components/core/views/list-view/single-issue.tsx b/web/components/core/views/list-view/single-issue.tsx
index aad6af6c8..0bcd98d09 100644
--- a/web/components/core/views/list-view/single-issue.tsx
+++ b/web/components/core/views/list-view/single-issue.tsx
@@ -1,6 +1,5 @@
import React, { useCallback, useState } from "react";
-import Link from "next/link";
import { useRouter } from "next/router";
import { mutate } from "swr";
@@ -18,6 +17,7 @@ import {
ViewPrioritySelect,
ViewStartDateSelect,
ViewStateSelect,
+ CreateUpdateDraftIssueModal,
} from "components/issues";
// ui
import { Tooltip, CustomMenu, ContextMenu } from "components/ui";
@@ -62,6 +62,7 @@ type Props = {
removeIssue?: (() => void) | null;
handleDeleteIssue: (issue: IIssue) => void;
handleDraftIssueSelect?: (issue: IIssue) => void;
+ handleDraftIssueDelete?: (issue: IIssue) => void;
handleMyIssueOpen?: (issue: IIssue) => void;
disableUserActions: boolean;
user: ICurrentUserResponse | undefined;
@@ -77,6 +78,7 @@ export const SingleListIssue: React.FC = ({
makeIssueCopy,
removeIssue,
groupTitle,
+ handleDraftIssueDelete,
handleDeleteIssue,
handleMyIssueOpen,
disableUserActions,
@@ -208,26 +210,45 @@ export const SingleListIssue: React.FC = ({
>
{!isNotAllowed && (
<>
-
+ {
+ if (isDraftIssues && handleDraftIssueSelect) handleDraftIssueSelect(issue);
+ else editIssue();
+ }}
+ >
Edit issue
-
- Make a copy...
-
- handleDeleteIssue(issue)}>
+ {!isDraftIssues && (
+
+ Make a copy...
+
+ )}
+ {
+ if (isDraftIssues && handleDraftIssueDelete) handleDraftIssueDelete(issue);
+ else handleDeleteIssue(issue);
+ }}
+ >
Delete issue
>
)}
-
- Copy issue link
-
-
-
- Open issue in new tab
-
-
+ {!isDraftIssues && (
+ <>
+
+ Copy issue link
+
+
+
+ Open issue in new tab
+
+
+ >
+ )}
+
{
@@ -254,8 +275,7 @@ export const SingleListIssue: React.FC
= ({
className="truncate text-[0.825rem] text-custom-text-100"
onClick={() => {
if (!isDraftIssues) openPeekOverview(issue);
-
- if (handleDraftIssueSelect) handleDraftIssueSelect(issue);
+ if (isDraftIssues && handleDraftIssueSelect) handleDraftIssueSelect(issue);
}}
>
{issue.name}
@@ -354,7 +374,12 @@ export const SingleListIssue: React.FC = ({
)}
{type && !isNotAllowed && (
-
+ {
+ if (isDraftIssues && handleDraftIssueSelect) handleDraftIssueSelect(issue);
+ else editIssue();
+ }}
+ >
Edit issue
@@ -368,18 +393,25 @@ export const SingleListIssue: React.FC
= ({
)}
- handleDeleteIssue(issue)}>
+ {
+ if (isDraftIssues && handleDraftIssueDelete) handleDraftIssueDelete(issue);
+ else handleDeleteIssue(issue);
+ }}
+ >
Delete issue
-
-
-
- Copy issue link
-
-
+ {!isDraftIssues && (
+
+
+
+ Copy issue link
+
+
+ )}
)}
diff --git a/web/components/core/views/list-view/single-list.tsx b/web/components/core/views/list-view/single-list.tsx
index 3bf58a703..9a1212141 100644
--- a/web/components/core/views/list-view/single-list.tsx
+++ b/web/components/core/views/list-view/single-list.tsx
@@ -39,7 +39,8 @@ type Props = {
currentState?: IState | null;
groupTitle: string;
addIssueToGroup: () => void;
- handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit" | "updateDraft") => void;
+ handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
+ handleDraftIssueAction?: (issue: IIssue, action: "edit" | "delete") => void;
openIssuesListModal?: (() => void) | null;
handleMyIssueOpen?: (issue: IIssue) => void;
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
@@ -56,6 +57,7 @@ export const SingleList: React.FC = ({
addIssueToGroup,
handleIssueAction,
openIssuesListModal,
+ handleDraftIssueAction,
handleMyIssueOpen,
removeIssue,
disableUserActions,
@@ -253,7 +255,16 @@ export const SingleList: React.FC = ({
editIssue={() => handleIssueAction(issue, "edit")}
makeIssueCopy={() => handleIssueAction(issue, "copy")}
handleDeleteIssue={() => handleIssueAction(issue, "delete")}
- handleDraftIssueSelect={() => handleIssueAction(issue, "updateDraft")}
+ handleDraftIssueSelect={
+ handleDraftIssueAction
+ ? () => handleDraftIssueAction(issue, "edit")
+ : undefined
+ }
+ handleDraftIssueDelete={
+ handleDraftIssueAction
+ ? () => handleDraftIssueAction(issue, "delete")
+ : undefined
+ }
handleMyIssueOpen={handleMyIssueOpen}
removeIssue={() => {
if (removeIssue !== null && issue.bridge_id)
diff --git a/web/components/issues/delete-draft-issue-modal.tsx b/web/components/issues/delete-draft-issue-modal.tsx
new file mode 100644
index 000000000..ddbe2a269
--- /dev/null
+++ b/web/components/issues/delete-draft-issue-modal.tsx
@@ -0,0 +1,145 @@
+import React, { useEffect, useState } from "react";
+
+import { useRouter } from "next/router";
+
+import { mutate } from "swr";
+
+// headless ui
+import { Dialog, Transition } from "@headlessui/react";
+// services
+import issueServices from "services/issues.service";
+// hooks
+import useIssuesView from "hooks/use-issues-view";
+import useToast from "hooks/use-toast";
+// icons
+import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
+// ui
+import { SecondaryButton, DangerButton } from "components/ui";
+// types
+import type { IIssue, ICurrentUserResponse } from "types";
+// fetch-keys
+import { PROJECT_DRAFT_ISSUES_LIST_WITH_PARAMS } from "constants/fetch-keys";
+
+type Props = {
+ isOpen: boolean;
+ handleClose: () => void;
+ data: IIssue | null;
+ user?: ICurrentUserResponse;
+ onSubmit?: () => Promise | void;
+};
+
+export const DeleteDraftIssueModal: React.FC = (props) => {
+ const { isOpen, handleClose, data, user, onSubmit } = props;
+
+ const [isDeleteLoading, setIsDeleteLoading] = useState(false);
+
+ const router = useRouter();
+ const { workspaceSlug, projectId } = router.query;
+
+ const { params } = useIssuesView();
+
+ const { setToastAlert } = useToast();
+
+ useEffect(() => {
+ setIsDeleteLoading(false);
+ }, [isOpen]);
+
+ const onClose = () => {
+ setIsDeleteLoading(false);
+ handleClose();
+ };
+
+ const handleDeletion = async () => {
+ if (!workspaceSlug || !data) return;
+
+ setIsDeleteLoading(true);
+
+ await issueServices
+ .deleteDraftIssue(workspaceSlug as string, data.project, data.id)
+ .then(() => {
+ setIsDeleteLoading(false);
+ handleClose();
+ mutate(PROJECT_DRAFT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
+ setToastAlert({
+ title: "Success",
+ message: "Draft Issue deleted successfully",
+ type: "success",
+ });
+ })
+ .catch((error) => {
+ console.log(error);
+ handleClose();
+ setToastAlert({
+ title: "Error",
+ message: "Something went wrong",
+ type: "error",
+ });
+ setIsDeleteLoading(false);
+ });
+ if (onSubmit) await onSubmit();
+ };
+
+ return (
+
+
+
+ );
+};
diff --git a/web/components/issues/form.tsx b/web/components/issues/form.tsx
index 043210123..e6b4f9e08 100644
--- a/web/components/issues/form.tsx
+++ b/web/components/issues/form.tsx
@@ -133,9 +133,15 @@ export const IssueForm: FC = (props) => {
const issueName = watch("name");
- const payload = {
+ const payload: Partial = {
name: getValues("name"),
description: getValues("description"),
+ state: getValues("state"),
+ priority: getValues("priority"),
+ assignees: getValues("assignees"),
+ target_date: getValues("target_date"),
+ labels: getValues("labels"),
+ project: getValues("project"),
};
useEffect(() => {
diff --git a/web/components/issues/index.ts b/web/components/issues/index.ts
index 65928a640..1c51031f3 100644
--- a/web/components/issues/index.ts
+++ b/web/components/issues/index.ts
@@ -17,5 +17,8 @@ export * from "./label";
export * from "./issue-reaction";
export * from "./peek-overview";
export * from "./confirm-issue-discard";
+
+// draft issue
export * from "./draft-issue-form";
export * from "./draft-issue-modal";
+export * from "./delete-draft-issue-modal";
diff --git a/web/components/workspace/sidebar-quick-action.tsx b/web/components/workspace/sidebar-quick-action.tsx
index 534bab729..c44bf6d8a 100644
--- a/web/components/workspace/sidebar-quick-action.tsx
+++ b/web/components/workspace/sidebar-quick-action.tsx
@@ -38,6 +38,9 @@ export const WorkspaceSidebarQuickAction = () => {
"priority",
"dueDate",
"priority",
+ "state",
+ "startDate",
+ "project",
]}
/>
@@ -47,7 +50,7 @@ export const WorkspaceSidebarQuickAction = () => {
}`}
>
{
@@ -108,7 +111,7 @@ export const WorkspaceSidebarQuickAction = () => {
>
Last Drafted Issue
diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/draft-issues/index.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/draft-issues/index.tsx
index 0645ff264..aaf854e11 100644
--- a/web/pages/[workspaceSlug]/projects/[projectId]/draft-issues/index.tsx
+++ b/web/pages/[workspaceSlug]/projects/[projectId]/draft-issues/index.tsx
@@ -55,7 +55,7 @@ const ProjectDraftIssues: NextPage = () => {