* fix(client): fix client * fix propType and add comment * revert user.json prettification * slight type refactor and payload correction Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * update ChallengeFile type imports * add cypress test for code-storage * update test and storage epic * fix Shaun's tired brain's logic * refactor with suggestions Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * update codeReset * increate cypress timeout because firefox is slow * remove unused import to make linter happy * use focus on editor Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * use more specific seletor for cypress editor test * account for silly null challengeFiles Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
16 lines
457 B
JavaScript
16 lines
457 B
JavaScript
exports.toSortedArray = function toSortedArray(challengeFiles) {
|
|
const xs = challengeFiles;
|
|
// TODO: refactor this to use an ext array ['html', 'js', 'css'] and loop over
|
|
// that.
|
|
xs.sort((a, b) => {
|
|
if (a.ext === 'html') return -1;
|
|
if (b.ext === 'html') return 1;
|
|
if (a.ext === 'jsx') return -1;
|
|
if (b.ext === 'jsx') return 1;
|
|
if (a.ext === 'js') return -1;
|
|
if (b.ext === 'js') return 1;
|
|
return 0;
|
|
});
|
|
return xs;
|
|
};
|