Bton commited on
Commit
3a87226
·
verified ·
1 Parent(s): e1c35e4

Perfect! were now on the unanswered filter, perfect. Now, in the dashboard post section, I NEED to see a bunch of placeholder posts

Browse files
Files changed (1) hide show
  1. script.js +79 -29
script.js CHANGED
@@ -71,15 +71,66 @@ document.addEventListener('DOMContentLoaded', function() {
71
  setActiveNav(unansweredLink);
72
  showUnansweredPanel();
73
  updateUnansweredCount();
74
- // Store sample posts for later use
75
- window.placeholderPosts = samplePosts.map(post => ({
76
- title: post.title,
77
- body: post.body,
78
- tags: post.tags,
79
- responses: post.responses,
80
- time: "2 hours ago",
81
- status: "unanswered"
82
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  });
84
  // Navigation
85
  allQuestionsLink.addEventListener('click', function(e) {
@@ -141,27 +192,26 @@ function showUnansweredPanel() {
141
  }));
142
  feedContainer.appendChild(postElement);
143
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
- // Add placeholder posts if any
146
- if (window.placeholderPosts && window.placeholderPosts.length > 0) {
147
- window.placeholderPosts.forEach(post => {
148
- const postElement = document.createElement('custom-post-card');
149
- postElement.setAttribute('post', JSON.stringify({
150
- title: post.title,
151
- content: post.body,
152
- tags: post.tags,
153
- responses: post.responses,
154
- time: post.time,
155
- status: post.status,
156
- confidence: Math.floor(Math.random() * 100),
157
- upvotes: Math.floor(Math.random() * 10),
158
- author: "Student " + Math.floor(Math.random() * 100)
159
- }));
160
- feedContainer.appendChild(postElement);
161
- });
162
- }
163
-
164
- postsList.appendChild(feedContainer);
165
  feather.replace();
166
  // Highlight unanswered filter in sidebar
167
  const sidebar = document.querySelector('custom-sidebar');
 
71
  setActiveNav(unansweredLink);
72
  showUnansweredPanel();
73
  updateUnansweredCount();
74
+
75
+ // Store sample posts for later use
76
+ window.placeholderPosts = [
77
+ {
78
+ title: "Binary Search Tree Implementation",
79
+ body: "Need help implementing insert function for BST in Python.",
80
+ tags: ["BST", "Python", "Data Structures"],
81
+ responses: 0,
82
+ time: "30 minutes ago",
83
+ status: "unanswered"
84
+ },
85
+ {
86
+ title: "Lecture 8 Slides Question",
87
+ body: "Confused about time complexity analysis on slide 25.",
88
+ tags: ["Lecture", "Time Complexity"],
89
+ responses: 0,
90
+ time: "1 hour ago",
91
+ status: "unanswered"
92
+ },
93
+ {
94
+ title: "HW3 Problem 5 Solution",
95
+ body: "Looking for optimal solution approach for problem 5 in homework 3.",
96
+ tags: ["Homework", "Algorithms"],
97
+ responses: 0,
98
+ time: "2 hours ago",
99
+ status: "unanswered"
100
+ },
101
+ {
102
+ title: "Recursion vs Iteration",
103
+ body: "When should I prefer recursion over iteration for tree traversal?",
104
+ tags: ["Recursion", "Trees"],
105
+ responses: 0,
106
+ time: "3 hours ago",
107
+ status: "unanswered"
108
+ },
109
+ {
110
+ title: "Debugging Segmentation Fault",
111
+ body: "Getting segmentation fault when running my linked list code.",
112
+ tags: ["Debugging", "C++"],
113
+ responses: 0,
114
+ time: "4 hours ago",
115
+ status: "unanswered"
116
+ },
117
+ {
118
+ title: "Midterm Preparation",
119
+ body: "What topics should I focus on for the midterm exam?",
120
+ tags: ["Exam", "Study"],
121
+ responses: 0,
122
+ time: "5 hours ago",
123
+ status: "unanswered"
124
+ },
125
+ {
126
+ title: "Project Partner Needed",
127
+ body: "Looking for a partner for the final project. Strong in Python.",
128
+ tags: ["Project", "Partner"],
129
+ responses: 0,
130
+ time: "6 hours ago",
131
+ status: "unanswered"
132
+ }
133
+ ];
134
  });
135
  // Navigation
136
  allQuestionsLink.addEventListener('click', function(e) {
 
192
  }));
193
  feedContainer.appendChild(postElement);
194
  });
195
+ // Add all placeholder posts
196
+ window.placeholderPosts.forEach(post => {
197
+ const postElement = document.createElement('custom-post-card');
198
+ postElement.setAttribute('post', JSON.stringify({
199
+ title: post.title,
200
+ content: post.body,
201
+ tags: post.tags,
202
+ responses: post.responses,
203
+ time: post.time,
204
+ status: post.status,
205
+ confidence: Math.floor(Math.random() * 100),
206
+ upvotes: Math.floor(Math.random() * 10),
207
+ author: "Student " + Math.floor(Math.random() * 100)
208
+ }));
209
+ feedContainer.appendChild(postElement);
210
+ });
211
 
212
+ // Update unanswered count
213
+ unansweredCount.textContent = window.placeholderPosts.length;
214
+ postsList.appendChild(feedContainer);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  feather.replace();
216
  // Highlight unanswered filter in sidebar
217
  const sidebar = document.querySelector('custom-sidebar');