Skip to content
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

CLDR-16844 Remember whether the user wants the Info Panel #3865

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions tools/cldr-apps/js/src/esm/cldrInfo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@ let neighborId = null;
let buttonClass = null;

let panelInitialized = false;

/**
* Is the Info Panel currently displayed?
*/
let panelVisible = false;

/**
* Does the user want the Info Panel to be displayed when appropriate?
* The panel is hidden automatically when there is a "special" view for which
* the panel is inappropriate. When returning to the non-special vetting view,
* the panel should be displayed again, unless the user has indicated, by clicking
* its close box, that they don't want to see it.
*/
let panelWanted = true;

let unShow = null;

let selectedItemWrapper = null;
Expand Down Expand Up @@ -113,16 +126,26 @@ function appendDiv(el, id) {
el.appendChild(div);
}

/**
* Open the Info Panel
*/
function openPanel() {
if (!panelVisible) {
panelVisible = true;
panelVisible = panelWanted = true;
openOrClosePanel();
}
}

function closePanel() {
/**
* Close the Info Panel
*
* @param {Boolean} userWantsHidden true if closing because user clicked close box (or equivalent),
* false if closing because switching to a "special" view where the Info Panel doesn't belong
*/
function closePanel(userWantsHidden) {
if (panelVisible) {
panelVisible = false;
panelWanted = !userWantsHidden;
openOrClosePanel();
}
}
Expand Down Expand Up @@ -192,7 +215,7 @@ function panelShouldBeShown() {
// Leave panelVisible = false until openPanel makes it true.
return true;
}
return panelVisible;
return panelWanted && !cldrStatus.getCurrentSpecial();
}

/**
Expand Down
Loading