Skip to content

Commit

Permalink
Added functionality to use template button
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronge-2020 committed Feb 28, 2024
1 parent ede7351 commit 5677721
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
55 changes: 30 additions & 25 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,43 @@ advancedSettingsCheckbox.addEventListener("change", function () {
}
});

// Handling the '.btn-proceed' buttons to navigate through steps
document.querySelectorAll(".btn-proceed").forEach((button) => {
button.addEventListener("click", function () {
function nextSection() {

if (!window.loadedImg) {
if (!window.loadedImg) {

// If no image is loaded, show an error message
const imageLoadStatus = document.getElementById("imageLoadStatus");
imageLoadStatus.classList = "load-status error-message";
imageLoadStatus.textContent = "No image loaded";
return;
}
// If no image is loaded, show an error message
const imageLoadStatus = document.getElementById("imageLoadStatus");
imageLoadStatus.classList = "load-status error-message";
imageLoadStatus.textContent = "No image loaded";
return;
}


// Move to the next step
let nextStep = currentStep + 1;
// Move to the next step
let nextStep = currentStep + 1;

const sections = [
uploadSection,
segmentationSection,
griddingSection,
virtualGridSection,
];
const nextSection = sections[nextStep];
if (nextSection) {
currentStep = nextStep;
updateCurrentStep(nextStep + 1);
navigateToSection(sections[nextStep - 1], nextSection);
}
});
const sections = [
uploadSection,
segmentationSection,
griddingSection,
virtualGridSection,
];
const nextSection = sections[nextStep];
if (nextSection) {
currentStep = nextStep;
updateCurrentStep(nextStep + 1);
navigateToSection(sections[nextStep - 1], nextSection);
}
}

// Handling the '.btn-proceed' buttons to navigate through steps
document.querySelectorAll(".btn-proceed").forEach((button) => {
button.addEventListener("click", nextSection);
});

document.getElementById("useTemplate").addEventListener("click", nextSection);


// Handling the '.btn-proceed' buttons to navigate through steps
document.querySelectorAll(".btn-back").forEach((button) => {
button.addEventListener("click", function () {
Expand Down
9 changes: 4 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ <h2 class="text-xl font-semibold">Uploading an Image</h2>
<div class="mt-6 width-90-middle">
<label class="block text-sm font-semibold text-gray-700">Optional Metadata File:</label>
<div class="file-upload-wrapper">
<input type="file" id="metadataFile" class="file-input" accept=".csv,.json,.xlsx, .xls"
onchange="displayFileInfo(this)">
<label class="file-upload-button" for="metadataFile">Choose files to upload</label>
<button class="skip-button" for="metadataFile">Use Template Metadata</label>
<input type="file" id="metadataFile" class="file-input" accept=".csv,.json,.xlsx, .xls" onchange="displayFileInfo(this)">
<label for="metadataFile" class="file-upload-button">Choose files</label>
<button class="skip-button" id="useTemplate" onclick="">Use Template</button>
</div>

<div id="metadata-file-info" class="hidden width-90-middle"
style="width: 100%; margin-top: 20px;">
<img src="./icons/image-file-icon.svg" alt="File icon" id="file-icon" class="file-icon">
Expand Down
1 change: 0 additions & 1 deletion main2.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@ function bindEventListeners() {
// Initialize and bind events
const initSegmentation = async () => {

debugger;
const state = await loadDependencies();
window.state = state;

Expand Down

0 comments on commit 5677721

Please sign in to comment.