diff --git a/src/arcologyBuilding/penthouse.js b/src/arcologyBuilding/penthouse.js index 455991f5b298c7850cfd389da9386e59e5d3998e..f4d9e75ca14cfddc5bb908064c603dc88f2c4463 100644 --- a/src/arcologyBuilding/penthouse.js +++ b/src/arcologyBuilding/penthouse.js @@ -34,8 +34,7 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { fragment.append(link, " ", hotkey); } - let wrapper = getWrapper(fragment); - + const wrapper = getWrapper(fragment); const fcs = App.Entity.facilities; /** @@ -44,12 +43,11 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { */ function addFacility(facility, passageName) { if (facility.established) { - wrapper.append(createFacilityDiv( - App.UI.DOM.passageLink(facility.UIName, passageName || facility.genericName))); const report = facility.occupancyReport(false); - if (report !== "") { - wrapper.append(`(${report})`); - } + wrapper.append(createFacilityDiv( + App.UI.DOM.passageLink(facility.UIName, passageName || facility.genericName), + report ? `(${report})` : null + )); } } @@ -97,19 +95,21 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { /** * * @param {HTMLElement} link - * @param {(Node|string)} content + * @param {(Node|string)} [content] * @returns {HTMLDivElement} */ - function createFacilityDiv(link, ...content) { + function createFacilityDiv(link, content) { const div = document.createElement("div"); div.append(link); // in collapsed mode additional information needs to be in it's own div to stop linebreaks at weird places if (V.verticalizeArcologyLinks === 0) { div.classList.add("collapsed"); - div.append(" ", ...content); - } else { + if (content) { + div.append(" ", content); + } + } else if (content) { const innerDiv = document.createElement("div"); - innerDiv.append(...content); + innerDiv.append(content); div.append(" ", innerDiv); } return div;