Skip to content

Commit bb792c7

Browse files
committed
feat: enhance recently opened projects section
1 parent 7657b6b commit bb792c7

3 files changed

Lines changed: 105 additions & 1 deletion

File tree

web-app/css/styles.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7283,4 +7283,55 @@ color:var(--accent);
72837283

72847284
.stats-card p{
72857285
color:var(--text-secondary);
7286+
}
7287+
.history-actions{
7288+
display:flex;
7289+
gap:15px;
7290+
align-items:center;
7291+
}
7292+
7293+
#historySearch{
7294+
7295+
padding:10px 16px;
7296+
7297+
border-radius:10px;
7298+
7299+
border:1px solid var(--border);
7300+
7301+
background:var(--surface);
7302+
7303+
color:var(--text);
7304+
7305+
}
7306+
7307+
#clearHistoryBtn{
7308+
7309+
padding:10px 18px;
7310+
7311+
border-radius:10px;
7312+
7313+
background:#ef4444;
7314+
7315+
color:white;
7316+
7317+
transition:.3s;
7318+
7319+
}
7320+
7321+
#clearHistoryBtn:hover{
7322+
7323+
transform:translateY(-2px);
7324+
7325+
opacity:.9;
7326+
7327+
}
7328+
7329+
#historyCount{
7330+
7331+
font-size:16px;
7332+
7333+
color:#22c55e;
7334+
7335+
margin-left:8px;
7336+
72867337
}

web-app/index.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,27 @@ <h2 class="section-heading">
456456
</section>
457457

458458
<!-- Recently Viewed Section -->
459-
<section class="projects-section" id="recentlyViewedSection">
459+
<div class="section-header">
460+
461+
<h2 class="section-heading">
462+
🕒 Recently Opened Projects
463+
<span id="historyCount"></span>
464+
</h2>
465+
466+
<div>
467+
468+
<input
469+
id="historySearch"
470+
type="text"
471+
placeholder="Search history...">
472+
473+
<button id="clearHistoryBtn">
474+
Clear History
475+
</button>
476+
477+
</div>
478+
479+
</div>
460480
<div class="container">
461481
<div class="section-header">
462482
<h2 class="section-heading">

web-app/js/main.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,14 @@ document.addEventListener("DOMContentLoaded", function () {
15671567
var section = document.getElementById("recentlyViewedSection");
15681568
if (!grid || !section) return;
15691569
var recent = JSON.parse(localStorage.getItem("recentProjects") || "[]");
1570+
const historyBadge =
1571+
document.getElementById("historyCountBadge");
1572+
1573+
if(historyBadge){
1574+
1575+
historyBadge.textContent=`(${recent.length})`;
1576+
1577+
}
15701578
console.log("[DEBUG] recentProjects array:", recent); if (recent.length === 0) {
15711579
section.style.display = "none";
15721580
return;
@@ -1966,4 +1974,29 @@ document.addEventListener("DOMContentLoaded", function () {
19661974
// Initial card filtering state update
19671975
updateProjectVisibility(currentCategory, currentSearchQuery);
19681976
window.updateRecentlyViewed();
1977+
1978+
const clearBtn =
1979+
document.getElementById("clearHistoryBtn");
1980+
1981+
if(clearBtn){
1982+
1983+
clearBtn.addEventListener("click",()=>{
1984+
1985+
showConfirm(
1986+
"Clear recently viewed projects?",
1987+
()=>{
1988+
1989+
localStorage.removeItem("recentProjects");
1990+
1991+
window.updateRecentlyViewed();
1992+
1993+
showToast("History Cleared");
1994+
1995+
}
1996+
1997+
);
1998+
1999+
});
2000+
2001+
}
19692002
});

0 commit comments

Comments
 (0)