Revert "Filter own posts from feeds"
This reverts commit ab33da919b04cf2267bc171b3fc2d66f836238a7.
This commit is contained in:
parent
ab33da919b
commit
539c395beb
@ -34,17 +34,17 @@
|
||||
|
||||
<!-- Filter Buttons (optional) -->
|
||||
<div class="filter-buttons">
|
||||
<button class="filter-btn active" data-feed-filter="for-you">For You</button>
|
||||
<button class="filter-btn" data-feed-filter="following">Following</button>
|
||||
<button class="filter-btn" data-feed-filter="trending">Trending</button>
|
||||
<button class="filter-btn" data-feed-filter="recent">Recent</button>
|
||||
<button class="filter-btn active">For You</button>
|
||||
<button class="filter-btn">Following</button>
|
||||
<button class="filter-btn">Trending</button>
|
||||
<button class="filter-btn">Recent</button>
|
||||
</div>
|
||||
|
||||
<!-- Posts Grid (einfach als Liste / Grid – hier als Grid wie Marketplace) -->
|
||||
<div class="posts-grid">
|
||||
|
||||
<!-- Post 1 -->
|
||||
<div class="post-card" data-author-handle="@sarahj" data-popularity="128" data-recency="1" onclick="location.href='post-detail.html?id=1'">
|
||||
<div class="post-card" onclick="location.href='post-detail.html?id=1'">
|
||||
<div class="post-header">
|
||||
<img src="../images/content/creator1.png" alt="Sarah Jenkins" class="post-avatar">
|
||||
<div class="post-author">
|
||||
@ -68,7 +68,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Post 2 -->
|
||||
<div class="post-card" data-author-handle="@alexchen" data-popularity="98" data-recency="2" onclick="location.href='post-detail.html?id=2'">
|
||||
<div class="post-card" onclick="location.href='post-detail.html?id=2'">
|
||||
<div class="post-header">
|
||||
<img src="../images/content/creator2.png" alt="Alex Chen" class="post-avatar">
|
||||
<div class="post-author">
|
||||
@ -92,7 +92,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Post 3 -->
|
||||
<div class="post-card" data-author-handle="@miawong" data-popularity="212" data-recency="3" onclick="location.href='post-detail.html?id=3'">
|
||||
<div class="post-card" onclick="location.href='post-detail.html?id=3'">
|
||||
<div class="post-header">
|
||||
<img src="../images/content/creator3.png" alt="Mia Wong" class="post-avatar">
|
||||
<div class="post-author">
|
||||
@ -116,7 +116,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Post 4 -->
|
||||
<div class="post-card" data-author-handle="@tomrivera" data-popularity="64" data-recency="4" onclick="location.href='post-detail.html?id=4'">
|
||||
<div class="post-card" onclick="location.href='post-detail.html?id=4'">
|
||||
<div class="post-header">
|
||||
<img src="../images/content/creator4.png" alt="Tom Rivera" class="post-avatar">
|
||||
<div class="post-author">
|
||||
@ -161,51 +161,6 @@
|
||||
fetch('../html/topbar.html')
|
||||
.then(r => r.text())
|
||||
.then(data => document.getElementById('topbar-container').innerHTML = data);
|
||||
|
||||
const currentUserHandle = '@sunny_the_cat';
|
||||
const followedCreatorHandles = ['@sarahj', '@miawong'];
|
||||
const postsGrid = document.querySelector('.posts-grid');
|
||||
const feedButtons = document.querySelectorAll('[data-feed-filter]');
|
||||
const feedPosts = Array.from(document.querySelectorAll('.post-card'));
|
||||
|
||||
function getFollowingPosts() {
|
||||
return feedPosts.filter(post => {
|
||||
const authorHandle = post.dataset.authorHandle;
|
||||
return authorHandle !== currentUserHandle && followedCreatorHandles.includes(authorHandle);
|
||||
});
|
||||
}
|
||||
|
||||
function getPublicPosts() {
|
||||
return feedPosts.filter(post => post.dataset.authorHandle !== currentUserHandle);
|
||||
}
|
||||
|
||||
function renderFeed(filter) {
|
||||
let visiblePosts = filter === 'following' ? getFollowingPosts() : getPublicPosts();
|
||||
|
||||
if (filter === 'trending') {
|
||||
visiblePosts = visiblePosts.sort((a, b) => Number(b.dataset.popularity) - Number(a.dataset.popularity));
|
||||
}
|
||||
|
||||
if (filter === 'recent') {
|
||||
visiblePosts = visiblePosts.sort((a, b) => Number(a.dataset.recency) - Number(b.dataset.recency));
|
||||
}
|
||||
|
||||
feedPosts.forEach(post => post.hidden = true);
|
||||
visiblePosts.forEach(post => {
|
||||
post.hidden = false;
|
||||
postsGrid.appendChild(post);
|
||||
});
|
||||
}
|
||||
|
||||
feedButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
feedButtons.forEach(item => item.classList.remove('active'));
|
||||
button.classList.add('active');
|
||||
renderFeed(button.dataset.feedFilter);
|
||||
});
|
||||
});
|
||||
|
||||
renderFeed('for-you');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@ -96,11 +96,11 @@
|
||||
<div class="prompts-grid">
|
||||
|
||||
<!-- Prompt Card 1 -->
|
||||
<div class="prompt-card" data-author-handle="@sarahj">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market1.png" alt="Creative Blog Post Generator" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">Creative Blog Post Generator</h3>
|
||||
<div class="prompt-author">@sarahj</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Generate engaging blog posts in minutes to captivate your audience.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.8</span>
|
||||
@ -115,11 +115,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Prompt Card 2 -->
|
||||
<div class="prompt-card" data-author-handle="@alexchen">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market2.png" alt="Python Code Assistant" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">Python Code Assistant</h3>
|
||||
<div class="prompt-author">@alexchen</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Efficiently debug and write Python code with AI assistance.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.7</span>
|
||||
@ -134,11 +134,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Prompt Card 3 -->
|
||||
<div class="prompt-card" data-author-handle="@miawong">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market3.png" alt="Digital Art Style Guide" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">Digital Art Style Guide</h3>
|
||||
<div class="prompt-author">@miawong</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Create stunning digital art styles with this comprehensive guide.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.8</span>
|
||||
@ -153,11 +153,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Prompt Card 4 -->
|
||||
<div class="prompt-card" data-author-handle="@sunny_the_cat">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market4.png" alt="Marketing Copywriter" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">Marketing Copywriter</h3>
|
||||
<div class="prompt-author">@sunny_the_cat</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Generate engaging marketing copy in minutes.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.8</span>
|
||||
@ -172,11 +172,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Prompt Card 5 -->
|
||||
<div class="prompt-card" data-author-handle="@tomrivera">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market5.png" alt="Midjourney Image Prompts" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">Midjourney Image Prompts</h3>
|
||||
<div class="prompt-author">@tomrivera</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Curated prompts for stunning Midjourney images.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.7</span>
|
||||
@ -191,11 +191,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Prompt Card 6 -->
|
||||
<div class="prompt-card" data-author-handle="@liamob">
|
||||
<div class="prompt-card">
|
||||
<img src="../images/content/market6.png" alt="UI Design Assistant" class="prompt-img">
|
||||
<div class="prompt-info">
|
||||
<h3 class="prompt-title">UI Design Assistant</h3>
|
||||
<div class="prompt-author">@liamob</div>
|
||||
<div class="prompt-author">@JaneDoe</div>
|
||||
<p class="prompt-description">Generate UI components and design systems with AI.</p>
|
||||
<div class="prompt-rating">
|
||||
<span><i class="bi bi-star-fill"></i> 4.9</span>
|
||||
@ -232,14 +232,6 @@
|
||||
fetch('../html/topbar.html')
|
||||
.then(r => r.text())
|
||||
.then(data => document.getElementById('topbar-container').innerHTML = data);
|
||||
|
||||
const currentUserHandle = '@sunny_the_cat';
|
||||
|
||||
document.querySelectorAll('.prompt-card').forEach(prompt => {
|
||||
if (prompt.dataset.authorHandle === currentUserHandle) {
|
||||
prompt.remove();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user