mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(UI): keep portal preview open (#48451)
* moved portal states to redux
stored a global window
open window if does not exist clear htmlif already exists
moved close window to desktop-layout
close portal if user navigates to route outside of challenges
naming conventions, specify url
dispatch setIsAdvancing and use in portal preview
* fix: close portal if main window closes
* fix: refactor it
* Revert "fix: refactor it"
This reverts commit 197a40a3a6.
* feat: add isAdvancing to hotkeys
* fix: revert to pane on first step of block
* fix: safari issues
* fix: revert to pane when not advancing
---------
Co-authored-by: kravmaguy <flex4lease@gmail.com>
Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@@ -48,6 +48,14 @@ const views = {
|
||||
// quiz: Quiz
|
||||
};
|
||||
|
||||
function getIsFirstStep(_node, index, nodeArray) {
|
||||
const current = nodeArray[index];
|
||||
const previous = nodeArray[index - 1];
|
||||
|
||||
if (!previous) return true;
|
||||
return previous.node.challenge.block !== current.node.challenge.block;
|
||||
}
|
||||
|
||||
function getNextChallengePath(_node, index, nodeArray) {
|
||||
const next = nodeArray[index + 1];
|
||||
return next ? next.node.challenge.fields.slug : '/learn';
|
||||
@@ -85,6 +93,7 @@ exports.createChallengePages = function (createPage) {
|
||||
certification,
|
||||
superBlock,
|
||||
block,
|
||||
isFirstStep: getIsFirstStep(challenge, index, allChallengeEdges),
|
||||
template,
|
||||
required,
|
||||
nextChallengePath: getNextChallengePath(
|
||||
|
||||
Reference in New Issue
Block a user