[WEB-2192] fix: order of state groups in space app (#5317)
* chore: added sequence in the states endpoint * fix state grouping order in space app --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
parent
806eae0139
commit
91142659ca
4 changed files with 33 additions and 12 deletions
13
space/helpers/state.helper.ts
Normal file
13
space/helpers/state.helper.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { IState } from "@plane/types";
|
||||
import { STATE_GROUPS } from "@/constants/state";
|
||||
|
||||
export const sortStates = (states: IState[]) => {
|
||||
if (!states || states.length === 0) return;
|
||||
|
||||
return states.sort((stateA, stateB) => {
|
||||
if (stateA.group === stateB.group) {
|
||||
return stateA.sequence - stateB.sequence;
|
||||
}
|
||||
return Object.keys(STATE_GROUPS).indexOf(stateA.group) - Object.keys(STATE_GROUPS).indexOf(stateB.group);
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue