walolorj commited on
Commit
5b47b4a
·
verified ·
1 Parent(s): c72ea8a

tüm sayfaları işlevsel hale getirip üyelik sistemi ve post paylaşmayı sağlar mısın?

Browse files
Files changed (5) hide show
  1. auth.html +73 -0
  2. components/navbar.js +11 -5
  3. index.html +17 -1
  4. script.js +340 -19
  5. style.css +9 -1
auth.html ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Auth | SocialSphere</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ </head>
11
+ <body class="bg-gray-50">
12
+ <div class="min-h-screen flex items-center justify-center p-4">
13
+ <div class="w-full max-w-md">
14
+ <div class="bg-white rounded-xl shadow-lg p-8">
15
+ <div class="text-center mb-8">
16
+ <h1 class="text-3xl font-bold text-blue-600 mb-2">SocialSphere</h1>
17
+ <p class="text-gray-500">Connect with friends and the world</p>
18
+ </div>
19
+
20
+ <div id="auth-forms">
21
+ <!-- Login Form -->
22
+ <form id="login-form" class="space-y-4">
23
+ <h2 class="text-xl font-semibold text-center">Login</h2>
24
+ <div>
25
+ <label for="login-email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
26
+ <input type="email" id="login-email" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
27
+ </div>
28
+ <div>
29
+ <label for="login-password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
30
+ <input type="password" id="login-password" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
31
+ </div>
32
+ <button type="submit" class="w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition">Login</button>
33
+ <p class="text-center text-sm text-gray-500">
34
+ Don't have an account?
35
+ <a href="#" id="show-register" class="text-blue-600 hover:underline">Register</a>
36
+ </p>
37
+ </form>
38
+
39
+ <!-- Register Form -->
40
+ <form id="register-form" class="space-y-4 hidden">
41
+ <h2 class="text-xl font-semibold text-center">Register</h2>
42
+ <div>
43
+ <label for="register-name" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
44
+ <input type="text" id="register-name" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
45
+ </div>
46
+ <div>
47
+ <label for="register-username" class="block text-sm font-medium text-gray-700 mb-1">Username</label>
48
+ <input type="text" id="register-username" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
49
+ </div>
50
+ <div>
51
+ <label for="register-email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
52
+ <input type="email" id="register-email" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
53
+ </div>
54
+ <div>
55
+ <label for="register-password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
56
+ <input type="password" id="register-password" required class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
57
+ </div>
58
+ <button type="submit" class="w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition">Register</button>
59
+ <p class="text-center text-sm text-gray-500">
60
+ Already have an account?
61
+ <a href="#" id="show-login" class="text-blue-600 hover:underline">Login</a>
62
+ </p>
63
+ </form>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ <script src="script.js"></script>
69
+ <script>
70
+ feather.replace();
71
+ </script>
72
+ </body>
73
+ </html>
components/navbar.js CHANGED
@@ -165,16 +165,22 @@ class CustomNavbar extends HTMLElement {
165
  <i data-feather="search" class="text-gray-400"></i>
166
  <input type="text" placeholder="Search...">
167
  </div>
168
-
169
  <div class="user-actions">
170
  <button class="notification-btn">
171
  <i data-feather="bell"></i>
172
  </button>
173
- <button class="user-btn">
174
- <img src="http://static.photos/people/200x200/1" alt="User">
175
- </button>
 
 
 
 
 
 
 
176
  </div>
177
- </div>
178
  </div>
179
  </nav>
180
  `;
 
165
  <i data-feather="search" class="text-gray-400"></i>
166
  <input type="text" placeholder="Search...">
167
  </div>
 
168
  <div class="user-actions">
169
  <button class="notification-btn">
170
  <i data-feather="bell"></i>
171
  </button>
172
+ <div class="relative group">
173
+ <button class="user-btn">
174
+ <img src="${currentUser ? currentUser.avatar : 'http://static.photos/people/200x200/1'}" alt="User">
175
+ </button>
176
+ <div class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-50 hidden group-hover:block">
177
+ <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Profile</a>
178
+ <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Settings</a>
179
+ <a href="#" id="logout-btn" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Logout</a>
180
+ </div>
181
+ </div>
182
  </div>
183
+ </div>
184
  </div>
185
  </nav>
186
  `;
index.html CHANGED
@@ -65,7 +65,23 @@
65
  <div class="p-4 border-b">
66
  <h2 class="font-bold text-xl">Your Feed</h2>
67
  </div>
68
- <div id="feed-container">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  <!-- Posts will be dynamically loaded here -->
70
  </div>
71
  <div class="p-4 text-center">
 
65
  <div class="p-4 border-b">
66
  <h2 class="font-bold text-xl">Your Feed</h2>
67
  </div>
68
+
69
+ <!-- Post creation form -->
70
+ <div class="p-4 border-b">
71
+ <form id="post-form" class="space-y-4">
72
+ <textarea id="post-content" rows="3" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" placeholder="What's on your mind?"></textarea>
73
+ <div class="flex items-center justify-between">
74
+ <div>
75
+ <input type="file" id="post-image" accept="image/*" class="hidden">
76
+ <button type="button" onclick="document.getElementById('post-image').click()" class="text-gray-500 hover:text-blue-500">
77
+ <i data-feather="image"></i>
78
+ </button>
79
+ </div>
80
+ <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition">Post</button>
81
+ </div>
82
+ </form>
83
+ </div>
84
+ <div id="feed-container">
85
  <!-- Posts will be dynamically loaded here -->
86
  </div>
87
  <div class="p-4 text-center">
script.js CHANGED
@@ -1,8 +1,207 @@
1
- // Sample data for posts
2
- const samplePosts = [
3
- {
4
- id: 1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  user: {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  name: "Sarah Johnson",
7
  username: "@sarahj",
8
  avatar: "http://static.photos/people/200x200/4"
@@ -70,20 +269,68 @@ let currentPosts = [];
70
 
71
  // Initialize the feed
72
  document.addEventListener('DOMContentLoaded', function() {
73
- loadPosts();
74
-
75
- // Load more button event
76
- document.getElementById('load-more').addEventListener('click', loadPosts);
77
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
 
 
 
 
 
 
 
79
  // Load posts into the feed
80
  function loadPosts() {
81
  const feedContainer = document.getElementById('feed-container');
82
 
83
- // Filter out already viewed posts
84
- const newPosts = samplePosts.filter(post => !viewedPosts.has(post.id));
85
 
86
- // If no new posts, show message
 
 
87
  if (newPosts.length === 0) {
88
  if (feedContainer.children.length === 0) {
89
  feedContainer.innerHTML = `
@@ -160,14 +407,72 @@ function loadPosts() {
160
  }
161
 
162
  // Handle post interactions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  function handleInteraction(e) {
164
  const button = e.currentTarget;
165
  const action = button.getAttribute('data-action');
166
  const postId = parseInt(button.getAttribute('data-id'));
167
 
168
- // Find the post
169
- const post = currentPosts.find(p => p.id === postId);
170
- if (!post) return;
 
171
 
172
  // Update UI based on action
173
  switch(action) {
@@ -196,12 +501,28 @@ function handleInteraction(e) {
196
 
197
  case 'comment':
198
  // In a real app, this would open comment section
199
- alert(`Comment on post by ${post.user.name}`);
200
- break;
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  case 'share':
203
  // In a real app, this would open share options
204
- alert(`Share post by ${post.user.name}`);
205
- break;
 
 
 
 
 
206
  }
207
  }
 
1
+
2
+ // User management
3
+ let currentUser = null;
4
+ const users = JSON.parse(localStorage.getItem('users')) || [];
5
+ const posts = JSON.parse(localStorage.getItem('posts')) || [];
6
+
7
+ // Initialize auth forms
8
+ function initAuthForms() {
9
+ const loginForm = document.getElementById('login-form');
10
+ const registerForm = document.getElementById('register-form');
11
+ const showRegister = document.getElementById('show-register');
12
+ const showLogin = document.getElementById('show-login');
13
+
14
+ if (loginForm && registerForm && showRegister && showLogin) {
15
+ showRegister.addEventListener('click', (e) => {
16
+ e.preventDefault();
17
+ loginForm.classList.add('hidden');
18
+ registerForm.classList.remove('hidden');
19
+ }
20
+
21
+ function showCommentModal(post) {
22
+ const modal = document.createElement('div');
23
+ modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
24
+ modal.innerHTML = `
25
+ <div class="bg-white rounded-xl p-6 max-w-md w-full max-h-[80vh] overflow-y-auto">
26
+ <div class="flex justify-between items-center mb-4">
27
+ <h3 class="text-xl font-bold">Comments</h3>
28
+ <button class="text-gray-500 hover:text-gray-700" id="close-comment-modal">
29
+ <i data-feather="x"></i>
30
+ </button>
31
+ </div>
32
+ <div class="space-y-4 mb-4" id="comments-container">
33
+ ${post.comments > 0 ? '' : '<p class="text-gray-500 text-center py-4">No comments yet</p>'}
34
+ </div>
35
+ <div class="flex items-center">
36
+ <input type="text" placeholder="Add a comment..." class="flex-1 px-4 py-2 border rounded-l-lg focus:ring-blue-500 focus:border-blue-500" id="comment-input">
37
+ <button class="bg-blue-600 text-white px-4 py-2 rounded-r-lg hover:bg-blue-700 transition" id="post-comment">
38
+ <i data-feather="send"></i>
39
+ </button>
40
+ </div>
41
+ </div>
42
+ `;
43
+ document.body.appendChild(modal);
44
+ feather.replace();
45
+
46
+ document.getElementById('close-comment-modal').addEventListener('click', () => {
47
+ modal.remove();
48
+ });
49
+
50
+ document.getElementById('post-comment').addEventListener('click', () => {
51
+ const commentInput = document.getElementById('comment-input');
52
+ const comment = commentInput.value.trim();
53
+ if (comment) {
54
+ // In a real app, you would save the comment
55
+ alert(`Comment posted: ${comment}`);
56
+ commentInput.value = '';
57
+ }
58
+ });
59
+ }
60
+
61
+ function showShareOptions(post) {
62
+ const modal = document.createElement('div');
63
+ modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
64
+ modal.innerHTML = `
65
+ <div class="bg-white rounded-xl p-6 max-w-md w-full">
66
+ <div class="flex justify-between items-center mb-4">
67
+ <h3 class="text-xl font-bold">Share Post</h3>
68
+ <button class="text-gray-500 hover:text-gray-700" id="close-share-modal">
69
+ <i data-feather="x"></i>
70
+ </button>
71
+ </div>
72
+ <div class="space-y-4">
73
+ <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
74
+ <i data-feather="copy"></i>
75
+ <span>Copy Link</span>
76
+ </button>
77
+ <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
78
+ <i data-feather="twitter"></i>
79
+ <span>Share on Twitter</span>
80
+ </button>
81
+ <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
82
+ <i data-feather="facebook"></i>
83
+ <span>Share on Facebook</span>
84
+ </button>
85
+ </div>
86
+ </div>
87
+ `;
88
+ document.body.appendChild(modal);
89
+ feather.replace();
90
+
91
+ document.getElementById('close-share-modal').addEventListener('click', () => {
92
+ modal.remove();
93
+ });
94
+
95
+ modal.querySelectorAll('button').forEach(btn => {
96
+ if (btn.id !== 'close-share-modal') {
97
+ btn.addEventListener('click', () => {
98
+ alert(`Post shared via ${btn.textContent.trim()}`);
99
+ modal.remove();
100
+ });
101
+ }
102
+ });
103
+ }
104
+ );
105
+
106
+ showLogin.addEventListener('click', (e) => {
107
+ e.preventDefault();
108
+ registerForm.classList.add('hidden');
109
+ loginForm.classList.remove('hidden');
110
+ });
111
+
112
+ loginForm.addEventListener('submit', (e) => {
113
+ e.preventDefault();
114
+ const email = document.getElementById('login-email').value;
115
+ const password = document.getElementById('login-password').value;
116
+ loginUser(email, password);
117
+ });
118
+
119
+ registerForm.addEventListener('submit', (e) => {
120
+ e.preventDefault();
121
+ const name = document.getElementById('register-name').value;
122
+ const username = document.getElementById('register-username').value;
123
+ const email = document.getElementById('register-email').value;
124
+ const password = document.getElementById('register-password').value;
125
+ registerUser(name, username, email, password);
126
+ });
127
+ }
128
+ }
129
+
130
+ function loginUser(email, password) {
131
+ const user = users.find(u => u.email === email && u.password === password);
132
+ if (user) {
133
+ currentUser = user;
134
+ localStorage.setItem('currentUser', JSON.stringify(user));
135
+ window.location.href = '/';
136
+ } else {
137
+ alert('Invalid credentials');
138
+ }
139
+ }
140
+
141
+ function registerUser(name, username, email, password) {
142
+ if (users.some(u => u.email === email)) {
143
+ alert('Email already registered');
144
+ return;
145
+ }
146
+ if (users.some(u => u.username === username)) {
147
+ alert('Username already taken');
148
+ return;
149
+ }
150
+
151
+ const newUser = {
152
+ id: Date.now(),
153
+ name,
154
+ username,
155
+ email,
156
+ password,
157
+ avatar: `http://static.photos/people/200x200/${Math.floor(Math.random() * 100)}`,
158
+ followers: [],
159
+ following: []
160
+ };
161
+
162
+ users.push(newUser);
163
+ localStorage.setItem('users', JSON.stringify(users));
164
+ currentUser = newUser;
165
+ localStorage.setItem('currentUser', JSON.stringify(newUser));
166
+ window.location.href = '/';
167
+ }
168
+
169
+ function logoutUser() {
170
+ currentUser = null;
171
+ localStorage.removeItem('currentUser');
172
+ window.location.href = '/auth.html';
173
+ }
174
+
175
+ // Post management
176
+ function createPost(content, image = null) {
177
+ const newPost = {
178
+ id: Date.now(),
179
  user: {
180
+ name: currentUser.name,
181
+ username: currentUser.username,
182
+ avatar: currentUser.avatar
183
+ },
184
+ content,
185
+ image,
186
+ timestamp: 'Just now',
187
+ likes: 0,
188
+ comments: 0,
189
+ shares: 0,
190
+ isLiked: false,
191
+ isSaved: false
192
+ };
193
+
194
+ posts.unshift(newPost);
195
+ localStorage.setItem('posts', JSON.stringify(posts));
196
+ return newPost;
197
+ }
198
+
199
+ // Sample data for posts if none exists
200
+ if (posts.length === 0) {
201
+ const samplePosts = [
202
+ {
203
+ id: 1,
204
+ user: {
205
  name: "Sarah Johnson",
206
  username: "@sarahj",
207
  avatar: "http://static.photos/people/200x200/4"
 
269
 
270
  // Initialize the feed
271
  document.addEventListener('DOMContentLoaded', function() {
272
+ // Initialize auth forms if on auth page
273
+ initAuthForms();
274
+
275
+ // Check if user is logged in
276
+ const storedUser = localStorage.getItem('currentUser');
277
+ if (storedUser) {
278
+ currentUser = JSON.parse(storedUser);
279
+ } else if (window.location.pathname !== '/auth.html') {
280
+ window.location.href = '/auth.html';
281
+ return;
282
+ }
283
+
284
+ // Initialize UI if on main page
285
+ if (document.getElementById('feed-container')) {
286
+ loadPosts();
287
+
288
+ // Load more button event
289
+ document.getElementById('load-more').addEventListener('click', loadPosts);
290
+
291
+ // Post creation form
292
+ const postForm = document.getElementById('post-form');
293
+ if (postForm) {
294
+ postForm.addEventListener('submit', (e) => {
295
+ e.preventDefault();
296
+ const content = document.getElementById('post-content').value;
297
+ const image = document.getElementById('post-image').files[0];
298
+
299
+ if (content.trim() === '') return;
300
+
301
+ if (image) {
302
+ const reader = new FileReader();
303
+ reader.onload = (e) => {
304
+ const newPost = createPost(content, e.target.result);
305
+ prependPost(newPost);
306
+ };
307
+ reader.readAsDataURL(image);
308
+ } else {
309
+ const newPost = createPost(content);
310
+ prependPost(newPost);
311
+ }
312
+
313
+ postForm.reset();
314
+ });
315
+ }
316
 
317
+ // Add logout functionality
318
+ const logoutBtn = document.getElementById('logout-btn');
319
+ if (logoutBtn) {
320
+ logoutBtn.addEventListener('click', logoutUser);
321
+ }
322
+ }
323
+ });
324
  // Load posts into the feed
325
  function loadPosts() {
326
  const feedContainer = document.getElementById('feed-container');
327
 
328
+ // Get posts from local storage
329
+ const storedPosts = JSON.parse(localStorage.getItem('posts')) || [];
330
 
331
+ // Filter out already viewed posts
332
+ const newPosts = storedPosts.filter(post => !viewedPosts.has(post.id));
333
+ // If no new posts, show message
334
  if (newPosts.length === 0) {
335
  if (feedContainer.children.length === 0) {
336
  feedContainer.innerHTML = `
 
407
  }
408
 
409
  // Handle post interactions
410
+ function prependPost(post) {
411
+ const feedContainer = document.getElementById('feed-container');
412
+ const firstChild = feedContainer.firstChild;
413
+
414
+ const postElement = createPostElement(post);
415
+
416
+ if (firstChild) {
417
+ feedContainer.insertBefore(postElement, firstChild);
418
+ } else {
419
+ feedContainer.appendChild(postElement);
420
+ }
421
+
422
+ viewedPosts.add(post.id);
423
+ currentPosts.unshift(post);
424
+ feather.replace();
425
+ }
426
+
427
+ function createPostElement(post) {
428
+ const postElement = document.createElement('div');
429
+ postElement.className = 'post-card bg-white border-b last:border-b-0 fade-in';
430
+ postElement.innerHTML = `
431
+ <div class="p-6">
432
+ <div class="flex items-start">
433
+ <img src="${post.user.avatar}" alt="${post.user.name}" class="w-12 h-12 rounded-full user-avatar">
434
+ <div class="ml-4 flex-1">
435
+ <div class="flex items-center">
436
+ <h3 class="font-bold">${post.user.name}</h3>
437
+ <span class="ml-2 text-gray-500 text-sm">${post.user.username}</span>
438
+ <span class="mx-2 text-gray-300">•</span>
439
+ <span class="text-gray-500 text-sm">${post.timestamp}</span>
440
+ </div>
441
+ <p class="mt-2 post-content">${post.content}</p>
442
+ ${post.image ? `<img src="${post.image}" alt="Post image" class="mt-4 rounded-xl w-full">` : ''}
443
+ <div class="mt-4 flex space-x-6">
444
+ <button class="interaction-btn ${post.isLiked ? 'active' : ''}" data-action="like" data-id="${post.id}">
445
+ <i data-feather="heart" class="w-4 h-4"></i>
446
+ <span>${post.likes}</span>
447
+ </button>
448
+ <button class="interaction-btn" data-action="comment" data-id="${post.id}">
449
+ <i data-feather="message-circle" class="w-4 h-4"></i>
450
+ <span>${post.comments}</span>
451
+ </button>
452
+ <button class="interaction-btn" data-action="share" data-id="${post.id}">
453
+ <i data-feather="share-2" class="w-4 h-4"></i>
454
+ <span>${post.shares}</span>
455
+ </button>
456
+ <button class="interaction-btn ml-auto ${post.isSaved ? 'active' : ''}" data-action="save" data-id="${post.id}">
457
+ <i data-feather="bookmark" class="w-4 h-4"></i>
458
+ </button>
459
+ </div>
460
+ </div>
461
+ </div>
462
+ </div>
463
+ `;
464
+ return postElement;
465
+ }
466
+
467
  function handleInteraction(e) {
468
  const button = e.currentTarget;
469
  const action = button.getAttribute('data-action');
470
  const postId = parseInt(button.getAttribute('data-id'));
471
 
472
+ // Find the post in storage
473
+ const storedPosts = JSON.parse(localStorage.getItem('posts')) || [];
474
+ const postIndex = storedPosts.findIndex(p => p.id === postId);
475
+ if (!post) return;
476
 
477
  // Update UI based on action
478
  switch(action) {
 
501
 
502
  case 'comment':
503
  // In a real app, this would open comment section
504
+ // Update storage
505
+ storedPosts[postIndex] = post;
506
+ localStorage.setItem('posts', JSON.stringify(storedPosts));
507
+
508
+ // Update current posts
509
+ const currentPostIndex = currentPosts.findIndex(p => p.id === postId);
510
+ if (currentPostIndex !== -1) {
511
+ currentPosts[currentPostIndex] = post;
512
+ }
513
+
514
+ // Show comment modal
515
+ showCommentModal(post);
516
+ break;
517
 
518
  case 'share':
519
  // In a real app, this would open share options
520
+ // Update storage
521
+ storedPosts[postIndex] = post;
522
+ localStorage.setItem('posts', JSON.stringify(storedPosts));
523
+
524
+ // Show share options
525
+ showShareOptions(post);
526
+ break;
527
  }
528
  }
style.css CHANGED
@@ -46,11 +46,19 @@ body {
46
  color: var(--primary);
47
  background-color: #dbeafe;
48
  }
49
-
50
  .post-content {
51
  line-height: 1.6;
52
  }
53
 
 
 
 
 
 
 
 
 
 
54
  .user-avatar {
55
  transition: transform 0.2s ease;
56
  }
 
46
  color: var(--primary);
47
  background-color: #dbeafe;
48
  }
 
49
  .post-content {
50
  line-height: 1.6;
51
  }
52
 
53
+ /* Post form styling */
54
+ #post-form textarea {
55
+ resize: none;
56
+ }
57
+
58
+ /* Dropdown menu */
59
+ .group:hover .group-hover\:block {
60
+ display: block;
61
+ }
62
  .user-avatar {
63
  transition: transform 0.2s ease;
64
  }