diff --git a/server/index.js b/server/index.js
index a566b9b..2c551c6 100644
--- a/server/index.js
+++ b/server/index.js
@@ -158,6 +158,8 @@ app.use('/api/reports', require('./routes/reports'));
app.use('/api/risk-assessment', require('./routes/riskAssessment'));
app.use('/api/family', require('./routes/family'));
app.use('/api/security', require('./routes/security'));
+app.use('/api/hospitals', require('./routes/hospitals'));
+app.use('/api/forums', require('./routes/forums'));
// Health Check / Default route
app.get('/', (req, res) => {
diff --git a/server/routes/forums.js b/server/routes/forums.js
new file mode 100644
index 0000000..d31a079
--- /dev/null
+++ b/server/routes/forums.js
@@ -0,0 +1,38 @@
+const express = require('express');
+const router = express.Router();
+const auth = require('../middleware/auth');
+
+// In-memory mock database for forum posts
+let mockPosts = [
+ { id: '1', title: 'Managing Diabetes Tips', author: 'Jane D.', content: 'What are your favorite low-carb snacks?', replies: 5, date: new Date().toISOString() },
+ { id: '2', title: 'Anxiety and Sleep', author: 'Mark T.', content: 'Having trouble sleeping due to anxiety. Any natural remedies?', replies: 12, date: new Date().toISOString() }
+];
+
+// GET /api/forums
+// Fetch all forum posts
+router.get('/', auth, (req, res) => {
+ res.json(mockPosts);
+});
+
+// POST /api/forums
+// Create a new forum post
+router.post('/', auth, (req, res) => {
+ const { title, content } = req.body;
+ if (!title || !content) {
+ return res.status(400).json({ message: 'Title and content are required' });
+ }
+
+ const newPost = {
+ id: Date.now().toString(),
+ title,
+ content,
+ author: req.user?.name || 'Anonymous',
+ replies: 0,
+ date: new Date().toISOString()
+ };
+
+ mockPosts.unshift(newPost);
+ res.status(201).json(newPost);
+});
+
+module.exports = router;
diff --git a/src/App.jsx b/src/App.jsx
index c92a8a0..a49168e 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -44,6 +44,9 @@ import Login from './pages/Login';
import Profile from './pages/Profile';
import DosageCalculator from './pages/DosageCalculator';
import HealthMetrics from './pages/HealthMetrics';
+import HospitalFinder from './pages/HospitalFinder';
+import CommunityForums from './pages/CommunityForums';
+import CorporateWellness from './pages/CorporateWellness';
import Footer from './components/Footer';
import NotFound from './pages/NotFound';
@@ -346,6 +349,9 @@ function App() {
} />
} />
} />
+ } />
+ } />
+ } />
} />
} />
} />
diff --git a/src/pages/CommunityForums.jsx b/src/pages/CommunityForums.jsx
new file mode 100644
index 0000000..ab2d668
--- /dev/null
+++ b/src/pages/CommunityForums.jsx
@@ -0,0 +1,138 @@
+import React, { useState, useEffect } from 'react';
+import {
+ Box,
+ Typography,
+ Container,
+ Button,
+ Card,
+ CardContent,
+ Dialog,
+ DialogTitle,
+ DialogContent,
+ DialogActions,
+ TextField,
+ CircularProgress,
+ Divider,
+ Avatar
+} from '@mui/material';
+import { Forum as ForumIcon, Add as AddIcon, Comment as CommentIcon } from '@mui/icons-material';
+import API from '../utils/api';
+
+function CommunityForums() {
+ const [posts, setPosts] = useState([]);
+ const [loading, setLoading] = useState(false);
+ const [open, setOpen] = useState(false);
+ const [newTitle, setNewTitle] = useState('');
+ const [newContent, setNewContent] = useState('');
+
+ const fetchPosts = async () => {
+ setLoading(true);
+ try {
+ const res = await API.get('/api/forums');
+ setPosts(res.data);
+ } catch (err) {
+ console.error(err);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ useEffect(() => {
+ fetchPosts();
+ }, []);
+
+ const handlePost = async () => {
+ if (!newTitle.trim() || !newContent.trim()) return;
+ try {
+ await API.post('/api/forums', { title: newTitle, content: newContent });
+ setOpen(false);
+ setNewTitle('');
+ setNewContent('');
+ fetchPosts();
+ } catch (err) {
+ console.error(err);
+ }
+ };
+
+ return (
+
+
+
+
+
+ Community Health Forums
+
+
+ } onClick={() => setOpen(true)}>
+ New Post
+
+
+
+ {loading ? (
+
+
+
+ ) : (
+
+ {posts.map((post) => (
+
+
+
+ {post.title}
+
+
+ {post.content}
+
+
+
+
+ {post.author[0]}
+
+ Posted by {post.author} on {new Date(post.date).toLocaleDateString()}
+
+
+
+
+ {post.replies} Replies
+
+
+
+
+ ))}
+
+ )}
+
+
+
+ );
+}
+
+export default CommunityForums;