Skip to content
Snippets Groups Projects
Commit 7e81177c authored by Jakob Yanagibashi's avatar Jakob Yanagibashi
Browse files

Output version info to about modal

parent 30fbcd10
No related branches found
No related tags found
No related merge requests found
Pipeline #258280 passed
...@@ -156,6 +156,16 @@ article#tools-list-buttons { ...@@ -156,6 +156,16 @@ article#tools-list-buttons {
height: 2.5rem; height: 2.5rem;
} }
#helpDialog ul {
list-style-type: none;
padding: 0;
}
#helpDialog ul > li > span.helpControlText {
position: absolute;
left: 3rem;
}
/* Zdog */ /* Zdog */
.zdog-canvas { .zdog-canvas {
......
...@@ -9,6 +9,20 @@ import * as Zdog from "zdog"; ...@@ -9,6 +9,20 @@ import * as Zdog from "zdog";
import "@fortawesome/fontawesome-free/css/fontawesome.css"; import "@fortawesome/fontawesome-free/css/fontawesome.css";
import "@fortawesome/fontawesome-free/css/solid.css"; import "@fortawesome/fontawesome-free/css/solid.css";
var aboutText = `
</h1>
<p>Version: ${ import.meta.env.VITE_APP_DATE }
(${ import.meta.env.VITE_APP_HASH })</p>
`;
if (import.meta.env.VITE_APP_BRANCH == "dev") {
aboutText = `
<i class="fa-solid fa-kiwi-bird fa-bounce"></i> BETA</h1>
<p>Version: ${ import.meta.env.VITE_APP_DATE }
(${ import.meta.env.VITE_APP_BRANCH }
${ import.meta.env.VITE_APP_HASH })</p>
`;
}
document.querySelector("#app").innerHTML = ` document.querySelector("#app").innerHTML = `
<main> <main>
<section id="viewer"> <section id="viewer">
...@@ -106,15 +120,14 @@ document.querySelector("#app").innerHTML = ` ...@@ -106,15 +120,14 @@ document.querySelector("#app").innerHTML = `
<!-- Dialogs --> <!-- Dialogs -->
<dialog id="helpDialog"> <dialog id="helpDialog">
<h1>Tailorbird 3D</h1> <h1>Tailorbird 3D ${ aboutText }
<p>${ new Date().toISOString() }</p> <h2><i class="fa-solid fa-keyboard"></i> Controls</h2>
<h2>Controls</h2>
<p> <p>
<ul> <ul>
<li>Zoom: Scroll wheel</li> <li><i class="fa-solid fa-magnifying-glass"></i> <span class="helpControlText">Zoom: Scroll wheel</span></li>
<li>Drag: Rotate horizontally</li> <li><i class="fa-solid fa-left-right"></i> <span class="helpControlText">Rotate horizontally: Drag</span></li>
<li>Shift+Drag: Rotate vertically</li> <li><i class="fa-solid fa-up-down"></i> <span class="helpControlText">Rotate vertically: Shift+Drag</span></li>
<li>Opt/Alt+Drag: Move</li> <li><i class="fa-solid fa-up-down-left-right"></i> <span class="helpControlText">Move: Opt/Alt+Drag</span></li>
</ul> </ul>
</p> </p>
<form method="dialog"> <form method="dialog">
...@@ -874,9 +887,9 @@ G28 ...@@ -874,9 +887,9 @@ G28
document document
.getElementById("settingsDialog") .getElementById("settingsDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Apply button was pressed // Check if Apply button was pressed
if (event.target.returnValue != "apply") return; if (e.target.returnValue != "apply") return;
const data = new FormData(document.querySelector("#settingsForm")); const data = new FormData(document.querySelector("#settingsForm"));
// Grid display // Grid display
...@@ -918,18 +931,18 @@ G28 ...@@ -918,18 +931,18 @@ G28
document document
.getElementById("saveDialog") .getElementById("saveDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Load button was pressed // Check if Load button was pressed
if (event.target.returnValue != "save") return; if (e.target.returnValue != "save") return;
const inputEl = document.getElementById("saveDialogInput"); const inputEl = document.getElementById("saveDialogInput");
saveProject(inputEl.value); saveProject(inputEl.value);
}); });
document document
.getElementById("loadDialog") .getElementById("loadDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Load button was pressed // Check if Load button was pressed
if (event.target.returnValue != "load") return; if (e.target.returnValue != "load") return;
const inputEl = document.getElementById("loadDialogInput"); const inputEl = document.getElementById("loadDialogInput");
const saveInputEl = document.getElementById("saveDialogInput"); const saveInputEl = document.getElementById("saveDialogInput");
loadProject(inputEl.value); loadProject(inputEl.value);
...@@ -939,9 +952,9 @@ G28 ...@@ -939,9 +952,9 @@ G28
document document
.getElementById("helpDialog") .getElementById("helpDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Load button was pressed // Check if Load button was pressed
switch (event.target.returnValue) { switch (e.target.returnValue) {
case "example1": case "example1":
window.currentProject = getPresetModelVase(); window.currentProject = getPresetModelVase();
break; break;
...@@ -955,9 +968,9 @@ G28 ...@@ -955,9 +968,9 @@ G28
document document
.getElementById("addLineDialog") .getElementById("addLineDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Add button was pressed // Check if Add button was pressed
if (event.target.returnValue != "add") return; if (e.target.returnValue != "add") return;
let inputX = document.getElementById("addLineInputX"); let inputX = document.getElementById("addLineInputX");
let inputY = document.getElementById("addLineInputY"); let inputY = document.getElementById("addLineInputY");
...@@ -1024,9 +1037,9 @@ G28 ...@@ -1024,9 +1037,9 @@ G28
document document
.getElementById("addArcDialog") .getElementById("addArcDialog")
.addEventListener("close", function onClose() { .addEventListener("close", function onClose(e) {
// Check if Add button was pressed // Check if Add button was pressed
if (event.target.returnValue != "add") return; if (e.target.returnValue != "add") return;
const size = document.getElementById("addArcInputSize"); const size = document.getElementById("addArcInputSize");
const data = new FormData(document.querySelector("#addArcForm")); const data = new FormData(document.querySelector("#addArcForm"));
...@@ -1048,4 +1061,8 @@ window.onload = function () { ...@@ -1048,4 +1061,8 @@ window.onload = function () {
window.selectedListEntries = []; window.selectedListEntries = [];
initIllo(); initIllo();
initEventListeners(); initEventListeners();
if (localStorage.getItem("splashSeen") !== "1") {
localStorage.setItem("splashSeen", "1");
document.getElementById("helpDialog").showModal();
}
}; };
import { defineConfig } from 'vite'
import * as child from "child_process";
const commitDate = new Date(child.execSync('git log -1 --format=%cI').toString().trimEnd()).toDateString();
const branchName = child.execSync('git rev-parse --abbrev-ref HEAD').toString().trimEnd();
const commitHash = child.execSync('git rev-parse --short HEAD').toString().trimEnd();
export default defineConfig({
define: {
'import.meta.env.VITE_APP_DATE': JSON.stringify(commitDate),
'import.meta.env.VITE_APP_BRANCH': JSON.stringify(branchName),
'import.meta.env.VITE_APP_HASH': JSON.stringify(commitHash),
}
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment