Skip to content

Commit a897353

Browse files
committed
commit Update footer and add CV and FAQ routes
1 parent 69e790c commit a897353

File tree

6 files changed

+88
-88
lines changed

6 files changed

+88
-88
lines changed

frontend/src/components/InteractiveProjects.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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

frontend/src/components/Layout/Footer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ const Footer = () => {
5656
</Link>
5757
</li>
5858
<li>
59-
<<<<<<< HEAD
6059
<Link to="/cv" className="text-gray-400 hover:text-white transition-colors">
6160
CV / Resume
62-
=======
61+
</Link>
62+
</li>
63+
<li>
6364
<Link to="/help" className="text-gray-400 hover:text-white transition-colors">
6465
Help & FAQ
65-
>>>>>>> aaa2a14c636db724a5b4227059ddfc54fd5501ff
6666
</Link>
6767
</li>
6868
</ul>

frontend/src/pages/Admin/ChatbotAdmin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, useCallback } from 'react';
22
import axios from 'axios';
33

44
const API_BASE_URL = process.env.REACT_APP_API_URL || 'http://localhost:8000';
@@ -11,11 +11,7 @@ const ChatbotAdmin = () => {
1111
const [replyMessage, setReplyMessage] = useState('');
1212
const [sending, setSending] = useState(false);
1313

14-
useEffect(() => {
15-
fetchConversations();
16-
}, [filter]);
17-
18-
const fetchConversations = async () => {
14+
const fetchConversations = useCallback(async () => {
1915
try {
2016
setLoading(true);
2117
const response = await axios.get(
@@ -33,7 +29,11 @@ const ChatbotAdmin = () => {
3329
} finally {
3430
setLoading(false);
3531
}
36-
};
32+
}, [filter]);
33+
34+
useEffect(() => {
35+
fetchConversations();
36+
}, [fetchConversations]);
3737

3838
const fetchConversationDetail = async (id) => {
3939
try {

frontend/src/pages/Blog.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ const Blog = () => {
99
const [searchTerm, setSearchTerm] = useState('');
1010

1111
useEffect(() => {
12-
fetchPosts();
13-
}, [selectedCategory, searchTerm, fetchPosts]);
14-
15-
const fetchPosts = async () => {
16-
try {
17-
setLoading(true);
18-
const params = {};
19-
20-
if (selectedCategory !== 'all') {
21-
params.category = selectedCategory;
22-
}
23-
if (searchTerm) {
24-
params.search = searchTerm;
12+
const fetchPosts = async () => {
13+
try {
14+
setLoading(true);
15+
const params = {};
16+
17+
if (selectedCategory !== 'all') {
18+
params.category = selectedCategory;
19+
}
20+
if (searchTerm) {
21+
params.search = searchTerm;
22+
}
23+
24+
const response = await blogService.getAll(params);
25+
setPosts(response.data.results || response.data);
26+
} catch (error) {
27+
console.error('Error fetching blog posts:', error);
28+
} finally {
29+
setLoading(false);
2530
}
31+
};
2632

27-
const response = await blogService.getAll(params);
28-
setPosts(response.data.results || response.data);
29-
} catch (error) {
30-
console.error('Error fetching blog posts:', error);
31-
} finally {
32-
setLoading(false);
33-
}
34-
};
33+
fetchPosts();
34+
}, [selectedCategory, searchTerm]);
3535

3636
const categories = [
3737
{ value: 'all', label: 'All Posts' },

frontend/src/pages/BlogDetail.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ const BlogDetail = () => {
1414
const [comments, setComments] = useState([]);
1515

1616
useEffect(() => {
17-
fetchPost();
18-
}, [slug, fetchPost]);
17+
const fetchPost = async () => {
18+
try {
19+
setLoading(true);
20+
const response = await blogService.getOne(slug);
21+
setPost(response.data);
22+
setComments(response.data.comments || []);
23+
24+
// Increment view count
25+
await blogService.incrementViews(slug);
26+
} catch (error) {
27+
console.error('Error fetching blog post:', error);
28+
} finally {
29+
setLoading(false);
30+
}
31+
};
1932

20-
const fetchPost = async () => {
21-
try {
22-
setLoading(true);
23-
const response = await blogService.getOne(slug);
24-
setPost(response.data);
25-
setComments(response.data.comments || []);
26-
27-
// Increment view count
28-
await blogService.incrementViews(slug);
29-
} catch (error) {
30-
console.error('Error fetching blog post:', error);
31-
} finally {
32-
setLoading(false);
33-
}
34-
};
33+
fetchPost();
34+
}, [slug]);
3535

3636
const handleCommentSubmit = async (e) => {
3737
e.preventDefault();

frontend/src/pages/Home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Home = () => {
1212
useEffect(() => {
1313
const fetchData = async () => {
1414
try {
15-
const [profileRes, projectsRes, testimonialsRes, servicesRes] = await Promise.all([
15+
const [profileRes, , testimonialsRes, servicesRes] = await Promise.all([
1616
profileService.getPublicProfile(),
1717
projectService.getFeatured(),
1818
testimonialService.getFeatured(),

0 commit comments

Comments
 (0)