Skip to content

Commit

Permalink
Deploy preview for PR 27 🛫
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jun 6, 2024
1 parent dcf8537 commit 737ab95
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions pr-preview/pr-27/css/filter.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
#filters {
display: flex;
flex-direction: column;
padding: 10px 0;
}
2 changes: 0 additions & 2 deletions pr-preview/pr-27/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 3 additions & 7 deletions pr-preview/pr-27/js/menu/filter/builders.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
15 changes: 8 additions & 7 deletions pr-preview/pr-27/js/menu/filter/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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) {
Expand Down

0 comments on commit 737ab95

Please sign in to comment.