diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx index bfc8ef002..cd53e80b6 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx @@ -7,6 +7,8 @@ import useSWR from "swr"; // headless ui import { Tab } from "@headlessui/react"; +// hooks +import useLocalStorage from "hooks/use-local-storage"; // services import cycleService from "services/cycles.service"; import projectService from "services/project.service"; @@ -45,6 +47,8 @@ const ProjectCycles: NextPage = () => { const [selectedCycle, setSelectedCycle] = useState(); const [createUpdateCycleModal, setCreateUpdateCycleModal] = useState(false); + const { storedValue: cycleTab, setValue: setCycleTab } = useLocalStorage("cycleTab", "Upcoming"); + const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -77,6 +81,20 @@ const ProjectCycles: NextPage = () => { }, 500); }, [createUpdateCycleModal]); + const currentTabValue = (tab: string | null) => { + switch (tab) { + case "Upcoming": + return 0; + case "Completed": + return 1; + case "Drafts": + return 2; + + default: + return 0; + } + }; + return ( { document.dispatchEvent(e); }} > - + Add Cycle } @@ -123,7 +141,22 @@ const ProjectCycles: NextPage = () => {

Other Cycles

- + { + switch (i) { + case 0: + return setCycleTab("Upcoming"); + case 1: + return setCycleTab("Completed"); + case 2: + return setCycleTab("Drafts"); + + default: + return setCycleTab("Upcoming"); + } + }} + >