(function () {
"use strict";
var TAB_SWITCH_PROMPTS = [
{ key: "LB", label: "Prev Tab" },
{ key: "RB", label: "Next Tab" }
];
function renderIcon(key) {
if (window.CO_ControllerIcons && CO_ControllerIcons.render) {
return CO_ControllerIcons.render(key);
}
return '' + key + "";
}
window.CO_ControllerPrompts = {
render: function (root, state) {
var el = root.querySelector(".co-prompts");
if (!el) return;
var prompts = CO_ControllerPrompts.getPrompts(state);
el.innerHTML = prompts.map(function (p) {
return (
'
' +
renderIcon(p.key) +
"" + p.label + "" +
"
"
);
}).join("");
if (window.CO_ControllerGlyphs && CO_ControllerGlyphs.hydrate) {
CO_ControllerGlyphs.hydrate(el);
}
},
getPrompts: function (state) {
if (state.joinOverlay) {
if (state.joinOverlay.error) {
return [
{ key: "B", label: "Dismiss" },
{ key: "A", label: "Dismiss" }
];
}
return [];
}
if (state.activeTab === "direct-connect") {
return TAB_SWITCH_PROMPTS.concat([
{ key: "A", label: "Connect" },
{ key: "B", label: "Back" }
]);
}
if (state.focusZone === "filters") {
var isReset = state.selectedFilterIndex === CO_Filters.FILTER_ROWS.length;
return TAB_SWITCH_PROMPTS.concat([
{ key: "A", label: isReset ? "Reset" : "Change" },
{ key: "B", label: "Back" }
]);
}
if (state.focusZone === "tabs") {
return TAB_SWITCH_PROMPTS.concat([
{ key: "B", label: "Back" }
]);
}
return TAB_SWITCH_PROMPTS.concat([
{ key: "A", label: "Join" },
{ key: "X", label: "Refresh" },
{ key: "Y", label: "Favorite" },
{ key: "B", label: "Back" }
]);
}
};
})();