@@ -3,6 +3,7 @@ const themeToggle = document.getElementById('themeToggle');
33const themeColorMeta = document . getElementById ( 'themeColorMeta' ) ;
44const html = document . documentElement ;
55const mainContent = document . getElementById ( 'main-content' ) ;
6+ let recentSearches = [ ] ;
67
78function prefersReducedMotion ( ) {
89 return window . matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches ;
@@ -61,7 +62,7 @@ backToTopButton.addEventListener('click', () => {
6162} ) ;
6263
6364// Category Filtering
64- const tabs = document . querySelectorAll ( '.tab' ) ;
65+ // const tabs = document.querySelectorAll('.tab');
6566
6667// Category Filtering (tabs)
6768
@@ -171,14 +172,21 @@ function highlightMatch(text, query) {
171172
172173// Render recent searches
173174function renderRecentSearches ( ) {
174- if ( recentSearches . length === 0 ) {
175- recentSearchesSection . style . display = 'none' ;
176- tipsSection . style . display = 'block' ;
177- resultsSection . style . display = 'none' ;
178- return ;
175+ if ( recentSearchesSection ) {
176+ recentSearchesSection . style . display = 'none' ;
177+ }
178+
179+ if ( tipsSection ) {
180+ tipsSection . style . display = 'block' ;
181+ }
182+
183+ if ( resultsSection ) {
184+ resultsSection . style . display = 'none' ;
179185 }
180186
187+ if ( recentSearchesList ) {
181188 recentSearchesList . innerHTML = '' ;
189+ }
182190 recentSearches . slice ( 0 , 5 ) . forEach ( ( search ) => {
183191 const item = document . createElement ( 'div' ) ;
184192 item . className = 'dropdown-recent-item' ;
@@ -212,11 +220,15 @@ function renderRecentSearches() {
212220 recentSearchesList . appendChild ( item ) ;
213221 } ) ;
214222
223+ if ( recentSearchesSection && resultsSection && tipsSection ) {
215224 recentSearchesSection . style . display = 'block' ;
216225 resultsSection . style . display = 'none' ;
217226 tipsSection . style . display = 'block' ;
218227}
219228
229+
230+ }
231+
220232function applyCategoryFilter ( category ) {
221233 projectCards . forEach ( ( card ) => {
222234 if ( category === 'all' || card . getAttribute ( 'data-category' ) === category ) {
0 commit comments