mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
8e3541b947
* feat: label grouping, fix: new states response * fix: mutation of states
19 lines
616 B
TypeScript
19 lines
616 B
TypeScript
// types
|
|
import { IState, StateResponse } from "types";
|
|
|
|
export const orderStateGroups = (unorderedStateGroups: StateResponse) =>
|
|
Object.assign(
|
|
{ backlog: [], unstarted: [], started: [], completed: [], cancelled: [] },
|
|
unorderedStateGroups
|
|
);
|
|
|
|
export const getStatesList = (stateGroups: any): IState[] => {
|
|
// order the unordered state groups first
|
|
const orderedStateGroups = orderStateGroups(stateGroups);
|
|
|
|
// extract states from the groups and return them
|
|
return Object.keys(orderedStateGroups)
|
|
.map((group) => [...orderedStateGroups[group].map((state: IState) => state)])
|
|
.flat();
|
|
};
|