feat: add action row for challenges with ERMs on desktop (#39377)

This commit is contained in:
Ahmad Abdolsaheb
2020-08-12 13:11:17 +03:00
committed by Mrugesh Mohapatra
parent 69e3e138f6
commit a1a051bd3a
11 changed files with 267 additions and 177 deletions

View File

@@ -0,0 +1,14 @@
import { toSortedArray } from '../../../../../utils/sort-files';
import { isEmpty } from 'lodash';
export function getTargetEditor(challengeFiles) {
if (isEmpty(challengeFiles)) return null;
else {
let targetEditor = Object.values(challengeFiles).find(
({ editableRegionBoundaries }) => !isEmpty(editableRegionBoundaries)
)?.key;
// fallback for when there is no editable region.
return targetEditor || toSortedArray(challengeFiles)[0].key;
}
}