feat: add action row for challenges with ERMs on desktop (#39377)
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
69e3e138f6
commit
a1a051bd3a
14
client/src/templates/Challenges/utils/getTargetEditor.js
Normal file
14
client/src/templates/Challenges/utils/getTargetEditor.js
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user