-
-
Notifications
You must be signed in to change notification settings - Fork 37.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(modern-challenges): Default nav link to "Editor" if only one editor #16570
fix(modern-challenges): Default nav link to "Editor" if only one editor #16570
Conversation
} | ||
return { | ||
nameToFileKey: _.reduce(files, (map, file) => { | ||
map['Editor'] = file.key; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@werne2j updated the pull request. |
}) | ||
files => { | ||
if (Object.keys(files).length === 1) { | ||
return { nameToFileKey: { Editor: files[Object.keys(files)[0]].key }}; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@werne2j updated the pull request. |
1 similar comment
@werne2j updated the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @werne2j, with @BerkeleyTrue's suggested changes, this LGTM, but I'll let him take a final look before merging this is.
[types.toggleSidePanel]: 'Lesson' | ||
}); | ||
[types.toggleSidePanel]: 'Lesson', | ||
[`${types.toggleModernEditor}(${getFirstFileKey(files)})`]: 'Editor' |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@werne2j updated the pull request. |
@@ -18,18 +18,26 @@ import { filesSelector } from '../../../../files'; | |||
const createModernEditorToggleType = fileKey => | |||
types.toggleModernEditor + `(${fileKey})`; | |||
|
|||
const getFirstFileKey = object => | |||
_.flow(_.values, _.first, _.property('key'))(object); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
_.forEach(files, (file) => { | ||
panesMap[createModernEditorToggleType(file.fileKey)] = file.name; | ||
}); | ||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return map; | ||
}, { | ||
|
||
let panesMap = { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@werne2j updated the pull request. |
💥 nice work!! Happy Coding |
Pre-Submission Checklist
staging
branch of freeCodeCamp.fix/
,feature/
, ortranslate/
(e.g.fix/signin-issue
)npm test
. Usegit commit --amend
to amend any fixes.Type of Change
Checklist:
Closes #16529
Description
For Modern Challenges when there is only one editor we want to default the nav link to display
Editor
instead of the filename. When there is more than one file then we will display the filename in the nav link