From 737ab955096b34f766fc6db969e29afe04c1b571 Mon Sep 17 00:00:00 2001 From: brauliorivas Date: Thu, 6 Jun 2024 21:12:36 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20preview=20for=20PR=2027=20=F0=9F=9B=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr-preview/pr-27/css/filter.css | 1 + pr-preview/pr-27/js/main.js | 2 -- pr-preview/pr-27/js/menu/filter/builders.js | 10 +++------- pr-preview/pr-27/js/menu/filter/filter.js | 15 ++++++++------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/pr-preview/pr-27/css/filter.css b/pr-preview/pr-27/css/filter.css index 6c747c48..b12f8d46 100644 --- a/pr-preview/pr-27/css/filter.css +++ b/pr-preview/pr-27/css/filter.css @@ -33,4 +33,5 @@ #filters { display: flex; flex-direction: column; + padding: 10px 0; } diff --git a/pr-preview/pr-27/js/main.js b/pr-preview/pr-27/js/main.js index 586613a8..3187794d 100644 --- a/pr-preview/pr-27/js/main.js +++ b/pr-preview/pr-27/js/main.js @@ -211,10 +211,8 @@ document const { infoBoxes } = currentParticles; infoBoxes.forEach((infoBox) => { - bits.add(infoBox.simStatus); genStatus.add(infoBox.genStatus); }); - bits.setCheckBoxes(); genStatus.setCheckBoxes(); renderRangeParameters(filters, parametersRange); const width = getWidthFilterContent(); diff --git a/pr-preview/pr-27/js/menu/filter/builders.js b/pr-preview/pr-27/js/menu/filter/builders.js index b324427e..8ad90615 100644 --- a/pr-preview/pr-27/js/menu/filter/builders.js +++ b/pr-preview/pr-27/js/menu/filter/builders.js @@ -21,6 +21,7 @@ export class CheckboxBuilder { render(container) { const section = document.createElement("div"); + section.style.maxWidth = "fit-content"; this.checkBoxes.forEach((checkbox) => (checkbox.checked = false)); const title = document.createElement("p"); title.textContent = this.fullName; @@ -42,13 +43,8 @@ export class BitFieldBuilder extends CheckboxBuilder { } setCheckBoxes() { - this.checkBoxes = Array.from(this.uniqueValues).map( - (option) => - new BitfieldCheckbox( - this.name, - option, - BitfieldCheckbox.getDisplayValue(this.dictionary, option) - ) + this.checkBoxes = Object.entries(this.dictionary).map( + ([key, value]) => new BitfieldCheckbox(this.name, key, value) ); this.checkBoxes.sort((a, b) => a.value - b.value); } diff --git a/pr-preview/pr-27/js/menu/filter/filter.js b/pr-preview/pr-27/js/menu/filter/filter.js index 4268a755..8399e8fb 100644 --- a/pr-preview/pr-27/js/menu/filter/filter.js +++ b/pr-preview/pr-27/js/menu/filter/filter.js @@ -63,17 +63,16 @@ export function getWidthFilterContent() { export function renderGenSim(sim, gen, container) { const div = document.createElement("div"); - div.style.display = "grid"; + div.style.display = "flex"; + div.style.flexDirection = "column"; div.style.width = "fit-content"; - div.style.columnGap = "10px"; - div.style.rowGap = "5px"; div.style.alignItems = "start"; - div.style.gridTemplateColumns = "fit-content(100%) fit-content(100%)"; sim.render(div); gen.render(div); container.appendChild(div); } +// TODO: Check in the future for other types of particles let parametersRange = [ { property: "momentum", @@ -103,7 +102,7 @@ parametersRange = parametersRange.sort((a, b) => parametersRange = parametersRange.map((parameter) => new Range(parameter)); -const bitFieldDisplayValues = { +const SimStatusBitFieldDisplayValues = { 23: "Overlay", 24: "Stopped", 25: "LeftDetector", @@ -116,9 +115,11 @@ const bitFieldDisplayValues = { const bits = new BitFieldBuilder( "simStatus", - "Simulator status", - bitFieldDisplayValues + "Simulation status", + SimStatusBitFieldDisplayValues ); +bits.setCheckBoxes(); + const genStatus = new CheckboxBuilder("genStatus", "Generator status"); function applyFilter(particlesHandler, currentParticles, visibleParticles) {