Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ if (isIndexPage) {

// Tracks currently selected skills to prevent duplicates
var selectedSkills = [];
// Clear Filters Button Functionality
var clearFiltersBtn = document.getElementById("clear-filters-btn");
if (clearFiltersBtn) {
clearFiltersBtn.addEventListener("click", function() {
var recommendForm = document.getElementById("recommend-form");
if (recommendForm) {
// 1. Reset standard form dropdowns and fields
recommendForm.reset();

// 2. Clear out the internal JavaScript array tracker completely
selectedSkills = [];

// 3. Clear the hidden inputs and visual chips using the file's own variables
if (skillsHidden) skillsHidden.value = "";
if (chipsSelectedEl) chipsSelectedEl.innerHTML = "";
if (skillsTextInput) {
skillsTextInput.value = "";
skillsTextInput.focus(); // Place cursor back on input
}

// 4. Hide autocomplete suggestions if any are open
var suggestionsBox = document.getElementById("skills-suggestions");
if (suggestionsBox) suggestionsBox.innerHTML = "";

// 5. Reset quick-pick chip visual active states if they have any
if (quickPickChips) {
quickPickChips.forEach(function(chip) {
chip.classList.remove("active", "selected");
});
}
}
});
}


// ----------------------------------------------------------
Expand Down
39 changes: 35 additions & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,16 @@ <h2 class="section-title">Find Your Next Project</h2>
<p class="form-error-general" id="form-error-general"></p>

<!-- Submit button -->
<button type="submit" class="btn-submit" id="submit-btn">
<span id="btn-label">Generate My Projects</span>
<span id="btn-loading" style="display:none;">Finding matches...</span>
</button>
<div class="form-actions">
<button type="submit" class="btn-submit" id="submit-btn">
<span id="btn-label">Generate My Projects</span>
<span id="btn-loading" style="display:none;">Finding matches...</span>
</button>

<button type="button" class="btn-clear" id="clear-filters-btn">
<span>Clear Filters</span>
</button>
</div>

</form>
</div>
Expand Down Expand Up @@ -632,6 +638,31 @@ <h4 class="footer-col-title">About Us</h4>

</div>
</div>
<style>
.form-actions {
display: flex;
gap: 12px;
margin-top: 20px;
align-items: center;
}

.btn-clear {
background-color: #f3f4f6;
color: #1f2937;
border: 1px solid #d1d5db;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
}

.btn-clear:hover {
background-color: #e5e7eb;
}
</style>



<script src="/static/data/skills.js"></script>
<script src="/static/script.js"></script>
Expand Down
Loading