From f0308a9f8363e401e025017b7df31e259c8b97be Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Fri, 22 May 2020 11:43:21 +0200 Subject: [PATCH] fix column style for penthouse cell --- src/arcologyBuilding/penthouse.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/arcologyBuilding/penthouse.js b/src/arcologyBuilding/penthouse.js index 455991f5b29..f4d9e75ca14 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; -- GitLab