Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cycles revamp using MobX #2443

Merged
merged 130 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 129 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
8d86087
chore: kanban refactoring
gurusainath Sep 4, 2023
e9b6f86
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanaba…
gurusainath Sep 4, 2023
9d334cf
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanaba…
gurusainath Sep 4, 2023
731309a
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanaba…
gurusainath Sep 5, 2023
ef630ef
chore: Implemented new kanaban board UX and implemented draggable usi…
gurusainath Sep 5, 2023
15ef2bc
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanaba…
gurusainath Sep 6, 2023
b86c30b
chore: updated yarn lock
gurusainath Sep 6, 2023
7c5936e
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 7, 2023
b9a6a00
chore: updated the store for issues and issue filters
gurusainath Sep 8, 2023
aef71fb
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 8, 2023
8c04e77
chore: resolved build error
gurusainath Sep 8, 2023
c0e3c81
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 11, 2023
0445c61
chore: created filters and updated the issue filters, display_filter …
gurusainath Sep 12, 2023
a8c5a41
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 12, 2023
0424280
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 12, 2023
3b85444
chore: implemented filters for issues
gurusainath Sep 12, 2023
834e672
chore: UI theming updates
gurusainath Sep 12, 2023
ada1bc0
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 12, 2023
698021a
chore: handled single and multi select in filter cards
gurusainath Sep 12, 2023
0ec0ad6
chore: implemented filters and views in kanaban
gurusainath Sep 13, 2023
3ffbb6a
chore: updating filters, display_filter and display properties
gurusainath Sep 14, 2023
f579712
chore: merge conflict for lucide icons resolved
gurusainath Sep 14, 2023
c67f08f
chore: filter, layout, display filters, extra filters and display pro…
gurusainath Sep 14, 2023
60883ba
chore: clean up and resolved import warnings
gurusainath Sep 14, 2023
66022ea
chore: type check
gurusainath Sep 14, 2023
28ce96a
chore: renamed gantt key to gantt_chart
gurusainath Sep 14, 2023
3c9e62d
chore: filter render UI and Functionality implementation
gurusainath Sep 14, 2023
fce6907
chore: filter empty state handling in issue filter selection
gurusainath Sep 14, 2023
d88a088
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 15, 2023
9136258
Implementing list view
sriramveeraghanta Sep 15, 2023
7b04adf
chore: kanban drag drop logic
gurusainath Sep 15, 2023
cf34d4a
merge conflicts resolved
sriramveeraghanta Sep 15, 2023
cc9ebc5
Merge pull request #2195 from makeplane/fix/list-sorting
sriramveeraghanta Sep 15, 2023
f6d4ac9
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 15, 2023
e949031
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 15, 2023
70fe830
filtering
sriramveeraghanta Sep 15, 2023
12b6ec4
Merge pull request #2197 from makeplane/fix/list-sorting
sriramveeraghanta Sep 15, 2023
a25e5ac
chore: store setup
gurusainath Sep 15, 2023
12ce6e7
Merge branch 'develop' of gurusainath:makeplane/plane into fix/kanban…
gurusainath Sep 19, 2023
906caa6
chore: handled build issues
gurusainath Sep 19, 2023
4915926
chore: store setup
gurusainath Sep 20, 2023
50c330d
conflicts
gurusainath Sep 20, 2023
908f671
user filter
gurusainath Sep 20, 2023
a328c53
chore: store setup
sriramveeraghanta Sep 20, 2023
e96bc77
chore: fixing up store
sriramveeraghanta Sep 20, 2023
6d52801
chore: store fixes and static data setup
sriramveeraghanta Sep 20, 2023
f69d346
chore: store setup for build fixes
sriramveeraghanta Sep 21, 2023
2dcaccd
fix: merge conflicts (#2231)
aaryan610 Sep 21, 2023
9b41b5b
chore: store fixes
sriramveeraghanta Sep 21, 2023
daa3094
chore: update issue detail store to handle peek overview (#2237)
aaryan610 Sep 21, 2023
6a430ed
chore: minor fixes
sriramveeraghanta Sep 22, 2023
0ebe36b
workspace project fixes
sriramveeraghanta Sep 25, 2023
27f78dd
feat: project issues topbar (#2256)
aaryan610 Sep 25, 2023
9a8dcc3
chore: minor fixes
sriramveeraghanta Sep 25, 2023
9831418
chore: filters dropdown (#2260)
aaryan610 Sep 25, 2023
2b419c0
fix: leave project fixes
sriramveeraghanta Sep 25, 2023
310a2ca
refactor: project card component refactor
sriramveeraghanta Sep 25, 2023
43404bf
Implemented swimlanes and kanban view (#2262)
gurusainath Sep 26, 2023
1b8d58a
fix: computed filters logic
aaryan610 Sep 26, 2023
7c0c0da
Merge branch 'fix/issues-layout-mobx' of https://github.com/makeplane…
aaryan610 Sep 26, 2023
c48cd3e
chore: added sub_group_by in params and handled sub-group-by render e…
gurusainath Sep 26, 2023
c342ab3
fix: ui package setup and project update form refactor
sriramveeraghanta Sep 27, 2023
151662a
fix: ui package setup
sriramveeraghanta Sep 27, 2023
ccf6bd4
Merge branch 'fix/issues-layout-mobx' of github.com:makeplane/plane i…
sriramveeraghanta Sep 27, 2023
b2d17e6
fix: minor ui fixes
sriramveeraghanta Sep 28, 2023
3bf590b
dev: calendar view layout revamp (#2293)
aaryan610 Sep 28, 2023
5af753f
chore: removed demo m-store routes
gurusainath Sep 28, 2023
2643de8
cycles changes
sriramveeraghanta Sep 28, 2023
f60dcdc
Merge branch 'fix/issues-layout-mobx' of github.com:makeplane/plane i…
sriramveeraghanta Sep 28, 2023
b70047b
chore: issues grouped kanban and swimlanes UI and functionality (#2294)
gurusainath Sep 29, 2023
479c145
refactor: filter components, constants and helper functions (#2297)
aaryan610 Sep 29, 2023
9ad1e73
dev: gantt chart implementation using MobX (#2302)
aaryan610 Sep 29, 2023
7270424
dev: spreadsheet layout implementation using MobX (#2306)
aaryan610 Sep 29, 2023
f227058
chore: refactoring cycles list
sriramveeraghanta Sep 29, 2023
405a398
feat: adding additional ui components
sriramveeraghanta Sep 29, 2023
569a6c3
dev: applied filters list implementation using MobX (#2325)
aaryan610 Oct 2, 2023
a39aa80
Merge branch 'fix/issues-layout-mobx' of github.com:makeplane/plane i…
sriramveeraghanta Oct 2, 2023
9c2ea8a
fix: cycles views list and board
sriramveeraghanta Oct 2, 2023
b1448c9
fix: cycles list rendering fixes
sriramveeraghanta Oct 2, 2023
41fd9ce
fix: layout fixes
sriramveeraghanta Oct 2, 2023
7be038a
refactor: filter components (#2359)
aaryan610 Oct 4, 2023
b5b8095
chore: issue properties for list and kanban layouts and implemented e…
gurusainath Oct 4, 2023
844a3e4
chore: filters import conflict
gurusainath Oct 4, 2023
0f47762
dev: setup module and module filter store (#2364)
aaryan610 Oct 4, 2023
547a265
chore: issue list layout (#2367)
gurusainath Oct 4, 2023
71604bb
chore: merge develop (#2388)
aaryan610 Oct 5, 2023
13874f2
fix: build erros
aaryan610 Oct 5, 2023
e28919a
chore: cycles, modules store integration, list and kanban layouts and…
gurusainath Oct 9, 2023
0ef2200
refactor: change naming convention (#2383)
aaryan610 Oct 9, 2023
f444309
fix:auth layer revamp
sriramveeraghanta Oct 10, 2023
57e2ed2
chore: Implemented list and kanban views in project modules (#2402)
gurusainath Oct 10, 2023
4dec676
dev: implement global views using MobX (#2404)
aaryan610 Oct 11, 2023
991a685
fix: Auth fixes and Layout fixes (#2408)
sriramveeraghanta Oct 11, 2023
9f61d8b
fix: analytics page fixes
sriramveeraghanta Oct 11, 2023
00b40fb
dev: implemented project views using MobX (#2410)
aaryan610 Oct 11, 2023
35a7d10
chore: plane ui library component and code refactor (#2406)
anmolsinghbhatia Oct 11, 2023
45aaf5c
chore: cycles revamp
gurusainath Oct 11, 2023
9f25f5a
chore: conflicts resolved
gurusainath Oct 11, 2023
faf0a64
fix: gitignore fixes
sriramveeraghanta Oct 11, 2023
0fcfa7e
chore: updated cycles view adn layout mutation
gurusainath Oct 11, 2023
d58d639
fix: project card fixes
sriramveeraghanta Oct 11, 2023
67b2821
chore: ui component revamp (#2415)
anmolsinghbhatia Oct 11, 2023
265e60a
chore: implement new worksapace wrapper for global views (#2412)
aaryan610 Oct 11, 2023
fcfdd74
dev: add remaining layouts to cycle (#2413)
aaryan610 Oct 11, 2023
08d9f15
fix: workspace auth wrapper changes
sriramveeraghanta Oct 11, 2023
2a4e61f
chore: project card revamp and refactor (#2416)
anmolsinghbhatia Oct 12, 2023
f2c3ad4
removing dist from ui
sriramveeraghanta Oct 12, 2023
e42dded
chore: handled edit and delete operation in cycle board view, and gan…
gurusainath Oct 12, 2023
404e6a0
refactor: analytics (#2419)
aaryan610 Oct 12, 2023
8aebf0b
refactor: folder structure, remove junk code (#2423)
aaryan610 Oct 13, 2023
9b0b5fc
fix: services fixes
sriramveeraghanta Oct 13, 2023
7b5779c
fix: store imports changes
sriramveeraghanta Oct 13, 2023
06bbc4c
fix: merge conflicts resolved from develop
sriramveeraghanta Oct 13, 2023
863d5ab
fix: services export fixes
sriramveeraghanta Oct 13, 2023
c7341ef
fix: services implementation fixes
sriramveeraghanta Oct 13, 2023
ea85f5d
fix: build issue fixes
sriramveeraghanta Oct 13, 2023
9d50d28
fix: react library fixes
sriramveeraghanta Oct 13, 2023
44df9e5
refactor: MobX store folder structure (#2435)
aaryan610 Oct 13, 2023
f7f9881
fix: service import errors (#2436)
aaryan610 Oct 14, 2023
93cd04f
build fixes
sriramveeraghanta Oct 14, 2023
bc37c02
editor ts config fixes
sriramveeraghanta Oct 14, 2023
2ce2bc8
fix: turbo and build fixes
sriramveeraghanta Oct 14, 2023
e3828db
fix: Auth screen loading implementation
sriramveeraghanta Oct 15, 2023
414908d
fix: build issues
sriramveeraghanta Oct 15, 2023
f450cf8
fix: turbo settings for ui package
sriramveeraghanta Oct 15, 2023
ad26dc8
conflict: merge conflict resolved
gurusainath Oct 16, 2023
b5e977d
chore: project active cycles requestes changed from swr to mobx
gurusainath Oct 16, 2023
7ff0976
conflict: merge conflicts resolved
gurusainath Oct 16, 2023
a7232c6
chore: imports and structuring codebase in cycles
gurusainath Oct 16, 2023
6562260
chore: removed legacy code from cycles
gurusainath Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions web/components/common/empty-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,14 @@ export const EmptyState: React.FC<Props> = ({
isFullScreen = true,
disabled = false,
}) => (
<div
className={`h-full w-full mx-auto grid place-items-center p-8 ${
isFullScreen ? "md:w-4/5 lg:w-3/5" : ""
}`}
>
<div className={`h-full w-full mx-auto grid place-items-center p-8 ${isFullScreen ? "md:w-4/5 lg:w-3/5" : ""}`}>
<div className="text-center flex flex-col items-center w-full">
<Image src={image} className="w-52 sm:w-60" alt={primaryButton?.text} />
<h6 className="text-xl font-semibold mt-6 sm:mt-8 mb-3">{title}</h6>
{description && <p className="text-custom-text-300 mb-7 sm:mb-8">{description}</p>}
<div className="flex items-center gap-4">
{primaryButton && (
<PrimaryButton
className="flex items-center gap-1.5"
onClick={primaryButton.onClick}
disabled={disabled}
>
<PrimaryButton className="flex items-center gap-1.5" onClick={primaryButton.onClick} disabled={disabled}>
{primaryButton.icon}
{primaryButton.text}
</PrimaryButton>
Expand Down
142 changes: 52 additions & 90 deletions web/components/cycles/active-cycle-details.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import React from "react";

import { MouseEvent } from "react";
import Link from "next/link";
import { useRouter } from "next/router";

import useSWR, { mutate } from "swr";

// services
import { CycleService } from "services/cycle.service";
// hooks
import useToast from "hooks/use-toast";
import { useMobxStore } from "lib/mobx/store-provider";
// ui
import { AssigneesList } from "components/ui/avatar";
import { SingleProgressStats } from "components/core";
import { Loader, Tooltip, LinearProgressIndicator } from "@plane/ui";
// components
import ProgressChart from "components/core/sidebar/progress-chart";
import { ActiveCycleProgressStats } from "components/cycles";

import { ViewIssueLabel } from "components/issues";
// icons
import { CalendarDaysIcon } from "@heroicons/react/20/solid";
import { PriorityIcon } from "components/icons/priority-icon";
Expand All @@ -31,8 +29,6 @@ import {
StateGroupIcon,
} from "components/icons";
import { StarIcon } from "@heroicons/react/24/outline";
// components
import { ViewIssueLabel } from "components/issues";
// helpers
import { getDateRangeStatus, renderShortDateWithYearFormat, findHowManyDaysLeft } from "helpers/date-time.helper";
import { truncateText } from "helpers/string.helper";
Expand Down Expand Up @@ -69,34 +65,43 @@ const stateGroups = [
},
];

// services
const cycleService = new CycleService();
interface IActiveCycleDetails {
workspaceSlug: string;
projectId: string;
}

export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = (props) => {
// services
const cycleService = new CycleService();

export const ActiveCycleDetails: React.FC = () => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;

const { workspaceSlug, projectId } = props;

const { cycle: cycleStore } = useMobxStore();

const { setToastAlert } = useToast();

const { data: currentCycle } = useSWR(
workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null,
workspaceSlug && projectId
? () => cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, "current")
: null
const { isLoading } = useSWR(
workspaceSlug && projectId ? `ACTIVE_CYCLE_ISSUE_${projectId}_CURRENT` : null,
workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, "current") : null
);
const cycle = currentCycle ? currentCycle[0] : null;

const { data: issues } = useSWR(
workspaceSlug && projectId && cycle?.id ? CYCLE_ISSUES_WITH_PARAMS(cycle?.id, { priority: "urgent,high" }) : null,
workspaceSlug && projectId && cycle?.id
? () =>
cycleService.getCycleIssuesWithParams(workspaceSlug as string, projectId as string, cycle.id, {
priority: "urgent,high",
})
: null
) as { data: IIssue[] | undefined };
const activeCycle = cycleStore.cycles?.[projectId] || null;
const cycle = activeCycle ? activeCycle[0] : null;
const issues = (cycleStore?.active_cycle_issues as any) || null;

// const { data: issues } = useSWR(
// workspaceSlug && projectId && cycle?.id ? CYCLE_ISSUES_WITH_PARAMS(cycle?.id, { priority: "urgent,high" }) : null,
// workspaceSlug && projectId && cycle?.id
// ? () =>
// cycleService.getCycleIssuesWithParams(workspaceSlug as string, projectId as string, cycle.id, {
// priority: "urgent,high",
// })
// : null
// ) as { data: IIssue[] | undefined };

if (!currentCycle)
if (isLoading)
return (
<Loader>
<Loader.Item height="250px" />
Expand Down Expand Up @@ -146,70 +151,28 @@ export const ActiveCycleDetails: React.FC = () => {

const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);

const handleAddToFavorites = () => {
if (!workspaceSlug || !projectId || !cycle) return;
const handleAddToFavorites = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

mutate<ICycle[]>(
CURRENT_CYCLE_LIST(projectId as string),
(prevData) =>
(prevData ?? []).map((c) => ({
...c,
is_favorite: c.id === cycle.id ? true : c.is_favorite,
})),
false
);

mutate(
CYCLES_LIST(projectId as string),
(prevData: any) =>
(prevData ?? []).map((c: any) => ({
...c,
is_favorite: c.id === cycle.id ? true : c.is_favorite,
})),
false
);

cycleService
.addCycleToFavorites(workspaceSlug as string, projectId as string, {
cycle: cycle.id,
})
.catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Couldn't add the cycle to favorites. Please try again.",
});
cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Couldn't add the cycle to favorites. Please try again.",
});
});
};

const handleRemoveFromFavorites = () => {
if (!workspaceSlug || !projectId || !cycle) return;

mutate<ICycle[]>(
CURRENT_CYCLE_LIST(projectId as string),
(prevData) =>
(prevData ?? []).map((c) => ({
...c,
is_favorite: c.id === cycle.id ? false : c.is_favorite,
})),
false
);

mutate(
CYCLES_LIST(projectId as string),
(prevData: any) =>
(prevData ?? []).map((c: any) => ({
...c,
is_favorite: c.id === cycle.id ? false : c.is_favorite,
})),
false
);
const handleRemoveFromFavorites = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleService.removeCycleFromFavorites(workspaceSlug as string, projectId as string, cycle.id).catch(() => {
cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Couldn't remove the cycle from favorites. Please try again.",
message: "Couldn't add the cycle to favorites. Please try again.",
});
});
};
Expand Down Expand Up @@ -296,17 +259,15 @@ export const ActiveCycleDetails: React.FC = () => {
{cycle.is_favorite ? (
<button
onClick={(e) => {
e.preventDefault();
handleRemoveFromFavorites();
handleRemoveFromFavorites(e);
}}
>
<StarIcon className="h-4 w-4 text-orange-400" fill="#f6ad55" />
</button>
) : (
<button
onClick={(e) => {
e.preventDefault();
handleAddToFavorites();
handleAddToFavorites(e);
}}
>
<StarIcon className="h-4 w-4 " color="rgb(var(--color-text-200))" />
Expand Down Expand Up @@ -412,7 +373,7 @@ export const ActiveCycleDetails: React.FC = () => {
<div className="my-3 flex max-h-[240px] min-h-[240px] flex-col gap-2.5 overflow-y-scroll rounded-md">
{issues ? (
issues.length > 0 ? (
issues.map((issue) => (
issues.map((issue: any) => (
<div
key={issue.id}
onClick={() => router.push(`/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`)}
Expand Down Expand Up @@ -480,14 +441,15 @@ export const ActiveCycleDetails: React.FC = () => {
width:
issues &&
`${
(issues.filter((issue) => issue?.state_detail?.group === "completed")?.length / issues.length) *
(issues.filter((issue: any) => issue?.state_detail?.group === "completed")?.length /
issues.length) *
100 ?? 0
}%`,
}}
/>
</div>
<div className="w-16 text-end text-xs text-custom-text-200">
{issues?.filter((issue) => issue?.state_detail?.group === "completed")?.length} of {issues?.length}
{issues?.filter((issue: any) => issue?.state_detail?.group === "completed")?.length} of {issues?.length}
</div>
</div>
)}
Expand Down
134 changes: 134 additions & 0 deletions web/components/cycles/cycle-create-edit-modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { Fragment } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { observer } from "mobx-react-lite";
// components
import { CycleForm } from "./form";
// hooks
import useToast from "hooks/use-toast";
import { useMobxStore } from "lib/mobx/store-provider";
// types
import { CycleDateCheckData, ICycle } from "types";

interface ICycleCreateEdit {
cycle?: ICycle | null;
modal: boolean;
modalClose: () => void;
onSubmit?: () => void;
workspaceSlug: string;
projectId: string;
}

export const CycleCreateEditModal: React.FC<ICycleCreateEdit> = observer((props) => {
const { modal, modalClose, cycle = null, onSubmit, workspaceSlug, projectId } = props;

const { cycle: cycleStore } = useMobxStore();

const { setToastAlert } = useToast();

const validateCycleDate = async (payload: CycleDateCheckData) => {
let status = false;
await cycleStore.validateDate(workspaceSlug as string, projectId as string, payload).then((res) => {
status = res.status;
});
return status;
};

const formSubmit = async (data: Partial<ICycle>) => {
let isDateValid: boolean = true;

if (data?.start_date && data?.end_date) {
if (cycle?.id && cycle?.start_date && cycle?.end_date)
isDateValid = await validateCycleDate({
start_date: data.start_date,
end_date: data.end_date,
cycle_id: cycle.id,
});
else
isDateValid = await validateCycleDate({
start_date: data.start_date,
end_date: data.end_date,
});
}

if (isDateValid)
if (cycle) {
try {
await cycleStore.updateCycle(workspaceSlug, projectId, cycle.id, data);
if (modalClose) modalClose();
if (onSubmit) onSubmit();
setToastAlert({
type: "success",
title: "Success!",
message: "Cycle updated successfully.",
});
} catch (error) {
console.log("error", error);
setToastAlert({
type: "error",
title: "Warning!",
message: "Something went wrong please try again later.",
});
}
} else {
try {
await cycleStore.createCycle(workspaceSlug, projectId, data);
if (modalClose) modalClose();
if (onSubmit) onSubmit();
setToastAlert({
type: "success",
title: "Success!",
message: "Cycle created successfully.",
});
} catch (error) {
console.log("error", error);
setToastAlert({
type: "error",
title: "Warning!",
message: "Something went wrong please try again later.",
});
}
}
else
setToastAlert({
type: "error",
title: "Error!",
message: "You already have a cycle on the given dates, if you want to create a draft cycle, remove the dates.",
});
};

return (
<Transition.Root show={modal} as={Fragment}>
<Dialog as="div" className="relative z-20" onClose={modalClose}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-custom-backdrop bg-opacity-50 transition-opacity" />
</Transition.Child>

<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform rounded-lg border border-custom-border-200 bg-custom-background-100 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-2xl p-5">
<CycleForm handleFormSubmit={formSubmit} handleClose={modalClose} data={cycle} />
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
);
});
Loading
Loading