From 1c98f2dca97667bd91eff46605b4efa21e6d4066 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Mon, 29 May 2023 02:38:16 +0530 Subject: [PATCH] chore: update cycle fetch keys names --- .../cycles/active-cycle-details.tsx | 10 ++-- .../cycles/cycles-list/all-cycles-list.tsx | 4 +- .../cycles-list/completed-cycles-list.tsx | 4 +- .../cycles/cycles-list/draft-cycles-list.tsx | 4 +- .../cycles-list/upcoming-cycles-list.tsx | 4 +- apps/app/components/cycles/cycles-view.tsx | 30 +++++------ .../components/cycles/delete-cycle-modal.tsx | 20 +++---- apps/app/components/cycles/form.tsx | 3 +- apps/app/components/cycles/modal.tsx | 52 ++++++++++--------- apps/app/components/cycles/select.tsx | 4 +- .../cycles/transfer-issues-modal.tsx | 8 +-- .../issues/sidebar-select/cycle.tsx | 4 +- apps/app/constants/fetch-keys.ts | 24 ++++----- .../projects/[projectId]/cycles/[cycleId].tsx | 4 +- .../projects/[projectId]/cycles/index.tsx | 19 +++---- 15 files changed, 97 insertions(+), 97 deletions(-) diff --git a/apps/app/components/cycles/active-cycle-details.tsx b/apps/app/components/cycles/active-cycle-details.tsx index e0016dd0b..8dfe36a53 100644 --- a/apps/app/components/cycles/active-cycle-details.tsx +++ b/apps/app/components/cycles/active-cycle-details.tsx @@ -42,7 +42,7 @@ import { truncateText } from "helpers/string.helper"; // types import { ICycle, IIssue } from "types"; // 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 = { cycle: ICycle; @@ -100,7 +100,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle, isComple if (!workspaceSlug || !projectId || !cycle) return; mutate( - CYCLE_CURRENT_LIST(projectId as string), + CURRENT_CYCLE_LIST(projectId as string), (prevData) => (prevData ?? []).map((c) => ({ ...c, @@ -110,7 +110,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle, isComple ); mutate( - CYCLE_LIST(projectId as string), + CYCLES_LIST(projectId as string), (prevData: any) => (prevData ?? []).map((c: any) => ({ ...c, @@ -136,7 +136,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle, isComple if (!workspaceSlug || !projectId || !cycle) return; mutate( - CYCLE_CURRENT_LIST(projectId as string), + CURRENT_CYCLE_LIST(projectId as string), (prevData) => (prevData ?? []).map((c) => ({ ...c, @@ -146,7 +146,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle, isComple ); mutate( - CYCLE_LIST(projectId as string), + CYCLES_LIST(projectId as string), (prevData: any) => (prevData ?? []).map((c: any) => ({ ...c, diff --git a/apps/app/components/cycles/cycles-list/all-cycles-list.tsx b/apps/app/components/cycles/cycles-list/all-cycles-list.tsx index 1e696c7b5..11dc08b3e 100644 --- a/apps/app/components/cycles/cycles-list/all-cycles-list.tsx +++ b/apps/app/components/cycles/cycles-list/all-cycles-list.tsx @@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service"; // components import { CyclesView } from "components/cycles"; // fetch-keys -import { CYCLE_LIST } from "constants/fetch-keys"; +import { CYCLES_LIST } from "constants/fetch-keys"; type Props = { viewType: string | null; @@ -18,7 +18,7 @@ export const AllCyclesList: React.FC = ({ viewType }) => { const { workspaceSlug, projectId } = router.query; const { data: allCyclesList } = useSWR( - workspaceSlug && projectId ? CYCLE_LIST(projectId.toString()) : null, + workspaceSlug && projectId ? CYCLES_LIST(projectId.toString()) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), { diff --git a/apps/app/components/cycles/cycles-list/completed-cycles-list.tsx b/apps/app/components/cycles/cycles-list/completed-cycles-list.tsx index a2e48c619..bcbb11d4a 100644 --- a/apps/app/components/cycles/cycles-list/completed-cycles-list.tsx +++ b/apps/app/components/cycles/cycles-list/completed-cycles-list.tsx @@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service"; // components import { CyclesView } from "components/cycles"; // fetch-keys -import { CYCLE_COMPLETE_LIST } from "constants/fetch-keys"; +import { COMPLETED_CYCLES_LIST } from "constants/fetch-keys"; type Props = { viewType: string | null; @@ -18,7 +18,7 @@ export const CompletedCyclesList: React.FC = ({ viewType }) => { const { workspaceSlug, projectId } = router.query; const { data: completedCyclesList } = useSWR( - workspaceSlug && projectId ? CYCLE_COMPLETE_LIST(projectId.toString()) : null, + workspaceSlug && projectId ? COMPLETED_CYCLES_LIST(projectId.toString()) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), { diff --git a/apps/app/components/cycles/cycles-list/draft-cycles-list.tsx b/apps/app/components/cycles/cycles-list/draft-cycles-list.tsx index 746c4b20a..e64e49dfd 100644 --- a/apps/app/components/cycles/cycles-list/draft-cycles-list.tsx +++ b/apps/app/components/cycles/cycles-list/draft-cycles-list.tsx @@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service"; // components import { CyclesView } from "components/cycles"; // fetch-keys -import { CYCLE_DRAFT_LIST } from "constants/fetch-keys"; +import { DRAFT_CYCLES_LIST } from "constants/fetch-keys"; type Props = { viewType: string | null; @@ -18,7 +18,7 @@ export const DraftCyclesList: React.FC = ({ viewType }) => { const { workspaceSlug, projectId } = router.query; const { data: draftCyclesList } = useSWR( - workspaceSlug && projectId ? CYCLE_DRAFT_LIST(projectId.toString()) : null, + workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), { diff --git a/apps/app/components/cycles/cycles-list/upcoming-cycles-list.tsx b/apps/app/components/cycles/cycles-list/upcoming-cycles-list.tsx index 00d06705e..44023e618 100644 --- a/apps/app/components/cycles/cycles-list/upcoming-cycles-list.tsx +++ b/apps/app/components/cycles/cycles-list/upcoming-cycles-list.tsx @@ -7,7 +7,7 @@ import cyclesService from "services/cycles.service"; // components import { CyclesView } from "components/cycles"; // fetch-keys -import { CYCLE_UPCOMING_LIST } from "constants/fetch-keys"; +import { UPCOMING_CYCLES_LIST } from "constants/fetch-keys"; type Props = { viewType: string | null; @@ -18,7 +18,7 @@ export const UpcomingCyclesList: React.FC = ({ viewType }) => { const { workspaceSlug, projectId } = router.query; const { data: upcomingCyclesList } = useSWR( - workspaceSlug && projectId ? CYCLE_UPCOMING_LIST(projectId.toString()) : null, + workspaceSlug && projectId ? UPCOMING_CYCLES_LIST(projectId.toString()) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), { diff --git a/apps/app/components/cycles/cycles-view.tsx b/apps/app/components/cycles/cycles-view.tsx index 5a3305ddb..fc720c251 100644 --- a/apps/app/components/cycles/cycles-view.tsx +++ b/apps/app/components/cycles/cycles-view.tsx @@ -26,11 +26,11 @@ import { getDateRangeStatus } from "helpers/date-time.helper"; import { ICycle } from "types"; // fetch-keys import { - CYCLE_COMPLETE_LIST, - CYCLE_CURRENT_LIST, - CYCLE_DRAFT_LIST, - CYCLE_LIST, - CYCLE_UPCOMING_LIST, + COMPLETED_CYCLES_LIST, + CURRENT_CYCLE_LIST, + CYCLES_LIST, + DRAFT_CYCLES_LIST, + UPCOMING_CYCLES_LIST, } from "constants/fetch-keys"; type Props = { @@ -67,12 +67,12 @@ export const CyclesView: React.FC = ({ cycles, viewType }) => { const fetchKey = cycleStatus === "current" - ? CYCLE_CURRENT_LIST(projectId as string) + ? CURRENT_CYCLE_LIST(projectId as string) : cycleStatus === "upcoming" - ? CYCLE_UPCOMING_LIST(projectId as string) + ? UPCOMING_CYCLES_LIST(projectId as string) : cycleStatus === "completed" - ? CYCLE_COMPLETE_LIST(projectId as string) - : CYCLE_DRAFT_LIST(projectId as string); + ? COMPLETED_CYCLES_LIST(projectId as string) + : DRAFT_CYCLES_LIST(projectId as string); mutate( fetchKey, @@ -85,7 +85,7 @@ export const CyclesView: React.FC = ({ cycles, viewType }) => { ); mutate( - CYCLE_LIST(projectId as string), + CYCLES_LIST(projectId as string), (prevData: any) => (prevData ?? []).map((c: any) => ({ ...c, @@ -114,12 +114,12 @@ export const CyclesView: React.FC = ({ cycles, viewType }) => { const fetchKey = cycleStatus === "current" - ? CYCLE_CURRENT_LIST(projectId as string) + ? CURRENT_CYCLE_LIST(projectId as string) : cycleStatus === "upcoming" - ? CYCLE_UPCOMING_LIST(projectId as string) + ? UPCOMING_CYCLES_LIST(projectId as string) : cycleStatus === "completed" - ? CYCLE_COMPLETE_LIST(projectId as string) - : CYCLE_DRAFT_LIST(projectId as string); + ? COMPLETED_CYCLES_LIST(projectId as string) + : DRAFT_CYCLES_LIST(projectId as string); mutate( fetchKey, @@ -132,7 +132,7 @@ export const CyclesView: React.FC = ({ cycles, viewType }) => { ); mutate( - CYCLE_LIST(projectId as string), + CYCLES_LIST(projectId as string), (prevData: any) => (prevData ?? []).map((c: any) => ({ ...c, diff --git a/apps/app/components/cycles/delete-cycle-modal.tsx b/apps/app/components/cycles/delete-cycle-modal.tsx index dfae65cae..187c9694c 100644 --- a/apps/app/components/cycles/delete-cycle-modal.tsx +++ b/apps/app/components/cycles/delete-cycle-modal.tsx @@ -22,11 +22,11 @@ type TConfirmCycleDeletionProps = { }; // fetch-keys import { - CYCLE_COMPLETE_LIST, - CYCLE_CURRENT_LIST, - CYCLE_DRAFT_LIST, - CYCLE_LIST, - CYCLE_UPCOMING_LIST, + COMPLETED_CYCLES_LIST, + CURRENT_CYCLE_LIST, + CYCLES_LIST, + DRAFT_CYCLES_LIST, + UPCOMING_CYCLES_LIST, } from "constants/fetch-keys"; import { getDateRangeStatus } from "helpers/date-time.helper"; @@ -58,12 +58,12 @@ export const DeleteCycleModal: React.FC = ({ const cycleType = getDateRangeStatus(data.start_date, data.end_date); const fetchKey = cycleType === "current" - ? CYCLE_CURRENT_LIST(projectId as string) + ? CURRENT_CYCLE_LIST(projectId as string) : cycleType === "upcoming" - ? CYCLE_UPCOMING_LIST(projectId as string) + ? UPCOMING_CYCLES_LIST(projectId as string) : cycleType === "completed" - ? CYCLE_COMPLETE_LIST(projectId as string) - : CYCLE_DRAFT_LIST(projectId as string); + ? COMPLETED_CYCLES_LIST(projectId as string) + : DRAFT_CYCLES_LIST(projectId as string); mutate( fetchKey, @@ -76,7 +76,7 @@ export const DeleteCycleModal: React.FC = ({ ); mutate( - CYCLE_LIST(projectId as string), + CYCLES_LIST(projectId as string), (prevData: any) => { if (!prevData) return; return prevData.filter((cycle: any) => cycle.id !== data?.id); diff --git a/apps/app/components/cycles/form.tsx b/apps/app/components/cycles/form.tsx index a0bd781ce..5c0b2e080 100644 --- a/apps/app/components/cycles/form.tsx +++ b/apps/app/components/cycles/form.tsx @@ -12,7 +12,7 @@ type Props = { handleFormSubmit: (values: Partial) => Promise; handleClose: () => void; status: boolean; - data?: ICycle; + data?: ICycle | null; }; const defaultValues: Partial = { @@ -28,7 +28,6 @@ export const CycleForm: React.FC = ({ handleFormSubmit, handleClose, stat formState: { errors, isSubmitting }, handleSubmit, control, - watch, reset, } = useForm({ defaultValues, diff --git a/apps/app/components/cycles/modal.tsx b/apps/app/components/cycles/modal.tsx index 715b40e2c..e27b5ac32 100644 --- a/apps/app/components/cycles/modal.tsx +++ b/apps/app/components/cycles/modal.tsx @@ -18,12 +18,12 @@ import { getDateRangeStatus, isDateGreaterThanToday } from "helpers/date-time.he import type { ICycle } from "types"; // fetch keys import { - CYCLE_COMPLETE_LIST, - CYCLE_CURRENT_LIST, - CYCLE_DRAFT_LIST, - CYCLE_INCOMPLETE_LIST, - CYCLE_LIST, - CYCLE_UPCOMING_LIST, + COMPLETED_CYCLES_LIST, + CURRENT_CYCLE_LIST, + CYCLES_LIST, + DRAFT_CYCLES_LIST, + INCOMPLETE_CYCLES_LIST, + UPCOMING_CYCLES_LIST, } from "constants/fetch-keys"; type CycleModalProps = { @@ -43,24 +43,26 @@ export const CreateUpdateCycleModal: React.FC = ({ const { setToastAlert } = useToast(); const createCycle = async (payload: Partial) => { + if (!workspaceSlug || !projectId) return; + await cycleService - .createCycle(workspaceSlug as string, projectId as string, payload) + .createCycle(workspaceSlug.toString(), projectId.toString(), payload) .then((res) => { switch (getDateRangeStatus(res.start_date, res.end_date)) { case "completed": - mutate(CYCLE_COMPLETE_LIST(projectId as string)); + mutate(COMPLETED_CYCLES_LIST(projectId.toString())); break; case "current": - mutate(CYCLE_CURRENT_LIST(projectId as string)); + mutate(CURRENT_CYCLE_LIST(projectId.toString())); break; case "upcoming": - mutate(CYCLE_UPCOMING_LIST(projectId as string)); + mutate(UPCOMING_CYCLES_LIST(projectId.toString())); break; default: - mutate(CYCLE_DRAFT_LIST(projectId as string)); + mutate(DRAFT_CYCLES_LIST(projectId.toString())); } - mutate(CYCLE_INCOMPLETE_LIST(projectId as string)); - mutate(CYCLE_LIST(projectId as string)); + mutate(INCOMPLETE_CYCLES_LIST(projectId.toString())); + mutate(CYCLES_LIST(projectId.toString())); handleClose(); setToastAlert({ @@ -69,7 +71,7 @@ export const CreateUpdateCycleModal: React.FC = ({ message: "Cycle created successfully.", }); }) - .catch((err) => { + .catch(() => { setToastAlert({ type: "error", title: "Error!", @@ -79,39 +81,41 @@ export const CreateUpdateCycleModal: React.FC = ({ }; const updateCycle = async (cycleId: string, payload: Partial) => { + if (!workspaceSlug || !projectId) return; + await cycleService - .updateCycle(workspaceSlug as string, projectId as string, cycleId, payload) + .updateCycle(workspaceSlug.toString(), projectId.toString(), cycleId, payload) .then((res) => { switch (getDateRangeStatus(data?.start_date, data?.end_date)) { case "completed": - mutate(CYCLE_COMPLETE_LIST(projectId as string)); + mutate(COMPLETED_CYCLES_LIST(projectId.toString())); break; case "current": - mutate(CYCLE_CURRENT_LIST(projectId as string)); + mutate(CURRENT_CYCLE_LIST(projectId.toString())); break; case "upcoming": - mutate(CYCLE_UPCOMING_LIST(projectId as string)); + mutate(UPCOMING_CYCLES_LIST(projectId.toString())); break; 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 ( getDateRangeStatus(data?.start_date, data?.end_date) != getDateRangeStatus(res.start_date, res.end_date) ) { switch (getDateRangeStatus(res.start_date, res.end_date)) { case "completed": - mutate(CYCLE_COMPLETE_LIST(projectId as string)); + mutate(COMPLETED_CYCLES_LIST(projectId.toString())); break; case "current": - mutate(CYCLE_CURRENT_LIST(projectId as string)); + mutate(CURRENT_CYCLE_LIST(projectId.toString())); break; case "upcoming": - mutate(CYCLE_UPCOMING_LIST(projectId as string)); + mutate(UPCOMING_CYCLES_LIST(projectId.toString())); break; default: - mutate(CYCLE_DRAFT_LIST(projectId as string)); + mutate(DRAFT_CYCLES_LIST(projectId.toString())); } } diff --git a/apps/app/components/cycles/select.tsx b/apps/app/components/cycles/select.tsx index 854749ec5..5a6f00ada 100644 --- a/apps/app/components/cycles/select.tsx +++ b/apps/app/components/cycles/select.tsx @@ -14,7 +14,7 @@ import cycleServices from "services/cycles.service"; // components import { CreateUpdateCycleModal } from "components/cycles"; // fetch-keys -import { CYCLE_LIST } from "constants/fetch-keys"; +import { CYCLES_LIST } from "constants/fetch-keys"; export type IssueCycleSelectProps = { projectId: string; @@ -36,7 +36,7 @@ export const CycleSelect: React.FC = ({ const { workspaceSlug } = router.query; const { data: cycles } = useSWR( - workspaceSlug && projectId ? CYCLE_LIST(projectId) : null, + workspaceSlug && projectId ? CYCLES_LIST(projectId) : null, workspaceSlug && projectId ? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, { diff --git a/apps/app/components/cycles/transfer-issues-modal.tsx b/apps/app/components/cycles/transfer-issues-modal.tsx index 8d44c14d0..30db2f320 100644 --- a/apps/app/components/cycles/transfer-issues-modal.tsx +++ b/apps/app/components/cycles/transfer-issues-modal.tsx @@ -10,16 +10,16 @@ import { Dialog, Transition } from "@headlessui/react"; import cyclesService from "services/cycles.service"; // hooks import useToast from "hooks/use-toast"; +import useIssuesView from "hooks/use-issues-view"; //icons 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 -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 import { ICycle } from "types"; //helper import { getDateRangeStatus } from "helpers/date-time.helper"; -import useIssuesView from "hooks/use-issues-view"; type Props = { isOpen: boolean; @@ -57,7 +57,7 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => }; const { data: incompleteCycles } = useSWR( - workspaceSlug && projectId ? CYCLE_INCOMPLETE_LIST(projectId as string) : null, + workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, { diff --git a/apps/app/components/issues/sidebar-select/cycle.tsx b/apps/app/components/issues/sidebar-select/cycle.tsx index d9e7772a3..ad112ab52 100644 --- a/apps/app/components/issues/sidebar-select/cycle.tsx +++ b/apps/app/components/issues/sidebar-select/cycle.tsx @@ -16,7 +16,7 @@ import { ContrastIcon } from "components/icons"; // types import { ICycle, IIssue, UserAuth } from "types"; // 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 = { issueDetail: IIssue | undefined; @@ -33,7 +33,7 @@ export const SidebarCycleSelect: React.FC = ({ const { workspaceSlug, projectId, issueId } = router.query; const { data: incompleteCycles } = useSWR( - workspaceSlug && projectId ? CYCLE_INCOMPLETE_LIST(projectId as string) : null, + workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null, workspaceSlug && projectId ? () => cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, { diff --git a/apps/app/constants/fetch-keys.ts b/apps/app/constants/fetch-keys.ts index 5b286bcc1..75b187b2b 100644 --- a/apps/app/constants/fetch-keys.ts +++ b/apps/app/constants/fetch-keys.ts @@ -71,9 +71,18 @@ export const PROJECT_ISSUE_LABELS = (projectId: string) => export const PROJECT_GITHUB_REPOSITORY = (projectId: string) => `PROJECT_GITHUB_REPOSITORY_${projectId.toUpperCase()}`; -export const CYCLE_LIST = (projectId: string) => `CYCLE_LIST_${projectId.toUpperCase()}`; -export const CYCLE_INCOMPLETE_LIST = (projectId: string) => - `CYCLE_INCOMPLETE_LIST_${projectId.toUpperCase()}`; +// cycles +export const CYCLES_LIST = (projectId: string) => `CYCLE_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_WITH_PARAMS = (cycleId: string, params?: any) => { 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_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 STATE_DETAILS = "STATE_DETAILS"; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx index 3e5fafe6f..08c04a736 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx @@ -30,7 +30,7 @@ import { getDateRangeStatus } from "helpers/date-time.helper"; // fetch-keys import { CYCLE_ISSUES, - CYCLE_LIST, + CYCLES_LIST, PROJECT_DETAILS, CYCLE_DETAILS, PROJECT_ISSUES_LIST, @@ -54,7 +54,7 @@ const SingleCycle: React.FC = () => { ); const { data: cycles } = useSWR( - workspaceSlug && projectId ? CYCLE_LIST(projectId as string) : null, + workspaceSlug && projectId ? CYCLES_LIST(projectId as string) : null, workspaceSlug && projectId ? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, { diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx index b9b02d49c..4573cd53c 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx @@ -23,17 +23,15 @@ import { UpcomingCyclesList, } from "components/cycles"; // ui -import { EmptyState, PrimaryButton } from "components/ui"; +import { PrimaryButton } from "components/ui"; import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; // icons import { ListBulletIcon, PlusIcon, Squares2X2Icon } from "@heroicons/react/24/outline"; -// images -import emptyCycle from "public/empty-state/empty-cycle.svg"; // types import { SelectCycleType } from "types"; import type { NextPage } from "next"; // 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"]; @@ -72,7 +70,7 @@ const ProjectCycles: NextPage = () => { ); const { data: currentCycle } = useSWR( - workspaceSlug && projectId ? CYCLE_CURRENT_LIST(projectId as string) : null, + workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null, workspaceSlug && projectId ? () => cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, { @@ -207,12 +205,11 @@ const ProjectCycles: NextPage = () => { {currentCycle?.[0] ? ( ) : ( - +
+

+ No active cycle is present. +

+
)} )}