forked from github/plane
fix: create new issue when grouped by label (#1308)
This commit is contained in:
parent
e7bb580289
commit
f839150741
@ -2,11 +2,12 @@
|
|||||||
import useProjectIssuesView from "hooks/use-issues-view";
|
import useProjectIssuesView from "hooks/use-issues-view";
|
||||||
// components
|
// components
|
||||||
import { SingleBoard } from "components/core/board-view/single-board";
|
import { SingleBoard } from "components/core/board-view/single-board";
|
||||||
|
// icons
|
||||||
|
import { getStateGroupIcon } from "components/icons";
|
||||||
// helpers
|
// helpers
|
||||||
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
||||||
// types
|
// types
|
||||||
import { ICurrentUserResponse, IIssue, IState, UserAuth } from "types";
|
import { ICurrentUserResponse, IIssue, IState, UserAuth } from "types";
|
||||||
import { getStateGroupIcon } from "components/icons";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
type: "issue" | "cycle" | "module";
|
type: "issue" | "cycle" | "module";
|
||||||
|
@ -166,7 +166,7 @@ export const BoardHeader: React.FC<Props> = ({
|
|||||||
<ArrowsPointingOutIcon className="h-4 w-4" />
|
<ArrowsPointingOutIcon className="h-4 w-4" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
{!isCompleted && (
|
{!isCompleted && selectedGroup !== "created_by" && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="grid h-7 w-7 place-items-center rounded p-1 text-brand-secondary outline-none duration-300 hover:bg-brand-surface-2"
|
className="grid h-7 w-7 place-items-center rounded p-1 text-brand-secondary outline-none duration-300 hover:bg-brand-surface-2"
|
||||||
|
@ -145,43 +145,45 @@ export const SingleBoard: React.FC<Props> = ({
|
|||||||
{provided.placeholder}
|
{provided.placeholder}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{selectedGroup !== "created_by" && (
|
||||||
{type === "issue" ? (
|
<div>
|
||||||
<button
|
{type === "issue" ? (
|
||||||
type="button"
|
<button
|
||||||
className="flex items-center gap-2 font-medium text-brand-accent outline-none p-1"
|
type="button"
|
||||||
onClick={addIssueToState}
|
className="flex items-center gap-2 font-medium text-brand-accent outline-none p-1"
|
||||||
>
|
onClick={addIssueToState}
|
||||||
<PlusIcon className="h-4 w-4" />
|
|
||||||
Add Issue
|
|
||||||
</button>
|
|
||||||
) : (
|
|
||||||
!isCompleted && (
|
|
||||||
<CustomMenu
|
|
||||||
customButton={
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="flex items-center gap-2 font-medium text-brand-accent outline-none"
|
|
||||||
>
|
|
||||||
<PlusIcon className="h-4 w-4" />
|
|
||||||
Add Issue
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
position="left"
|
|
||||||
noBorder
|
|
||||||
>
|
>
|
||||||
<CustomMenu.MenuItem onClick={addIssueToState}>
|
<PlusIcon className="h-4 w-4" />
|
||||||
Create new
|
Add Issue
|
||||||
</CustomMenu.MenuItem>
|
</button>
|
||||||
{openIssuesListModal && (
|
) : (
|
||||||
<CustomMenu.MenuItem onClick={openIssuesListModal}>
|
!isCompleted && (
|
||||||
Add an existing issue
|
<CustomMenu
|
||||||
|
customButton={
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="flex items-center gap-2 font-medium text-brand-accent outline-none"
|
||||||
|
>
|
||||||
|
<PlusIcon className="h-4 w-4" />
|
||||||
|
Add Issue
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
position="left"
|
||||||
|
noBorder
|
||||||
|
>
|
||||||
|
<CustomMenu.MenuItem onClick={addIssueToState}>
|
||||||
|
Create new
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
)}
|
{openIssuesListModal && (
|
||||||
</CustomMenu>
|
<CustomMenu.MenuItem onClick={openIssuesListModal}>
|
||||||
)
|
Add an existing issue
|
||||||
)}
|
</CustomMenu.MenuItem>
|
||||||
</div>
|
)}
|
||||||
|
</CustomMenu>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</StrictModeDroppable>
|
</StrictModeDroppable>
|
||||||
|
@ -72,9 +72,9 @@ export const ExistingIssuesListModal: React.FC<Props> = ({
|
|||||||
const onSubmit: SubmitHandler<FormInput> = async (data) => {
|
const onSubmit: SubmitHandler<FormInput> = async (data) => {
|
||||||
if (!data.issues || data.issues.length === 0) {
|
if (!data.issues || data.issues.length === 0) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Error",
|
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "Please select atleast one issue",
|
title: "Error!",
|
||||||
|
message: "Please select at least one issue.",
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -283,9 +283,17 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
const addIssueToState = useCallback(
|
const addIssueToState = useCallback(
|
||||||
(groupTitle: string) => {
|
(groupTitle: string) => {
|
||||||
setCreateIssueModal(true);
|
setCreateIssueModal(true);
|
||||||
|
|
||||||
|
let preloadedValue: string | string[] = groupTitle;
|
||||||
|
|
||||||
|
if (selectedGroup === "labels") {
|
||||||
|
if (groupTitle === "None") preloadedValue = [];
|
||||||
|
else preloadedValue = [groupTitle];
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedGroup)
|
if (selectedGroup)
|
||||||
setPreloadedData({
|
setPreloadedData({
|
||||||
[selectedGroup]: groupTitle,
|
[selectedGroup]: preloadedValue,
|
||||||
actionType: "createIssue",
|
actionType: "createIssue",
|
||||||
});
|
});
|
||||||
else setPreloadedData({ actionType: "createIssue" });
|
else setPreloadedData({ actionType: "createIssue" });
|
||||||
|
@ -6,6 +6,10 @@ import useSWR from "swr";
|
|||||||
|
|
||||||
// headless ui
|
// headless ui
|
||||||
import { Combobox, Transition } from "@headlessui/react";
|
import { Combobox, Transition } from "@headlessui/react";
|
||||||
|
// services
|
||||||
|
import issuesServices from "services/issues.service";
|
||||||
|
// ui
|
||||||
|
import { IssueLabelsList } from "components/ui";
|
||||||
// icons
|
// icons
|
||||||
import {
|
import {
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
@ -14,13 +18,10 @@ import {
|
|||||||
RectangleGroupIcon,
|
RectangleGroupIcon,
|
||||||
TagIcon,
|
TagIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
// services
|
|
||||||
import issuesServices from "services/issues.service";
|
|
||||||
// types
|
// types
|
||||||
import type { IIssueLabels } from "types";
|
import type { IIssueLabels } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys";
|
import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys";
|
||||||
import { IssueLabelsList } from "components/ui";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
|
Loading…
Reference in New Issue
Block a user