mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: update cycle fetch keys names
This commit is contained in:
parent
053ebc031d
commit
1c98f2dca9
@ -42,7 +42,7 @@ import { truncateText } from "helpers/string.helper";
|
|||||||
// types
|
// types
|
||||||
import { ICycle, IIssue } from "types";
|
import { ICycle, IIssue } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_CURRENT_LIST, CYCLE_ISSUES, CYCLE_LIST } from "constants/fetch-keys";
|
import { CURRENT_CYCLE_LIST, CYCLES_LIST, CYCLE_ISSUES } from "constants/fetch-keys";
|
||||||
|
|
||||||
type TSingleStatProps = {
|
type TSingleStatProps = {
|
||||||
cycle: ICycle;
|
cycle: ICycle;
|
||||||
@ -100,7 +100,7 @@ export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isComple
|
|||||||
if (!workspaceSlug || !projectId || !cycle) return;
|
if (!workspaceSlug || !projectId || !cycle) return;
|
||||||
|
|
||||||
mutate<ICycle[]>(
|
mutate<ICycle[]>(
|
||||||
CYCLE_CURRENT_LIST(projectId as string),
|
CURRENT_CYCLE_LIST(projectId as string),
|
||||||
(prevData) =>
|
(prevData) =>
|
||||||
(prevData ?? []).map((c) => ({
|
(prevData ?? []).map((c) => ({
|
||||||
...c,
|
...c,
|
||||||
@ -110,7 +110,7 @@ export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isComple
|
|||||||
);
|
);
|
||||||
|
|
||||||
mutate(
|
mutate(
|
||||||
CYCLE_LIST(projectId as string),
|
CYCLES_LIST(projectId as string),
|
||||||
(prevData: any) =>
|
(prevData: any) =>
|
||||||
(prevData ?? []).map((c: any) => ({
|
(prevData ?? []).map((c: any) => ({
|
||||||
...c,
|
...c,
|
||||||
@ -136,7 +136,7 @@ export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isComple
|
|||||||
if (!workspaceSlug || !projectId || !cycle) return;
|
if (!workspaceSlug || !projectId || !cycle) return;
|
||||||
|
|
||||||
mutate<ICycle[]>(
|
mutate<ICycle[]>(
|
||||||
CYCLE_CURRENT_LIST(projectId as string),
|
CURRENT_CYCLE_LIST(projectId as string),
|
||||||
(prevData) =>
|
(prevData) =>
|
||||||
(prevData ?? []).map((c) => ({
|
(prevData ?? []).map((c) => ({
|
||||||
...c,
|
...c,
|
||||||
@ -146,7 +146,7 @@ export const ActiveCycleDetails: React.FC<TSingleStatProps> = ({ cycle, isComple
|
|||||||
);
|
);
|
||||||
|
|
||||||
mutate(
|
mutate(
|
||||||
CYCLE_LIST(projectId as string),
|
CYCLES_LIST(projectId as string),
|
||||||
(prevData: any) =>
|
(prevData: any) =>
|
||||||
(prevData ?? []).map((c: any) => ({
|
(prevData ?? []).map((c: any) => ({
|
||||||
...c,
|
...c,
|
||||||
|
@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service";
|
|||||||
// components
|
// components
|
||||||
import { CyclesView } from "components/cycles";
|
import { CyclesView } from "components/cycles";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_LIST } from "constants/fetch-keys";
|
import { CYCLES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
viewType: string | null;
|
viewType: string | null;
|
||||||
@ -18,7 +18,7 @@ export const AllCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
const { data: allCyclesList } = useSWR(
|
const { data: allCyclesList } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||||
|
@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service";
|
|||||||
// components
|
// components
|
||||||
import { CyclesView } from "components/cycles";
|
import { CyclesView } from "components/cycles";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_COMPLETE_LIST } from "constants/fetch-keys";
|
import { COMPLETED_CYCLES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
viewType: string | null;
|
viewType: string | null;
|
||||||
@ -18,7 +18,7 @@ export const CompletedCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
const { data: completedCyclesList } = useSWR(
|
const { data: completedCyclesList } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_COMPLETE_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? COMPLETED_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||||
|
@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service";
|
|||||||
// components
|
// components
|
||||||
import { CyclesView } from "components/cycles";
|
import { CyclesView } from "components/cycles";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_DRAFT_LIST } from "constants/fetch-keys";
|
import { DRAFT_CYCLES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
viewType: string | null;
|
viewType: string | null;
|
||||||
@ -18,7 +18,7 @@ export const DraftCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
const { data: draftCyclesList } = useSWR(
|
const { data: draftCyclesList } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_DRAFT_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||||
|
@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service";
|
|||||||
// components
|
// components
|
||||||
import { CyclesView } from "components/cycles";
|
import { CyclesView } from "components/cycles";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_UPCOMING_LIST } from "constants/fetch-keys";
|
import { UPCOMING_CYCLES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
viewType: string | null;
|
viewType: string | null;
|
||||||
@ -18,7 +18,7 @@ export const UpcomingCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
const { data: upcomingCyclesList } = useSWR(
|
const { data: upcomingCyclesList } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_UPCOMING_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? UPCOMING_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||||
|
@ -26,11 +26,11 @@ import { getDateRangeStatus } from "helpers/date-time.helper";
|
|||||||
import { ICycle } from "types";
|
import { ICycle } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import {
|
import {
|
||||||
CYCLE_COMPLETE_LIST,
|
COMPLETED_CYCLES_LIST,
|
||||||
CYCLE_CURRENT_LIST,
|
CURRENT_CYCLE_LIST,
|
||||||
CYCLE_DRAFT_LIST,
|
CYCLES_LIST,
|
||||||
CYCLE_LIST,
|
DRAFT_CYCLES_LIST,
|
||||||
CYCLE_UPCOMING_LIST,
|
UPCOMING_CYCLES_LIST,
|
||||||
} from "constants/fetch-keys";
|
} from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -67,12 +67,12 @@ export const CyclesView: React.FC<Props> = ({ cycles, viewType }) => {
|
|||||||
|
|
||||||
const fetchKey =
|
const fetchKey =
|
||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? CYCLE_CURRENT_LIST(projectId as string)
|
? CURRENT_CYCLE_LIST(projectId as string)
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? CYCLE_UPCOMING_LIST(projectId as string)
|
? UPCOMING_CYCLES_LIST(projectId as string)
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? CYCLE_COMPLETE_LIST(projectId as string)
|
? COMPLETED_CYCLES_LIST(projectId as string)
|
||||||
: CYCLE_DRAFT_LIST(projectId as string);
|
: DRAFT_CYCLES_LIST(projectId as string);
|
||||||
|
|
||||||
mutate<ICycle[]>(
|
mutate<ICycle[]>(
|
||||||
fetchKey,
|
fetchKey,
|
||||||
@ -85,7 +85,7 @@ export const CyclesView: React.FC<Props> = ({ cycles, viewType }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
mutate(
|
mutate(
|
||||||
CYCLE_LIST(projectId as string),
|
CYCLES_LIST(projectId as string),
|
||||||
(prevData: any) =>
|
(prevData: any) =>
|
||||||
(prevData ?? []).map((c: any) => ({
|
(prevData ?? []).map((c: any) => ({
|
||||||
...c,
|
...c,
|
||||||
@ -114,12 +114,12 @@ export const CyclesView: React.FC<Props> = ({ cycles, viewType }) => {
|
|||||||
|
|
||||||
const fetchKey =
|
const fetchKey =
|
||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? CYCLE_CURRENT_LIST(projectId as string)
|
? CURRENT_CYCLE_LIST(projectId as string)
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? CYCLE_UPCOMING_LIST(projectId as string)
|
? UPCOMING_CYCLES_LIST(projectId as string)
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? CYCLE_COMPLETE_LIST(projectId as string)
|
? COMPLETED_CYCLES_LIST(projectId as string)
|
||||||
: CYCLE_DRAFT_LIST(projectId as string);
|
: DRAFT_CYCLES_LIST(projectId as string);
|
||||||
|
|
||||||
mutate<ICycle[]>(
|
mutate<ICycle[]>(
|
||||||
fetchKey,
|
fetchKey,
|
||||||
@ -132,7 +132,7 @@ export const CyclesView: React.FC<Props> = ({ cycles, viewType }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
mutate(
|
mutate(
|
||||||
CYCLE_LIST(projectId as string),
|
CYCLES_LIST(projectId as string),
|
||||||
(prevData: any) =>
|
(prevData: any) =>
|
||||||
(prevData ?? []).map((c: any) => ({
|
(prevData ?? []).map((c: any) => ({
|
||||||
...c,
|
...c,
|
||||||
|
@ -22,11 +22,11 @@ type TConfirmCycleDeletionProps = {
|
|||||||
};
|
};
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import {
|
import {
|
||||||
CYCLE_COMPLETE_LIST,
|
COMPLETED_CYCLES_LIST,
|
||||||
CYCLE_CURRENT_LIST,
|
CURRENT_CYCLE_LIST,
|
||||||
CYCLE_DRAFT_LIST,
|
CYCLES_LIST,
|
||||||
CYCLE_LIST,
|
DRAFT_CYCLES_LIST,
|
||||||
CYCLE_UPCOMING_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";
|
||||||
|
|
||||||
@ -58,12 +58,12 @@ export const DeleteCycleModal: React.FC<TConfirmCycleDeletionProps> = ({
|
|||||||
const cycleType = getDateRangeStatus(data.start_date, data.end_date);
|
const cycleType = getDateRangeStatus(data.start_date, data.end_date);
|
||||||
const fetchKey =
|
const fetchKey =
|
||||||
cycleType === "current"
|
cycleType === "current"
|
||||||
? CYCLE_CURRENT_LIST(projectId as string)
|
? CURRENT_CYCLE_LIST(projectId as string)
|
||||||
: cycleType === "upcoming"
|
: cycleType === "upcoming"
|
||||||
? CYCLE_UPCOMING_LIST(projectId as string)
|
? UPCOMING_CYCLES_LIST(projectId as string)
|
||||||
: cycleType === "completed"
|
: cycleType === "completed"
|
||||||
? CYCLE_COMPLETE_LIST(projectId as string)
|
? COMPLETED_CYCLES_LIST(projectId as string)
|
||||||
: CYCLE_DRAFT_LIST(projectId as string);
|
: DRAFT_CYCLES_LIST(projectId as string);
|
||||||
|
|
||||||
mutate<ICycle[]>(
|
mutate<ICycle[]>(
|
||||||
fetchKey,
|
fetchKey,
|
||||||
@ -76,7 +76,7 @@ export const DeleteCycleModal: React.FC<TConfirmCycleDeletionProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
mutate(
|
mutate(
|
||||||
CYCLE_LIST(projectId as string),
|
CYCLES_LIST(projectId as string),
|
||||||
(prevData: any) => {
|
(prevData: any) => {
|
||||||
if (!prevData) return;
|
if (!prevData) return;
|
||||||
return prevData.filter((cycle: any) => cycle.id !== data?.id);
|
return prevData.filter((cycle: any) => cycle.id !== data?.id);
|
||||||
|
@ -12,7 +12,7 @@ type Props = {
|
|||||||
handleFormSubmit: (values: Partial<ICycle>) => Promise<void>;
|
handleFormSubmit: (values: Partial<ICycle>) => Promise<void>;
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
status: boolean;
|
status: boolean;
|
||||||
data?: ICycle;
|
data?: ICycle | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultValues: Partial<ICycle> = {
|
const defaultValues: Partial<ICycle> = {
|
||||||
@ -28,7 +28,6 @@ export const CycleForm: React.FC<Props> = ({ handleFormSubmit, handleClose, stat
|
|||||||
formState: { errors, isSubmitting },
|
formState: { errors, isSubmitting },
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
control,
|
control,
|
||||||
watch,
|
|
||||||
reset,
|
reset,
|
||||||
} = useForm<ICycle>({
|
} = useForm<ICycle>({
|
||||||
defaultValues,
|
defaultValues,
|
||||||
|
@ -18,12 +18,12 @@ import { getDateRangeStatus, isDateGreaterThanToday } from "helpers/date-time.he
|
|||||||
import type { ICycle } from "types";
|
import type { ICycle } from "types";
|
||||||
// fetch keys
|
// fetch keys
|
||||||
import {
|
import {
|
||||||
CYCLE_COMPLETE_LIST,
|
COMPLETED_CYCLES_LIST,
|
||||||
CYCLE_CURRENT_LIST,
|
CURRENT_CYCLE_LIST,
|
||||||
CYCLE_DRAFT_LIST,
|
CYCLES_LIST,
|
||||||
CYCLE_INCOMPLETE_LIST,
|
DRAFT_CYCLES_LIST,
|
||||||
CYCLE_LIST,
|
INCOMPLETE_CYCLES_LIST,
|
||||||
CYCLE_UPCOMING_LIST,
|
UPCOMING_CYCLES_LIST,
|
||||||
} from "constants/fetch-keys";
|
} from "constants/fetch-keys";
|
||||||
|
|
||||||
type CycleModalProps = {
|
type CycleModalProps = {
|
||||||
@ -43,24 +43,26 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
|
|||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const createCycle = async (payload: Partial<ICycle>) => {
|
const createCycle = async (payload: Partial<ICycle>) => {
|
||||||
|
if (!workspaceSlug || !projectId) return;
|
||||||
|
|
||||||
await cycleService
|
await cycleService
|
||||||
.createCycle(workspaceSlug as string, projectId as string, payload)
|
.createCycle(workspaceSlug.toString(), projectId.toString(), payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
||||||
case "completed":
|
case "completed":
|
||||||
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
mutate(COMPLETED_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "current":
|
case "current":
|
||||||
mutate(CYCLE_CURRENT_LIST(projectId as string));
|
mutate(CURRENT_CYCLE_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "upcoming":
|
case "upcoming":
|
||||||
mutate(CYCLE_UPCOMING_LIST(projectId as string));
|
mutate(UPCOMING_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
mutate(DRAFT_CYCLES_LIST(projectId.toString()));
|
||||||
}
|
}
|
||||||
mutate(CYCLE_INCOMPLETE_LIST(projectId as string));
|
mutate(INCOMPLETE_CYCLES_LIST(projectId.toString()));
|
||||||
mutate(CYCLE_LIST(projectId as string));
|
mutate(CYCLES_LIST(projectId.toString()));
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
@ -69,7 +71,7 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
|
|||||||
message: "Cycle created successfully.",
|
message: "Cycle created successfully.",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(() => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
@ -79,39 +81,41 @@ export const CreateUpdateCycleModal: React.FC<CycleModalProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateCycle = async (cycleId: string, payload: Partial<ICycle>) => {
|
const updateCycle = async (cycleId: string, payload: Partial<ICycle>) => {
|
||||||
|
if (!workspaceSlug || !projectId) return;
|
||||||
|
|
||||||
await cycleService
|
await cycleService
|
||||||
.updateCycle(workspaceSlug as string, projectId as string, cycleId, payload)
|
.updateCycle(workspaceSlug.toString(), projectId.toString(), cycleId, payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
switch (getDateRangeStatus(data?.start_date, data?.end_date)) {
|
switch (getDateRangeStatus(data?.start_date, data?.end_date)) {
|
||||||
case "completed":
|
case "completed":
|
||||||
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
mutate(COMPLETED_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "current":
|
case "current":
|
||||||
mutate(CYCLE_CURRENT_LIST(projectId as string));
|
mutate(CURRENT_CYCLE_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "upcoming":
|
case "upcoming":
|
||||||
mutate(CYCLE_UPCOMING_LIST(projectId as string));
|
mutate(UPCOMING_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
mutate(DRAFT_CYCLES_LIST(projectId.toString()));
|
||||||
}
|
}
|
||||||
mutate(CYCLE_LIST(projectId as string));
|
mutate(CYCLES_LIST(projectId.toString()));
|
||||||
if (
|
if (
|
||||||
getDateRangeStatus(data?.start_date, data?.end_date) !=
|
getDateRangeStatus(data?.start_date, data?.end_date) !=
|
||||||
getDateRangeStatus(res.start_date, res.end_date)
|
getDateRangeStatus(res.start_date, res.end_date)
|
||||||
) {
|
) {
|
||||||
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
switch (getDateRangeStatus(res.start_date, res.end_date)) {
|
||||||
case "completed":
|
case "completed":
|
||||||
mutate(CYCLE_COMPLETE_LIST(projectId as string));
|
mutate(COMPLETED_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "current":
|
case "current":
|
||||||
mutate(CYCLE_CURRENT_LIST(projectId as string));
|
mutate(CURRENT_CYCLE_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
case "upcoming":
|
case "upcoming":
|
||||||
mutate(CYCLE_UPCOMING_LIST(projectId as string));
|
mutate(UPCOMING_CYCLES_LIST(projectId.toString()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mutate(CYCLE_DRAFT_LIST(projectId as string));
|
mutate(DRAFT_CYCLES_LIST(projectId.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import cycleServices from "services/cycles.service";
|
|||||||
// components
|
// components
|
||||||
import { CreateUpdateCycleModal } from "components/cycles";
|
import { CreateUpdateCycleModal } from "components/cycles";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_LIST } from "constants/fetch-keys";
|
import { CYCLES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
export type IssueCycleSelectProps = {
|
export type IssueCycleSelectProps = {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
@ -36,7 +36,7 @@ export const CycleSelect: React.FC<IssueCycleSelectProps> = ({
|
|||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const { data: cycles } = useSWR(
|
const { data: cycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_LIST(projectId) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||||
|
@ -10,16 +10,16 @@ import { Dialog, Transition } from "@headlessui/react";
|
|||||||
import cyclesService from "services/cycles.service";
|
import cyclesService from "services/cycles.service";
|
||||||
// hooks
|
// hooks
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
|
import useIssuesView from "hooks/use-issues-view";
|
||||||
//icons
|
//icons
|
||||||
import { MagnifyingGlassIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
import { MagnifyingGlassIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
||||||
import { ContrastIcon, CyclesIcon, ExclamationIcon, TransferIcon } from "components/icons";
|
import { ContrastIcon, ExclamationIcon, TransferIcon } from "components/icons";
|
||||||
// fetch-key
|
// fetch-key
|
||||||
import { CYCLE_INCOMPLETE_LIST, CYCLE_ISSUES_WITH_PARAMS } from "constants/fetch-keys";
|
import { CYCLE_ISSUES_WITH_PARAMS, INCOMPLETE_CYCLES_LIST } from "constants/fetch-keys";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle } from "types";
|
||||||
//helper
|
//helper
|
||||||
import { getDateRangeStatus } from "helpers/date-time.helper";
|
import { getDateRangeStatus } from "helpers/date-time.helper";
|
||||||
import useIssuesView from "hooks/use-issues-view";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -57,7 +57,7 @@ export const TransferIssuesModal: React.FC<Props> = ({ isOpen, handleClose }) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const { data: incompleteCycles } = useSWR(
|
const { data: incompleteCycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_INCOMPLETE_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||||
|
@ -16,7 +16,7 @@ import { ContrastIcon } from "components/icons";
|
|||||||
// types
|
// types
|
||||||
import { ICycle, IIssue, UserAuth } from "types";
|
import { ICycle, IIssue, UserAuth } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { CYCLE_ISSUES, CYCLE_INCOMPLETE_LIST, ISSUE_DETAILS } from "constants/fetch-keys";
|
import { CYCLE_ISSUES, INCOMPLETE_CYCLES_LIST, ISSUE_DETAILS } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issueDetail: IIssue | undefined;
|
issueDetail: IIssue | undefined;
|
||||||
@ -33,7 +33,7 @@ export const SidebarCycleSelect: React.FC<Props> = ({
|
|||||||
const { workspaceSlug, projectId, issueId } = router.query;
|
const { workspaceSlug, projectId, issueId } = router.query;
|
||||||
|
|
||||||
const { data: incompleteCycles } = useSWR(
|
const { data: incompleteCycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_INCOMPLETE_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||||
|
@ -71,9 +71,18 @@ export const PROJECT_ISSUE_LABELS = (projectId: string) =>
|
|||||||
export const PROJECT_GITHUB_REPOSITORY = (projectId: string) =>
|
export const PROJECT_GITHUB_REPOSITORY = (projectId: string) =>
|
||||||
`PROJECT_GITHUB_REPOSITORY_${projectId.toUpperCase()}`;
|
`PROJECT_GITHUB_REPOSITORY_${projectId.toUpperCase()}`;
|
||||||
|
|
||||||
export const CYCLE_LIST = (projectId: string) => `CYCLE_LIST_${projectId.toUpperCase()}`;
|
// cycles
|
||||||
export const CYCLE_INCOMPLETE_LIST = (projectId: string) =>
|
export const CYCLES_LIST = (projectId: string) => `CYCLE_LIST_${projectId.toUpperCase()}`;
|
||||||
`CYCLE_INCOMPLETE_LIST_${projectId.toUpperCase()}`;
|
export const INCOMPLETE_CYCLES_LIST = (projectId: string) =>
|
||||||
|
`INCOMPLETE_CYCLES_LIST_${projectId.toUpperCase()}`;
|
||||||
|
export const CURRENT_CYCLE_LIST = (projectId: string) =>
|
||||||
|
`CURRENT_CYCLE_LIST_${projectId.toUpperCase()}`;
|
||||||
|
export const UPCOMING_CYCLES_LIST = (projectId: string) =>
|
||||||
|
`UPCOMING_CYCLES_LIST_${projectId.toUpperCase()}`;
|
||||||
|
export const DRAFT_CYCLES_LIST = (projectId: string) =>
|
||||||
|
`DRAFT_CYCLES_LIST_${projectId.toUpperCase()}`;
|
||||||
|
export const COMPLETED_CYCLES_LIST = (projectId: string) =>
|
||||||
|
`COMPLETED_CYCLES_LIST_${projectId.toUpperCase()}`;
|
||||||
export const CYCLE_ISSUES = (cycleId: string) => `CYCLE_ISSUES_${cycleId.toUpperCase()}`;
|
export const CYCLE_ISSUES = (cycleId: string) => `CYCLE_ISSUES_${cycleId.toUpperCase()}`;
|
||||||
export const CYCLE_ISSUES_WITH_PARAMS = (cycleId: string, params?: any) => {
|
export const CYCLE_ISSUES_WITH_PARAMS = (cycleId: string, params?: any) => {
|
||||||
if (!params) return `CYCLE_ISSUES_WITH_PARAMS_${cycleId.toUpperCase()}`;
|
if (!params) return `CYCLE_ISSUES_WITH_PARAMS_${cycleId.toUpperCase()}`;
|
||||||
@ -84,15 +93,6 @@ export const CYCLE_ISSUES_WITH_PARAMS = (cycleId: string, params?: any) => {
|
|||||||
};
|
};
|
||||||
export const CYCLE_DETAILS = (cycleId: string) => `CYCLE_DETAILS_${cycleId.toUpperCase()}`;
|
export const CYCLE_DETAILS = (cycleId: string) => `CYCLE_DETAILS_${cycleId.toUpperCase()}`;
|
||||||
|
|
||||||
export const CYCLE_CURRENT_LIST = (projectId: string) =>
|
|
||||||
`CYCLE_CURRENT_LIST${projectId.toUpperCase()}`;
|
|
||||||
export const CYCLE_UPCOMING_LIST = (projectId: string) =>
|
|
||||||
`CYCLE_UPCOMING_LIST${projectId.toUpperCase()}`;
|
|
||||||
export const CYCLE_DRAFT_LIST = (projectId: string) =>
|
|
||||||
`CYCLE_DRAFT_LIST_${projectId.toUpperCase()}`;
|
|
||||||
export const CYCLE_COMPLETE_LIST = (projectId: string) =>
|
|
||||||
`CYCLE_COMPLETE_LIST_${projectId.toUpperCase()}`;
|
|
||||||
|
|
||||||
export const STATES_LIST = (projectId: string) => `STATES_LIST_${projectId.toUpperCase()}`;
|
export const STATES_LIST = (projectId: string) => `STATES_LIST_${projectId.toUpperCase()}`;
|
||||||
export const STATE_DETAILS = "STATE_DETAILS";
|
export const STATE_DETAILS = "STATE_DETAILS";
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import { getDateRangeStatus } from "helpers/date-time.helper";
|
|||||||
// fetch-keys
|
// fetch-keys
|
||||||
import {
|
import {
|
||||||
CYCLE_ISSUES,
|
CYCLE_ISSUES,
|
||||||
CYCLE_LIST,
|
CYCLES_LIST,
|
||||||
PROJECT_DETAILS,
|
PROJECT_DETAILS,
|
||||||
CYCLE_DETAILS,
|
CYCLE_DETAILS,
|
||||||
PROJECT_ISSUES_LIST,
|
PROJECT_ISSUES_LIST,
|
||||||
@ -54,7 +54,7 @@ const SingleCycle: React.FC = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: cycles } = useSWR(
|
const { data: cycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||||
|
@ -23,17 +23,15 @@ import {
|
|||||||
UpcomingCyclesList,
|
UpcomingCyclesList,
|
||||||
} from "components/cycles";
|
} from "components/cycles";
|
||||||
// ui
|
// ui
|
||||||
import { EmptyState, PrimaryButton } from "components/ui";
|
import { PrimaryButton } from "components/ui";
|
||||||
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
||||||
// icons
|
// icons
|
||||||
import { ListBulletIcon, PlusIcon, Squares2X2Icon } from "@heroicons/react/24/outline";
|
import { ListBulletIcon, PlusIcon, Squares2X2Icon } from "@heroicons/react/24/outline";
|
||||||
// images
|
|
||||||
import emptyCycle from "public/empty-state/empty-cycle.svg";
|
|
||||||
// types
|
// types
|
||||||
import { SelectCycleType } from "types";
|
import { SelectCycleType } from "types";
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PROJECT_DETAILS, CYCLE_CURRENT_LIST } from "constants/fetch-keys";
|
import { CURRENT_CYCLE_LIST, PROJECT_DETAILS } from "constants/fetch-keys";
|
||||||
|
|
||||||
const tabsList = ["All", "Active", "Upcoming", "Completed", "Drafts"];
|
const tabsList = ["All", "Active", "Upcoming", "Completed", "Drafts"];
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ const ProjectCycles: NextPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: currentCycle } = useSWR(
|
const { data: currentCycle } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLE_CURRENT_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||||
@ -207,12 +205,11 @@ const ProjectCycles: NextPage = () => {
|
|||||||
{currentCycle?.[0] ? (
|
{currentCycle?.[0] ? (
|
||||||
<ActiveCycleDetails cycle={currentCycle?.[0]} />
|
<ActiveCycleDetails cycle={currentCycle?.[0]} />
|
||||||
) : (
|
) : (
|
||||||
<EmptyState
|
<div className="flex w-full items-center justify-start rounded-[10px] bg-brand-surface-2 px-6 py-4">
|
||||||
type="cycle"
|
<h3 className="text-base font-medium text-brand-base ">
|
||||||
title="Create New Cycle"
|
No active cycle is present.
|
||||||
description="Sprint more effectively with Cycles by confining your project to a fixed amount of time. Create new cycle now."
|
</h3>
|
||||||
imgURL={emptyCycle}
|
</div>
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</Tab.Panel>
|
</Tab.Panel>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user