Skip to content

Commit

Permalink
Merge pull request #56 from brauliorivas/feat/switch-deploy
Browse files Browse the repository at this point in the history
Add switcher between release and main
  • Loading branch information
brauliorivas authored Jul 17, 2024
2 parents 0270a1d + ddefeb3 commit c578a9b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
32 changes: 32 additions & 0 deletions css/switch-deploy.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#switch-deploy {
position: fixed;
left: 10px;
bottom: 10px;
display: flex;
flex-direction: row;
align-items: center;
z-index: 1;
background-color: #fff;
padding: 5px;
border-radius: 5px;
border: 1px solid #000;
}

#switch-deploy-button {
cursor: pointer;
background-color: #fff;
border: 1px solid #000;
padding: 5px;
border-radius: 5px;
font-family: sans-serif;
font-size: 14px;
}

#switch-deploy-button:hover {
background-color: #c5c5c5;
cursor: pointer;
}

#switch-deploy-text {
margin: 0 7px 0 0;
}
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<link rel="stylesheet" href="css/information.css">
<link rel="stylesheet" href="css/contact.css">
<link rel="stylesheet" href="css/views.css">
<link rel="stylesheet" href="css/switch-deploy.css">
</head>

<body>
Expand Down Expand Up @@ -155,13 +156,19 @@
<div id="view-selector" class="view-selector-menu"></div>
</div>

<div id="switch-deploy">
<p id="switch-deploy-text">Switch to</p>
<button id="switch-deploy-button">release</button>
</div>

<canvas id="canvas" width="100vw" height="100vh"></canvas>

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js" type="text/javascript"></script>
<script type="module" src="js/main.js"></script>
<script type="module" src="js/information.js"></script>
<script type="module" src="js/views/views.js"></script>
<script type="module" src="js/menu/filter/filter.js"></script>
<script type="module" src="js/switch-deploy.js"></script>
</body>

</html>
7 changes: 7 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function showViewsMenu() {
viewsMenu.style.display = "flex";
}

function hideDeploySwitch() {
const deploySwitch = document.getElementById("switch-deploy");

deploySwitch.style.display = "none";
}

document.getElementById("input-file").addEventListener("change", (event) => {
for (const file of event.target.files) {
if (!file.name.endsWith("edm4hep.json")) {
Expand Down Expand Up @@ -135,6 +141,7 @@ document
showEventSwitcher();
showViewsMenu();
renderEvent(eventNum);
hideDeploySwitch();
});

export { canvas, ctx, jsonData, selectedObjectTypes };
18 changes: 18 additions & 0 deletions js/switch-deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const button = document.getElementById("switch-deploy-button");

button.addEventListener("click", () => {
const currentUrl = window.location.href;

if (currentUrl.includes("/release")) {
window.location.href = currentUrl.replace("/release", "/main");
} else {
window.location.href = "https://key4hep.github.io/eede/release/index.html";
}
});

const url = window.location.href;
if (url.includes("/release")) {
button.innerText = "Develop";
} else {
button.innerText = "Release";
}

0 comments on commit c578a9b

Please sign in to comment.