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:
abe
2023-02-06 01:18:46 -06:00
committed by GitHub
parent 4b8d4c495b
commit 4494b0c05b
11 changed files with 199 additions and 54 deletions
@@ -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(