@@ -51,7 +51,7 @@ const Projects = () => {
51
51
returnToGallery,
52
52
} = useProjectDetail ( ) ;
53
53
54
- // Handle view project details with proper navigation - DEFINE THIS BEFORE useEffect
54
+ // Handle view project details with proper navigation
55
55
const handleViewDetails = useCallback (
56
56
( projectId , action = 'page' ) => {
57
57
if ( action === 'reset' ) {
@@ -67,18 +67,19 @@ const Projects = () => {
67
67
if ( action === 'modal' ) {
68
68
openProjectModal ( projectId , projectsData ) ;
69
69
} 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
+ }
73
75
viewProjectDetails ( projectId , projectsData ) ;
74
76
}
75
77
} ,
76
- [ navigate , resetFilters , openProjectModal , projectsData , viewProjectDetails ]
78
+ [ navigate , location . search , resetFilters , openProjectModal , projectsData , viewProjectDetails ]
77
79
) ;
78
80
79
- // Initialize project data and hooks - NOW handleViewDetails EXISTS when this runs
81
+ // Initialize project data and hooks
80
82
useEffect ( ( ) => {
81
- // Simplified loading logic to avoid extra state updates
82
83
if ( ! projectsLoading ) {
83
84
setIsLoading ( false ) ;
84
85
}
@@ -94,7 +95,7 @@ const Projects = () => {
94
95
// Handle back to gallery
95
96
const handleBackToGallery = ( ) => {
96
97
// Update URL to remove project parameter
97
- navigate ( '/hxndev.github.io/ projects' ) ;
98
+ navigate ( '/projects' ) ;
98
99
returnToGallery ( ) ;
99
100
} ;
100
101
@@ -106,23 +107,15 @@ const Projects = () => {
106
107
Projects
107
108
</ Title >
108
109
109
- { /* Error message if needed */ }
110
110
{ ( error || projectsError ) && (
111
111
< Alert icon = { < IconAlertCircle size = { 16 } /> } title = "Error" color = "red" mb = "lg" >
112
112
{ 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 ) } >
120
114
Dismiss
121
115
</ Button >
122
116
</ Alert >
123
117
) }
124
118
125
- { /* Filter controls */ }
126
119
< FilterControls
127
120
categories = { categories }
128
121
activeCategory = { activeCategory }
@@ -132,7 +125,6 @@ const Projects = () => {
132
125
onReset = { resetFilters }
133
126
/>
134
127
135
- { /* Project gallery */ }
136
128
< Box mt = { 30 } >
137
129
{ isLoading || projectsLoading ? (
138
130
< Box
@@ -150,7 +142,6 @@ const Projects = () => {
150
142
</ Box >
151
143
) : (
152
144
< >
153
- { /* Project Gallery */ }
154
145
{ filteredProjects . length > 0 ? (
155
146
< SimpleGrid
156
147
cols = { 3 }
@@ -170,10 +161,7 @@ const Projects = () => {
170
161
>
171
162
< EnhancedProjectCard
172
163
{ ...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 }
177
165
onViewDetails = { handleViewDetails }
178
166
projectId = { project . id }
179
167
/>
@@ -198,11 +186,7 @@ const Projects = () => {
198
186
< Text align = "center" size = "lg" >
199
187
No projects found with the current filters
200
188
</ 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' } } >
206
190
Reset Filters
207
191
</ Button >
208
192
</ Box >
@@ -211,19 +195,12 @@ const Projects = () => {
211
195
) }
212
196
</ Box >
213
197
214
- { /* Project modal */ }
215
- < ProjectModal
216
- project = { selectedProject }
217
- isOpen = { isModalOpen }
218
- onClose = { closeProjectModal }
219
- />
198
+ < ProjectModal project = { selectedProject } isOpen = { isModalOpen } onClose = { closeProjectModal } />
220
199
</ >
221
200
) : (
222
- // Detail view
223
201
< ProjectDetail project = { selectedProject } onBack = { handleBackToGallery } />
224
202
) }
225
203
226
- { /* Featured projects call to action - only show in gallery view with no filters */ }
227
204
{ viewMode === 'gallery' && activeCategory === 'all' && ! searchQuery && (
228
205
< Box
229
206
mt = { 50 }
@@ -242,13 +219,12 @@ const Projects = () => {
242
219
Interested in a collaboration?
243
220
</ Title >
244
221
< 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!
247
223
</ Text >
248
224
</ div >
249
225
< Button
250
226
component = "a"
251
- href = "/hxndev.github.io/ contact"
227
+ href = "/contact"
252
228
variant = "gradient"
253
229
gradient = { { from : '#9B00FF' , to : '#00F5FF' } }
254
230
ml = "auto"
@@ -267,7 +243,6 @@ const Projects = () => {
267
243
</ Box >
268
244
) }
269
245
270
- { /* Animation keyframes */ }
271
246
< style jsx = "true" > { `
272
247
@keyframes fadeInUp {
273
248
from {
0 commit comments