@@ -51,7 +51,7 @@ const Projects = () => {
5151 returnToGallery,
5252 } = useProjectDetail ( ) ;
5353
54- // Handle view project details with proper navigation - DEFINE THIS BEFORE useEffect
54+ // Handle view project details with proper navigation
5555 const handleViewDetails = useCallback (
5656 ( projectId , action = 'page' ) => {
5757 if ( action === 'reset' ) {
@@ -67,18 +67,19 @@ const Projects = () => {
6767 if ( action === 'modal' ) {
6868 openProjectModal ( projectId , projectsData ) ;
6969 } else if ( action === 'page' ) {
70- // Update the URL
71- navigate ( `/projects?project=${ projectId } ` ) ;
72- // View project details
70+ const expectedSearch = `?project=${ projectId } ` ;
71+ // Only update the URL if it is different than what we expect
72+ if ( location . search !== expectedSearch ) {
73+ navigate ( `/projects${ expectedSearch } ` ) ;
74+ }
7375 viewProjectDetails ( projectId , projectsData ) ;
7476 }
7577 } ,
76- [ navigate , resetFilters , openProjectModal , projectsData , viewProjectDetails ]
78+ [ navigate , location . search , resetFilters , openProjectModal , projectsData , viewProjectDetails ]
7779 ) ;
7880
79- // Initialize project data and hooks - NOW handleViewDetails EXISTS when this runs
81+ // Initialize project data and hooks
8082 useEffect ( ( ) => {
81- // Simplified loading logic to avoid extra state updates
8283 if ( ! projectsLoading ) {
8384 setIsLoading ( false ) ;
8485 }
@@ -94,7 +95,7 @@ const Projects = () => {
9495 // Handle back to gallery
9596 const handleBackToGallery = ( ) => {
9697 // Update URL to remove project parameter
97- navigate ( '/hxndev.github.io/ projects' ) ;
98+ navigate ( '/projects' ) ;
9899 returnToGallery ( ) ;
99100 } ;
100101
@@ -106,23 +107,15 @@ const Projects = () => {
106107 Projects
107108 </ Title >
108109
109- { /* Error message if needed */ }
110110 { ( error || projectsError ) && (
111111 < Alert icon = { < IconAlertCircle size = { 16 } /> } title = "Error" color = "red" mb = "lg" >
112112 { error || projectsError }
113- < Button
114- variant = "outline"
115- color = "red"
116- size = "xs"
117- mt = "sm"
118- onClick = { ( ) => setError ( null ) }
119- >
113+ < Button variant = "outline" color = "red" size = "xs" mt = "sm" onClick = { ( ) => setError ( null ) } >
120114 Dismiss
121115 </ Button >
122116 </ Alert >
123117 ) }
124118
125- { /* Filter controls */ }
126119 < FilterControls
127120 categories = { categories }
128121 activeCategory = { activeCategory }
@@ -132,7 +125,6 @@ const Projects = () => {
132125 onReset = { resetFilters }
133126 />
134127
135- { /* Project gallery */ }
136128 < Box mt = { 30 } >
137129 { isLoading || projectsLoading ? (
138130 < Box
@@ -150,7 +142,6 @@ const Projects = () => {
150142 </ Box >
151143 ) : (
152144 < >
153- { /* Project Gallery */ }
154145 { filteredProjects . length > 0 ? (
155146 < SimpleGrid
156147 cols = { 3 }
@@ -170,10 +161,7 @@ const Projects = () => {
170161 >
171162 < EnhancedProjectCard
172163 { ...project }
173- // Fix potential image path issues
174- image = {
175- project . image ? project . image . replace ( / ^ \/ | ^ \/ p u b l i c \/ / , '' ) : null
176- }
164+ image = { project . image ? project . image . replace ( / ^ \/ | ^ \/ p u b l i c \/ / , '' ) : null }
177165 onViewDetails = { handleViewDetails }
178166 projectId = { project . id }
179167 />
@@ -198,11 +186,7 @@ const Projects = () => {
198186 < Text align = "center" size = "lg" >
199187 No projects found with the current filters
200188 </ Text >
201- < Button
202- onClick = { resetFilters }
203- variant = "gradient"
204- gradient = { { from : '#9B00FF' , to : '#00F5FF' } }
205- >
189+ < Button onClick = { resetFilters } variant = "gradient" gradient = { { from : '#9B00FF' , to : '#00F5FF' } } >
206190 Reset Filters
207191 </ Button >
208192 </ Box >
@@ -211,19 +195,12 @@ const Projects = () => {
211195 ) }
212196 </ Box >
213197
214- { /* Project modal */ }
215- < ProjectModal
216- project = { selectedProject }
217- isOpen = { isModalOpen }
218- onClose = { closeProjectModal }
219- />
198+ < ProjectModal project = { selectedProject } isOpen = { isModalOpen } onClose = { closeProjectModal } />
220199 </ >
221200 ) : (
222- // Detail view
223201 < ProjectDetail project = { selectedProject } onBack = { handleBackToGallery } />
224202 ) }
225203
226- { /* Featured projects call to action - only show in gallery view with no filters */ }
227204 { viewMode === 'gallery' && activeCategory === 'all' && ! searchQuery && (
228205 < Box
229206 mt = { 50 }
@@ -242,13 +219,12 @@ const Projects = () => {
242219 Interested in a collaboration?
243220 </ Title >
244221 < Text >
245- I'm always open to discussing new projects and opportunities. Feel free to reach out
246- if you'd like to work together!
222+ I'm always open to discussing new projects and opportunities. Feel free to reach out if you'd like to work together!
247223 </ Text >
248224 </ div >
249225 < Button
250226 component = "a"
251- href = "/hxndev.github.io/ contact"
227+ href = "/contact"
252228 variant = "gradient"
253229 gradient = { { from : '#9B00FF' , to : '#00F5FF' } }
254230 ml = "auto"
@@ -267,7 +243,6 @@ const Projects = () => {
267243 </ Box >
268244 ) }
269245
270- { /* Animation keyframes */ }
271246 < style jsx = "true" > { `
272247 @keyframes fadeInUp {
273248 from {
0 commit comments