forked from github/plane
feat: add existing issue option added in spreadsheet view (#1397)
This commit is contained in:
parent
ae051b28af
commit
ad3411284b
@ -572,8 +572,11 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
) : issueView === "spreadsheet" ? (
|
) : issueView === "spreadsheet" ? (
|
||||||
<SpreadsheetView
|
<SpreadsheetView
|
||||||
|
type={type}
|
||||||
handleEditIssue={handleEditIssue}
|
handleEditIssue={handleEditIssue}
|
||||||
handleDeleteIssue={handleDeleteIssue}
|
handleDeleteIssue={handleDeleteIssue}
|
||||||
|
openIssuesListModal={type !== "issue" ? openIssuesListModal : null}
|
||||||
|
isCompleted={isCompleted}
|
||||||
user={user}
|
user={user}
|
||||||
userAuth={memberRole}
|
userAuth={memberRole}
|
||||||
/>
|
/>
|
||||||
|
@ -5,7 +5,7 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
// components
|
// components
|
||||||
import { SpreadsheetColumns, SpreadsheetIssues } from "components/core";
|
import { SpreadsheetColumns, SpreadsheetIssues } from "components/core";
|
||||||
import { Icon, Spinner } from "components/ui";
|
import { CustomMenu, Icon, Spinner } from "components/ui";
|
||||||
// hooks
|
// hooks
|
||||||
import useIssuesProperties from "hooks/use-issue-properties";
|
import useIssuesProperties from "hooks/use-issue-properties";
|
||||||
import useSpreadsheetIssuesView from "hooks/use-spreadsheet-issues-view";
|
import useSpreadsheetIssuesView from "hooks/use-spreadsheet-issues-view";
|
||||||
@ -17,15 +17,21 @@ import { SPREADSHEET_COLUMN } from "constants/spreadsheet";
|
|||||||
import { PlusIcon } from "@heroicons/react/24/outline";
|
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
type: "issue" | "cycle" | "module";
|
||||||
handleEditIssue: (issue: IIssue) => void;
|
handleEditIssue: (issue: IIssue) => void;
|
||||||
handleDeleteIssue: (issue: IIssue) => void;
|
handleDeleteIssue: (issue: IIssue) => void;
|
||||||
|
openIssuesListModal?: (() => void) | null;
|
||||||
|
isCompleted?: boolean;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
userAuth: UserAuth;
|
userAuth: UserAuth;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SpreadsheetView: React.FC<Props> = ({
|
export const SpreadsheetView: React.FC<Props> = ({
|
||||||
|
type,
|
||||||
handleEditIssue,
|
handleEditIssue,
|
||||||
handleDeleteIssue,
|
handleDeleteIssue,
|
||||||
|
openIssuesListModal,
|
||||||
|
isCompleted = false,
|
||||||
user,
|
user,
|
||||||
userAuth,
|
userAuth,
|
||||||
}) => {
|
}) => {
|
||||||
@ -79,16 +85,50 @@ export const SpreadsheetView: React.FC<Props> = ({
|
|||||||
className="relative group grid auto-rows-[minmax(44px,1fr)] hover:rounded-sm hover:bg-brand-surface-2 border-b border-brand-base w-full min-w-max"
|
className="relative group grid auto-rows-[minmax(44px,1fr)] hover:rounded-sm hover:bg-brand-surface-2 border-b border-brand-base w-full min-w-max"
|
||||||
style={{ gridTemplateColumns }}
|
style={{ gridTemplateColumns }}
|
||||||
>
|
>
|
||||||
<button
|
{type === "issue" ? (
|
||||||
className="flex gap-1.5 items-center pl-7 py-2.5 text-sm sticky left-0 z-[1] text-brand-secondary bg-brand-base group-hover:text-brand-base group-hover:bg-brand-surface-2 border-brand-base w-full"
|
<button
|
||||||
onClick={() => {
|
className="flex gap-1.5 items-center pl-7 py-2.5 text-sm sticky left-0 z-[1] text-brand-secondary bg-brand-base group-hover:text-brand-base group-hover:bg-brand-surface-2 border-brand-base w-full"
|
||||||
const e = new KeyboardEvent("keydown", { key: "c" });
|
onClick={() => {
|
||||||
document.dispatchEvent(e);
|
const e = new KeyboardEvent("keydown", { key: "c" });
|
||||||
}}
|
document.dispatchEvent(e);
|
||||||
>
|
}}
|
||||||
<PlusIcon className="h-4 w-4" />
|
>
|
||||||
Add Issue
|
<PlusIcon className="h-4 w-4" />
|
||||||
</button>
|
Add Issue
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
!isCompleted && (
|
||||||
|
<CustomMenu
|
||||||
|
className="sticky left-0 z-[1]"
|
||||||
|
customButton={
|
||||||
|
<button
|
||||||
|
className="flex gap-1.5 items-center pl-7 py-2.5 text-sm sticky left-0 z-[1] text-brand-secondary bg-brand-base group-hover:text-brand-base group-hover:bg-brand-surface-2 border-brand-base w-full"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<PlusIcon className="h-4 w-4" />
|
||||||
|
Add Issue
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
position="left"
|
||||||
|
menuItemsClassName="left-5 !w-36"
|
||||||
|
noBorder
|
||||||
|
>
|
||||||
|
<CustomMenu.MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
const e = new KeyboardEvent("keydown", { key: "c" });
|
||||||
|
document.dispatchEvent(e);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Create new
|
||||||
|
</CustomMenu.MenuItem>
|
||||||
|
{openIssuesListModal && (
|
||||||
|
<CustomMenu.MenuItem onClick={openIssuesListModal}>
|
||||||
|
Add an existing issue
|
||||||
|
</CustomMenu.MenuItem>
|
||||||
|
)}
|
||||||
|
</CustomMenu>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -19,6 +19,7 @@ type Props = {
|
|||||||
noChevron?: boolean;
|
noChevron?: boolean;
|
||||||
position?: "left" | "right";
|
position?: "left" | "right";
|
||||||
verticalPosition?: "top" | "bottom";
|
verticalPosition?: "top" | "bottom";
|
||||||
|
menuItemsClassName?: string;
|
||||||
customButton?: JSX.Element;
|
customButton?: JSX.Element;
|
||||||
menuItemsWhiteBg?: boolean;
|
menuItemsWhiteBg?: boolean;
|
||||||
};
|
};
|
||||||
@ -44,6 +45,7 @@ const CustomMenu = ({
|
|||||||
noChevron = false,
|
noChevron = false,
|
||||||
position = "right",
|
position = "right",
|
||||||
verticalPosition = "bottom",
|
verticalPosition = "bottom",
|
||||||
|
menuItemsClassName = "",
|
||||||
customButton,
|
customButton,
|
||||||
menuItemsWhiteBg = false,
|
menuItemsWhiteBg = false,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
@ -133,7 +135,7 @@ const CustomMenu = ({
|
|||||||
menuItemsWhiteBg
|
menuItemsWhiteBg
|
||||||
? "border-brand-surface-1 bg-brand-base"
|
? "border-brand-surface-1 bg-brand-base"
|
||||||
: "border-brand-base bg-brand-surface-1"
|
: "border-brand-base bg-brand-surface-1"
|
||||||
}`}
|
} ${menuItemsClassName}`}
|
||||||
>
|
>
|
||||||
<div className="py-1">{children}</div>
|
<div className="py-1">{children}</div>
|
||||||
</Menu.Items>
|
</Menu.Items>
|
||||||
|
Loading…
Reference in New Issue
Block a user