From 3d93f2973ceb7a0c76c1be3ee0718214562d485c Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Thu, 11 Jul 2024 19:33:10 -0500 Subject: [PATCH 1/6] add switcher between release and main --- css/switch-deploy.css | 23 +++++++++++++++++++++++ index.html | 6 ++++++ js/switch-deploy.js | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 css/switch-deploy.css create mode 100644 js/switch-deploy.js diff --git a/css/switch-deploy.css b/css/switch-deploy.css new file mode 100644 index 00000000..5f496930 --- /dev/null +++ b/css/switch-deploy.css @@ -0,0 +1,23 @@ +#switch-deploy { + display: flex; + flex-direction: row; + align-items: center; +} + +#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; +} + +#switch-deploy-text { + margin: 0 10px 0 0; +} diff --git a/index.html b/index.html index 3cb6744e..700ccfbf 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ + @@ -148,6 +149,10 @@ +
+

Switch to

+ +
@@ -162,6 +167,7 @@ + \ No newline at end of file diff --git a/js/switch-deploy.js b/js/switch-deploy.js new file mode 100644 index 00000000..445ae82b --- /dev/null +++ b/js/switch-deploy.js @@ -0,0 +1,22 @@ +const button = document.getElementById("switch-deploy-button"); + +button.addEventListener("click", () => { + const currentUrl = window.location.href; + + if (currentUrl.includes("/main")) { + window.location.href = currentUrl.replace("/main", "/release"); + } else 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("/main")) { + button.innerText = "Release"; +} else if (url.includes("/release")) { + button.innerText = "Main"; +} else { + button.innerText = "Release"; +} From fa4fbbd30fd9eebf8ab50186c732d1c7a21bf2b2 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Fri, 12 Jul 2024 10:19:02 -0500 Subject: [PATCH 2/6] show switcher on home page instead of modal --- css/switch-deploy.css | 11 ++++++++++- index.html | 9 +++++---- js/main.js | 7 +++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/css/switch-deploy.css b/css/switch-deploy.css index 5f496930..dea8a671 100644 --- a/css/switch-deploy.css +++ b/css/switch-deploy.css @@ -1,7 +1,15 @@ #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 { @@ -16,8 +24,9 @@ #switch-deploy-button:hover { background-color: #c5c5c5; + cursor: pointer; } #switch-deploy-text { - margin: 0 10px 0 0; + margin: 0 7px 0 0; } diff --git a/index.html b/index.html index 700ccfbf..48d7fdab 100644 --- a/index.html +++ b/index.html @@ -149,10 +149,6 @@
-
-

Switch to

- -
@@ -160,6 +156,11 @@
+
+

Switch to

+ +
+ diff --git a/js/main.js b/js/main.js index 192fcd09..176a5e2f 100644 --- a/js/main.js +++ b/js/main.js @@ -41,6 +41,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")) { @@ -133,6 +139,7 @@ document showEventSwitcher(); showViewsMenu(); renderEvent(eventNum); + hideDeploySwitch(); }); export { canvas, ctx, jsonData, selectedObjectTypes }; From c8ad0fdc2054c6f249cac58343f3735b01079f6a Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Thu, 11 Jul 2024 19:33:10 -0500 Subject: [PATCH 3/6] add switcher between release and main --- css/switch-deploy.css | 23 +++++++++++++++++++++++ index.html | 6 ++++++ js/switch-deploy.js | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 css/switch-deploy.css create mode 100644 js/switch-deploy.js diff --git a/css/switch-deploy.css b/css/switch-deploy.css new file mode 100644 index 00000000..5f496930 --- /dev/null +++ b/css/switch-deploy.css @@ -0,0 +1,23 @@ +#switch-deploy { + display: flex; + flex-direction: row; + align-items: center; +} + +#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; +} + +#switch-deploy-text { + margin: 0 10px 0 0; +} diff --git a/index.html b/index.html index 3cb6744e..700ccfbf 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ + @@ -148,6 +149,10 @@ +
+

Switch to

+ +
@@ -162,6 +167,7 @@ + \ No newline at end of file diff --git a/js/switch-deploy.js b/js/switch-deploy.js new file mode 100644 index 00000000..445ae82b --- /dev/null +++ b/js/switch-deploy.js @@ -0,0 +1,22 @@ +const button = document.getElementById("switch-deploy-button"); + +button.addEventListener("click", () => { + const currentUrl = window.location.href; + + if (currentUrl.includes("/main")) { + window.location.href = currentUrl.replace("/main", "/release"); + } else 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("/main")) { + button.innerText = "Release"; +} else if (url.includes("/release")) { + button.innerText = "Main"; +} else { + button.innerText = "Release"; +} From a588bfdde27fc58b2cc545e142d596290d7b8f94 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Fri, 12 Jul 2024 10:19:02 -0500 Subject: [PATCH 4/6] show switcher on home page instead of modal --- css/switch-deploy.css | 11 ++++++++++- index.html | 9 +++++---- js/main.js | 7 +++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/css/switch-deploy.css b/css/switch-deploy.css index 5f496930..dea8a671 100644 --- a/css/switch-deploy.css +++ b/css/switch-deploy.css @@ -1,7 +1,15 @@ #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 { @@ -16,8 +24,9 @@ #switch-deploy-button:hover { background-color: #c5c5c5; + cursor: pointer; } #switch-deploy-text { - margin: 0 10px 0 0; + margin: 0 7px 0 0; } diff --git a/index.html b/index.html index 700ccfbf..48d7fdab 100644 --- a/index.html +++ b/index.html @@ -149,10 +149,6 @@
-
-

Switch to

- -
@@ -160,6 +156,11 @@
+
+

Switch to

+ +
+ diff --git a/js/main.js b/js/main.js index e9ab8b74..2dd779e9 100644 --- a/js/main.js +++ b/js/main.js @@ -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")) { @@ -135,6 +141,7 @@ document showEventSwitcher(); showViewsMenu(); renderEvent(eventNum); + hideDeploySwitch(); }); export { canvas, ctx, jsonData, selectedObjectTypes }; From b9d7f732ec12000f21991dce6526436ddc193c82 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Mon, 15 Jul 2024 17:10:38 -0500 Subject: [PATCH 5/6] simplify if statement --- js/switch-deploy.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/switch-deploy.js b/js/switch-deploy.js index 445ae82b..d69e70b3 100644 --- a/js/switch-deploy.js +++ b/js/switch-deploy.js @@ -3,9 +3,7 @@ const button = document.getElementById("switch-deploy-button"); button.addEventListener("click", () => { const currentUrl = window.location.href; - if (currentUrl.includes("/main")) { - window.location.href = currentUrl.replace("/main", "/release"); - } else if (currentUrl.includes("/release")) { + if (currentUrl.includes("/release")) { window.location.href = currentUrl.replace("/release", "/main"); } else { window.location.href = "https://key4hep.github.io/eede/release/index.html"; @@ -13,9 +11,7 @@ button.addEventListener("click", () => { }); const url = window.location.href; -if (url.includes("/main")) { - button.innerText = "Release"; -} else if (url.includes("/release")) { +if (url.includes("/release")) { button.innerText = "Main"; } else { button.innerText = "Release"; From 5f881c46eccb0bc244f0af205b4e60aa0b0738a1 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Mon, 15 Jul 2024 17:12:31 -0500 Subject: [PATCH 6/6] rename main to develop --- js/switch-deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/switch-deploy.js b/js/switch-deploy.js index d69e70b3..24fb9009 100644 --- a/js/switch-deploy.js +++ b/js/switch-deploy.js @@ -12,7 +12,7 @@ button.addEventListener("click", () => { const url = window.location.href; if (url.includes("/release")) { - button.innerText = "Main"; + button.innerText = "Develop"; } else { button.innerText = "Release"; }