chore: set all issue properties as true by default (#1640)

This commit is contained in:
Aaryan Khandelwal 2023-07-24 12:56:27 +05:30 committed by GitHub
parent e83ef7332d
commit f3b09a13b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 14 deletions

View File

@ -14,7 +14,7 @@ import { DangerButton, SecondaryButton } from "components/ui";
// icons // icons
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
// types // types
import type { ICurrentUserResponse, ICycle } from "types"; import type { ICurrentUserResponse, ICycle, IProject } from "types";
type TConfirmCycleDeletionProps = { type TConfirmCycleDeletionProps = {
isOpen: boolean; isOpen: boolean;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>; setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
@ -27,6 +27,7 @@ import {
CURRENT_CYCLE_LIST, CURRENT_CYCLE_LIST,
CYCLES_LIST, CYCLES_LIST,
DRAFT_CYCLES_LIST, DRAFT_CYCLES_LIST,
PROJECT_DETAILS,
UPCOMING_CYCLES_LIST, UPCOMING_CYCLES_LIST,
} from "constants/fetch-keys"; } from "constants/fetch-keys";
import { getDateRangeStatus } from "helpers/date-time.helper"; import { getDateRangeStatus } from "helpers/date-time.helper";
@ -50,7 +51,7 @@ export const DeleteCycleModal: React.FC<TConfirmCycleDeletionProps> = ({
}; };
const handleDeletion = async () => { const handleDeletion = async () => {
if (!data || !workspaceSlug) return; if (!data || !workspaceSlug || !projectId) return;
setIsDeleteLoading(true); setIsDeleteLoading(true);
@ -85,6 +86,21 @@ export const DeleteCycleModal: React.FC<TConfirmCycleDeletionProps> = ({
}, },
false false
); );
// update total cycles count in the project details
mutate<IProject>(
PROJECT_DETAILS(projectId.toString()),
(prevData) => {
if (!prevData) return prevData;
return {
...prevData,
total_cycles: prevData.total_cycles - 1,
};
},
false
);
handleClose(); handleClose();
setToastAlert({ setToastAlert({

View File

@ -15,7 +15,7 @@ import { CycleForm } from "components/cycles";
// helper // helper
import { getDateRangeStatus } from "helpers/date-time.helper"; import { getDateRangeStatus } from "helpers/date-time.helper";
// types // types
import type { CycleDateCheckData, ICurrentUserResponse, ICycle } from "types"; import type { CycleDateCheckData, ICurrentUserResponse, ICycle, IProject } from "types";
// fetch keys // fetch keys
import { import {
COMPLETED_CYCLES_LIST, COMPLETED_CYCLES_LIST,
@ -23,6 +23,7 @@ import {
CYCLES_LIST, CYCLES_LIST,
DRAFT_CYCLES_LIST, DRAFT_CYCLES_LIST,
INCOMPLETE_CYCLES_LIST, INCOMPLETE_CYCLES_LIST,
PROJECT_DETAILS,
UPCOMING_CYCLES_LIST, UPCOMING_CYCLES_LIST,
} from "constants/fetch-keys"; } from "constants/fetch-keys";
@ -66,6 +67,20 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
mutate(INCOMPLETE_CYCLES_LIST(projectId.toString())); mutate(INCOMPLETE_CYCLES_LIST(projectId.toString()));
mutate(CYCLES_LIST(projectId.toString())); mutate(CYCLES_LIST(projectId.toString()));
// update total cycles count in the project details
mutate<IProject>(
PROJECT_DETAILS(projectId.toString()),
(prevData) => {
if (!prevData) return prevData;
return {
...prevData,
total_cycles: prevData.total_cycles + 1,
};
},
false
);
setToastAlert({ setToastAlert({
type: "success", type: "success",
title: "Success!", title: "Success!",

View File

@ -1,5 +1,7 @@
import { useState, useEffect, useCallback } from "react"; import { useState, useEffect, useCallback } from "react";
import useSWR from "swr"; import useSWR from "swr";
// services // services
import issueServices from "services/issues.service"; import issueServices from "services/issues.service";
// hooks // hooks
@ -9,17 +11,17 @@ import { IssuePriorities, Properties } from "types";
const initialValues: Properties = { const initialValues: Properties = {
assignee: true, assignee: true,
due_date: false, due_date: true,
key: true, key: true,
labels: false, labels: true,
priority: false, priority: true,
state: true, state: true,
sub_issue_count: false, sub_issue_count: true,
attachment_count: false, attachment_count: true,
link: false, link: true,
estimate: false, estimate: true,
created_on: false, created_on: true,
updated_on: false, updated_on: true,
}; };
const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => {

View File

@ -176,8 +176,8 @@ const ProjectCycles: NextPage = () => {
</Tab.List> </Tab.List>
<div className="justify-end sm:justify-start flex items-center gap-x-1"> <div className="justify-end sm:justify-start flex items-center gap-x-1">
{cycleViews.map((view) => { {cycleViews.map((view) => {
if (view.key === "gantt" && (cycleTab === "Active" || cycleTab === "Drafts")) if (cycleTab === "Active") return null;
return null; if (view.key === "gantt" && cycleTab === "Drafts") return null;
return ( return (
<button <button