fix: create new issue when grouped by label (#1308)

This commit is contained in:
Aaryan Khandelwal 2023-06-23 11:08:53 +05:30 committed by GitHub
parent e7bb580289
commit f839150741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 43 deletions

View File

@ -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";

View File

@ -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"

View File

@ -145,6 +145,7 @@ export const SingleBoard: React.FC<Props> = ({
{provided.placeholder} {provided.placeholder}
</span> </span>
</div> </div>
{selectedGroup !== "created_by" && (
<div> <div>
{type === "issue" ? ( {type === "issue" ? (
<button <button
@ -182,6 +183,7 @@ export const SingleBoard: React.FC<Props> = ({
) )
)} )}
</div> </div>
)}
</div> </div>
)} )}
</StrictModeDroppable> </StrictModeDroppable>

View File

@ -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;

View File

@ -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" });

View File

@ -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>>;