@@ -10,47 +10,47 @@ const InteractiveProjects = ({ limit = 6, showViewAll = true }) => {
1010 const [ categories , setCategories ] = useState ( [ ] ) ;
1111
1212 useEffect ( ( ) => {
13- fetchProjects ( ) ;
14- } , [ ] ) ;
15-
16- const fetchProjects = async ( ) => {
17- try {
18- setLoading ( true ) ;
19- const response = await axios . get ( 'http://localhost:8000/api/portfolio/projects/' ) ;
20-
21- if ( Array . isArray ( response . data ) ) {
22- setProjects ( response . data . slice ( 0 , limit ) ) ;
13+ const fetchProjects = async ( ) => {
14+ try {
15+ setLoading ( true ) ;
16+ const response = await axios . get ( 'http://localhost:8000/api/portfolio/projects/' ) ;
2317
24- // Extract unique categories
25- const uniqueCategories = [ 'all' , ...new Set ( response . data . map ( p => p . category ) ) ] ;
26- setCategories ( uniqueCategories ) ;
27- }
28- } catch ( error ) {
29- console . error ( 'Error fetching projects:' , error ) ;
30- // Fallback to sample data
31- setProjects ( [
32- {
33- id : 1 ,
34- title : 'OpenStack Private Cloud' ,
35- description : 'Designed and deployed a comprehensive OpenStack cloud infrastructure.' ,
36- category : 'cloud' ,
37- technologies : [ 'OpenStack' , 'OVN' , 'Kubernetes' , 'Ceph' ] ,
38- is_featured : true ,
39- } ,
40- {
41- id : 2 ,
42- title : 'AI Research Hub' ,
43- description : 'High-performance computing environment optimized for AI/ML workloads.' ,
44- category : 'ai' ,
45- technologies : [ 'GPU' , 'Docker' , 'TensorFlow' , 'PyTorch' ] ,
46- is_featured : true ,
18+ if ( Array . isArray ( response . data ) ) {
19+ setProjects ( response . data . slice ( 0 , limit ) ) ;
20+
21+ // Extract unique categories
22+ const uniqueCategories = [ 'all' , ...new Set ( response . data . map ( p => p . category ) ) ] ;
23+ setCategories ( uniqueCategories ) ;
4724 }
48- ] ) ;
49- setCategories ( [ 'all' , 'cloud' , 'ai' , 'devops' ] ) ;
50- } finally {
51- setLoading ( false ) ;
52- }
53- } ;
25+ } catch ( error ) {
26+ console . error ( 'Error fetching projects:' , error ) ;
27+ // Fallback to sample data
28+ setProjects ( [
29+ {
30+ id : 1 ,
31+ title : 'OpenStack Private Cloud' ,
32+ description : 'Designed and deployed a comprehensive OpenStack cloud infrastructure.' ,
33+ category : 'cloud' ,
34+ technologies : [ 'OpenStack' , 'OVN' , 'Kubernetes' , 'Ceph' ] ,
35+ is_featured : true ,
36+ } ,
37+ {
38+ id : 2 ,
39+ title : 'AI Research Hub' ,
40+ description : 'High-performance computing environment optimized for AI/ML workloads.' ,
41+ category : 'ai' ,
42+ technologies : [ 'GPU' , 'Docker' , 'TensorFlow' , 'PyTorch' ] ,
43+ is_featured : true ,
44+ }
45+ ] ) ;
46+ setCategories ( [ 'all' , 'cloud' , 'ai' , 'devops' ] ) ;
47+ } finally {
48+ setLoading ( false ) ;
49+ }
50+ } ;
51+
52+ fetchProjects ( ) ;
53+ } , [ limit ] ) ;
5454
5555 const filteredProjects = projects . filter ( project =>
5656 selectedCategory === 'all' || project . category === selectedCategory
0 commit comments