Files
plane/web/ee/constants/workspace-project-states.ts
guru_sainath 3e4fa21ee2 [WEB-1986] Feat: Project Grouping (#715)
* feat: project grouping migrations

* chore: implemented workspace features

* chore: updated worksapce feature import in types

* chore: project states endpoint

* chore: updated migration file

* chore: migration file changes

* chore: workspace project states

* feat: project states

* fix: project states

* chore: replaced base modal with project base modal in project attribute

* chore: removed 002 migration

* chore: project attribute migration

* chore: project states feature flagged

* chore: project state marking as default

* chore: code cleanup

* chore: updated the project attributes operations in the project crud endpoints

* fix: wip

* chore: feature flag validation on project create and update.

* fix: sync develope

* dev: project state feature flag and removed read only fields from serializer

* wip

* chore: updated project id and project validation when we toggle the workspace project_grouping feature is true

* wip: layouts

* chore: updated project filter store

* wip: default screens

* chore: filters update

* chore: filters updates

* chore: display filter updates

* wip: state dropdown

* chore: seperated project components for CE

* chore: splitted the code for project creation form

* fix: code structure optimization

* chore: handled project filters

* wip: gallery layout for projects

* wip: spreadsheet filters

* chore: added state and priority filters

* fix: project page root moved

* fix: synced with preview

* dev: updated sorting

* wip: role based permissions

* fix: header sorting fixed

* fix: project types + state filter

* fix: optimizations

* fix: optimizations

* fix: partial feature flagging

* fix: project states

* fix: css

* fix: css foxes

* fix:

* chore: handled board layout in project grouping

* fix: post ce sync changes

* fix: gantt permissions + member bugs

* fix: mobile header + layout fixes

* fix: workspace sidebar + archives

* fix: build errors

* fix: dark theme handling

* fix: archive fix + miscellaneous

* Fix: build errors

* fix: kandban drag and drop + miscellaneous

* fix: kanban drag and drop

* fix: imports

* fix: drag & drop + project dropdown

* fix: merge changes

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
Co-authored-by: gakshita <akshitagoyal1516@gmail.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2024-08-12 21:08:16 +05:30

70 lines
1.8 KiB
TypeScript

// plane web types
import {
EProjectStateGroup,
TProjectState,
TProjectStateDraggableData,
TProjectStateGroupKey,
} from "@/plane-web/types/workspace-project-states";
export const WORKSPACE_PROJECT_STATE_GROUPS: {
[key in TProjectStateGroupKey]: {
title: string;
color: string;
};
} = {
[EProjectStateGroup.DRAFT]: {
title: "Draft",
color: "#8B8D98",
},
[EProjectStateGroup.PLANNING]: {
title: "Planning",
color: "#80838D",
},
[EProjectStateGroup.EXECUTION]: {
title: "Execution",
color: "#FFBA18",
},
[EProjectStateGroup.MONITORING]: {
title: "Monitoring",
color: "#3E63DD",
},
[EProjectStateGroup.COMPLETED]: {
title: "Completed",
color: "#3E9B4F",
},
[EProjectStateGroup.CANCELLED]: {
title: "Cancelled",
color: "#DC3E42",
},
};
export const getCurrentStateSequence = (
groupSates: TProjectState[],
destinationData: TProjectStateDraggableData,
edge: string | undefined
) => {
const defaultSequence = 65535;
if (!edge) return defaultSequence;
const destinationStateIndex = groupSates.findIndex((state) => state.id === destinationData.id);
const destinationStateSequence = groupSates[destinationStateIndex]?.sequence || undefined;
if (!destinationStateSequence) return defaultSequence;
if (edge === "top") {
const prevStateSequence = groupSates[destinationStateIndex - 1]?.sequence || undefined;
if (prevStateSequence === undefined) {
return destinationStateSequence - defaultSequence;
}
return (destinationStateSequence + prevStateSequence) / 2;
} else if (edge === "bottom") {
const nextStateSequence = groupSates[destinationStateIndex + 1]?.sequence || undefined;
if (nextStateSequence === undefined) {
return destinationStateSequence + defaultSequence;
}
return (destinationStateSequence + nextStateSequence) / 2;
}
};