-
Notifications
You must be signed in to change notification settings - Fork 0
/
community.html
341 lines (305 loc) · 14.4 KB
/
community.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Community</title>
<link rel="shortcut icon" href="image/logo.jpg" type="image/svg+xml">
<link rel="stylesheet" href="css/blogs.css">
<link rel="stylesheet" href="community.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="chat.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Plus Jakarta Sans", sans-serif;
}
.header{
min-height: 70vh;
}
.header,
.cta,
.sub-header {
background-image: url('imgs/tempbg.png');
background-position: center;
background-size: cover;
}
.sub-header,
.light-mode .sub-header {
background-image: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
url('imgs/tempbg.png');
}
.dark-mode .sub-header {
background-image: linear-gradient(rgba(4, 9, 30, 0.7), rgba(4, 9, 30, 0.7)),
url('imgs/tempbg.png');
}
</style>
</head>
<body>
<section class="header">
<nav style="padding-top: 30px;">
<img style="width: 250px; margin-left: 85px;" src="imgs/nvt1.png">
<a href="index.html"></a>
<div class="nav-links" id="navLinks">
<i class="fa fa-times" onclick="hidemenu()"></i>
<ul>
<li><a href="home2.html" style="font-size: 18px;">Home</a></li>
<li><a href="career.html" style="font-size: 18px;">Career</a></li>
<li><a href="mquiz.html" style="font-size: 18px;">Mental Health</a></li>
<li><a href="explore.html" style="font-size: 18px;">Explore</a></li>
<li><a href="ideahub.html" style="font-size: 18px;">IdeaHub</a></li>
<li><a href="community.html" style="font-size: 18px;">Community</a></li>
<li><a href="article.html" style="font-size: 18px;">Articles</a></li>
<li><a href="profile.html" style="font-size: 18px;background-color: #ad8a38; font-weight: bold; padding: 10px; border-radius: 5px;">Profile</a></li>
</ul>
</div>
<i class="fa fa-bars" onclick="showMenu()"></i>
</nav>
<br><br><br><br>
<div class="text-box">
<h1 style="padding-top: 30px; font-size: 50px;">Empowering women through communication</h1>
</div>
<button class="chatbot-toggler">
<span class="material-symbols-rounded"><i class="fa-solid fa-message"></i></span>
<span class="material-symbols-outlined"><i class="fa-solid fa-xmark"></i></span>
</button>
<div class="chatbot">
<header>
<h2>Chatbot</h2>
<span class="close-btn material-symbols-outlined"><i class="fa-solid fa-xmark"></i></span>
</header>
<ul class="chatbox">
<li class="chat incoming">
<span class="material-symbols-outlined"><i class="fa-regular fa-paper-plane"></i></span>
<p>Hi there 👋<br>How can I help you today?</p>
</li>
</ul>
<div class="chat-input">
<textarea placeholder="Enter a message..." spellcheck="false" required></textarea>
<span id="send-btn" class="material-symbols-rounded"><i class="fa-solid fa-share"></i></span>
</div>
</div>
</section>
</section>
<section class="add-post" style="text-align: center;">
<h2>Add New Post</h2>
<form id="post-form" onsubmit="addPost(event)" style="max-width: 500px; margin: auto;">
<div style="margin-bottom: 10px;">
<label for="post-title" style="display: block;">Title:</label>
<input type="text" id="post-title" name="title" placeholder="Enter the post title" style="width: 100%; padding: 8px;">
</div>
<div style="margin-bottom: 10px;">
<label for="post-author" style="display: block;">Author:</label>
<input type="text" id="post-author" name="author" placeholder="Enter your name" style="width: 100%; padding: 8px;">
</div>
<div style="margin-bottom: 10px;">
<label for="post-content" style="display: block;">Content:</label>
<textarea id="post-content" name="content" placeholder="Write your post content here" style="width: 100%; height: 150px; padding: 8px;"></textarea>
</div>
<div>
<button type="submit" style="background-color: #ad8a38; color: white; padding: 10px 20px; border: none; cursor: pointer; border-radius: 4px;">Add Post</button>
</div>
</form>
</section>
<section class="blogs" id="new-post-section">
<br><br>
<div class="blog" id="new-post">
<!-- New post content will be inserted here -->
</div>
<br>
</section>
<!-- <section class="blogs">
<div class="blog">
<h2>Breaking Stereotypes in the Workplace</h2>
<p class="author">Author: Sarah Johnson</p>
<p>As a successful businesswoman, I've faced numerous challenges. Let's discuss strategies to break through workplace stereotypes and empower each other.</p> -->
<!-- <div class="comments" id="comments-post-1"> -->
<!-- Dynamic comments for this post will be displayed here -->
<!-- </div>
<div class="add-comment">
<form id="comment-form-1" onsubmit="addComment(event, 1)">
<input type="hidden" name="post_id" value="1">
<input type="text" name="name" placeholder="Your Name" required><br>
<textarea name="comment" placeholder="Add your comment" required></textarea><br>
<button type="submit">Add Comment</button>
</form>
</div>
</div> -->
</section>
<section class="blogs">
<div class="blog">
<h2>Supporting Each Other Through Tough Times</h2>
<p class="author">Author: Mia Rodriguez</p>
<p>Let's create a safe space to share our struggles and support one another. Remember, together we are stronger!</p>
<div class="comments" id="comments-post-2">
</div>
<div class="add-comment">
<form id="comment-form-2" onsubmit="addComment(event, 2)">
<input type="hidden" name="post_id" value="200">
<input type="text" name="name" placeholder="Your Name" required><br>
<textarea name="comment" placeholder="Add your comment" required></textarea><br>
<button type="submit">Add Comment</button>
</form>
</div>
</div>
</section>
<section class="blogs">
<div class="blog">
<h2>Breaking Cultural Barriers: My Journey</h2>
<p class="author">Author: Aisha Khan</p>
<p>Being raised in a conservative society, I've encountered numerous cultural barriers. Let's share our experiences and strategies for breaking free from societal norms.</p>
<div class="comments" id="comments-post-3">
<!-- Dynamic comments for this post will be displayed here -->
</div>
<div class="add-comment">
<form id="comment-form-3" onsubmit="addComment(event, 3)">
<input type="hidden" name="post_id" value="300">
<input type="text" name="name" placeholder="Your Name" required><br>
<textarea name="comment" placeholder="Add your comment" required></textarea><br>
<button type="submit">Add Comment</button>
</form>
</div>
</div>
</section>
<section class="blogs">
<div class="blog">
<h2>Self-Care Amidst Everyday Challenges</h2>
<p class="author">Author: Lily Chen</p>
<p>Let's talk about the importance of self-care in our busy lives. Share your tips and tricks for finding moments of peace and rejuvenation amidst everyday challenges.</p>
<div class="comments" id="comments-post-4">
<!-- Dynamic comments for this post will be displayed here -->
</div>
<div class="add-comment">
<form id="comment-form-4" onsubmit="addComment(event, 4)">
<input type="hidden" name="post_id" value="4">
<input type="text" name="name" placeholder="Your Name" required><br>
<textarea name="comment" placeholder="Add your comment" required></textarea><br>
<button type="submit">Add Comment</button>
</form>
</div>
</div>
</section>
<!-- Repeat the structure for other blog posts with unique IDs -->
<div id="google_translate_element"></div>
<section class="footer">
<h3 style="color:#f0dbaa; font-weight: bold;">Contact Us</h3>
<div class="icons">
<i class="fab fa-facebook"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
</section>
<!-- <script>
// Function to fetch existing posts from the server
function fetchPosts() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "fetch_posts.php", true);
xhr.onload = function () {
if (xhr.status === 200) {
var postsSection = document.getElementById("posts");
postsSection.innerHTML = xhr.responseText;
} else {
console.error(xhr.statusText);
}
};
xhr.onerror = function () {
console.error("Request failed");
};
xhr.send();
}
// Call fetchPosts() function when the page loads
window.onload = fetchPosts;
</script> -->
<script>
function addPost(event) {
event.preventDefault(); // Prevent default form submission
var form = document.getElementById("post-form");
var formData = new FormData(form);
// Send form data to add_post.php using AJAX
var xhr = new XMLHttpRequest();
xhr.open("POST", "add_post.php", true);
xhr.onload = function () {
if (xhr.status === 200) {
// Create a new div for the post card
var postCard = document.createElement("div");
postCard.className = "blog";
// Set the inner HTML of the post card
postCard.innerHTML = xhr.responseText;
// Append the post card to the new post section
var newPostSection = document.getElementById("new-post-section");
newPostSection.insertBefore(postCard, newPostSection.firstChild);
form.reset(); // Reset the form fields
} else {
console.error(xhr.statusText);
}
};
xhr.onerror = function () {
console.error("Request failed");
};
xhr.send(formData);
}
</script>
<script>
function addComment(event, postId) {
event.preventDefault(); // Prevent default form submission
var form = document.getElementById("comment-form-" + postId);
var formData = new FormData(form);
// Send form data to comments.php using AJAX
var xhr = new XMLHttpRequest();
xhr.open("POST", "comments.php", true);
xhr.onload = function () {
if (xhr.status === 200) {
// On success, update the comments section
var commentsSection = document.getElementById("comments-post-" + postId);
commentsSection.innerHTML = xhr.responseText;
} else {
console.error(xhr.statusText);
}
};
xhr.onerror = function () {
console.error("Request failed");
};
xhr.send(formData);
}
</script>
<script src="cscript.js"></script>
<script>
var navlinks = document.getElementById("navLinks");
function showMenu() {
navlinks.style.right = "0";
}
function hidemenu() {
navlinks.style.right = "-200px";
}
function toggleMode() {
document.body.classList.toggle('dark-mode');
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const currentUser = getCurrentUser();
if (currentUser) {
if (currentUser.role === 'admin') {
document.getElementById('reviews').contentEditable = true;
} else {
document.getElementById('reviews').contentEditable = false;
}
}
});
</script>
<script src="chello.js"></script>
<script src="https://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate"></script>
<script>
function loadGoogleTranslate() {
new google.translate.TranslateElement({ pageLanguage: 'en' }, 'google_translate_element');
}
</script>
</body>
</html>