bb-plane-fork/web/core/components/project-states/root.tsx
guru_sainath 38f8aa90c1
[WEB-1519] chore: update component structure in project state settings and implement DND (#5043)
* chore: updated project settings state

* chore: updated sorting on project state

* chore: updated grab handler in state item

* chore: Updated UI and added garb handler icon

* chore: handled top and bottom sequence in middle element swap

* chore: handled input state element char limit to 100

* chore: typos and code cleanup in create state

* chore: handled typos and comments wherever is required

* chore: handled sorting logic
2024-07-05 16:09:33 +05:30

34 lines
993 B
TypeScript

"use client";
import { FC } from "react";
import { observer } from "mobx-react";
import useSWR from "swr";
// components
import { ProjectStateLoader, GroupList } from "@/components/project-states";
// hooks
import { useProjectState } from "@/hooks/store";
type TProjectState = {
workspaceSlug: string;
projectId: string;
};
export const ProjectStateRoot: FC<TProjectState> = observer((props) => {
const { workspaceSlug, projectId } = props;
// hooks
const { groupedProjectStates, fetchProjectStates } = useProjectState();
useSWR(
workspaceSlug && projectId ? `PROJECT_STATES_${workspaceSlug}_${projectId}` : null,
workspaceSlug && projectId ? () => fetchProjectStates(workspaceSlug.toString(), projectId.toString()) : null
);
// Loader
if (!groupedProjectStates) return <ProjectStateLoader />;
return (
<div className="py-3">
<GroupList workspaceSlug={workspaceSlug} projectId={projectId} groupedStates={groupedProjectStates} />
</div>
);
});