ui: Move locked themes at the end of the list

This commit is contained in:
nemunaire 2023-04-03 23:16:28 +02:00
parent 4d7161281d
commit 0a7b40abd7

View file

@ -33,7 +33,8 @@ export const themes = derived(
} }
const size = arr.length; const size = arr.length;
const rng = new seedrandom($my && $my.team_id ? $my.team_id : 0); const rng = new seedrandom($my && $my.team_id ? $my.team_id : 0);
const resp = []; const respD = [];
const respE = [];
const keys = []; const keys = [];
for(let i=0;i<size;i++) keys.push(i); for(let i=0;i<size;i++) keys.push(i);
@ -41,10 +42,14 @@ export const themes = derived(
const r = Math.floor(rng() * keys.length); const r = Math.floor(rng() * keys.length);
const g = keys[r]; const g = keys[r];
keys.splice(r,1); keys.splice(r,1);
resp.push(arr[g]); if (arr[g].locked) {
respD.push(arr[g]);
} else {
respE.push(arr[g]);
}
} }
return resp; return respE.concat(respD);
}, },
); );