feat: Create standalone merits page with filter/sort UI

This commit is contained in:
Kerby Martino (aider) committed 2025-05-08 13:20:12 +08:00
1 parent 41761086a0
commit eae97f3304
2 files changed
+116

No files matched your search

+110
View File
@@ -0,0 +1,110 @@
---
layout: default # Assuming 'default' is your base layout
---
<div class="container mx-auto px-4 py-8">
<h1 class="text-2xl font-bold text-text-title mb-6">{{ page.title | default: "Merit History" }}</h1>
<!-- Filter and Sort Controls -->
<div class="mb-6 p-4 bg-gray-100 rounded-md">
<div class="flex flex-col sm:flex-row justify-between items-center space-y-4 sm:space-y-0">
<!-- Filter by Type -->
<div class="filter-controls flex flex-col space-y-3 sm:flex-row sm:space-y-0 sm:space-x-2 sm:items-center">
<span class="text-sm font-medium text-gray-700 mr-2 hidden sm:inline">Filter by:</span>
<button data-filter="all" class="merit-filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 border-primary bg-primary/10 rounded-md hover:border-primary transition-colors">
<span class="text-sm font-action font-medium text-primary">All</span>
</button>
<button data-filter="upvotes" class="merit-filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 border-gray-300 rounded-md hover:border-primary transition-colors">
<i class="fas fa-arrow-up fa-fw text-primary"></i>
<span class="text-sm font-action font-medium text-primary">Upvotes</span>
</button>
<button data-filter="comments" class="merit-filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 border-gray-300 rounded-md hover:border-primary transition-colors">
<i class="fas fa-comments fa-fw text-primary"></i>
<span class="text-sm font-action font-medium text-primary">Comments</span>
</button>
<button data-filter="posts" class="merit-filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 border-gray-300 rounded-md hover:border-primary transition-colors">
<i class="fas fa-file-alt fa-fw text-primary"></i>
<span class="text-sm font-action font-medium text-primary">Posts</span>
</button>
</div>
<!-- Sort Dropdown -->
<div class="sort-controls flex items-center space-x-2">
<label for="merit-sort-select" class="text-sm font-medium text-gray-700">Sort by:</label>
<select id="merit-sort-select" class="sort-select text-sm font-action bg-white border border-gray-300 rounded-md px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary cursor-pointer">
<option value="newest" selected>Newest</option>
<option value="oldest">Oldest</option>
<option value="amount_high_low">Merit Amount (High to Low)</option>
<option value="amount_low_high">Merit Amount (Low to High)</option>
</select>
</div>
</div>
</div>
<!-- Merit List -->
<div id="merit-list-container" class="space-y-4">
{% comment %}
TODO: Implement Liquid logic for filtering and sorting actual merit data.
This would involve:
1. Accessing the merit data (e.g., from site.data.merit_events or a collection).
2. Applying filters based on URL parameters or JavaScript-driven selections.
3. Sorting the filtered data.
4. Iterating over the processed data to display merit items.
For now, static examples are shown below.
{% endcomment %}
{% assign static_merit_events_for_demo = true %} <!-- Set to false when dynamic data is ready -->
{% if static_merit_events_for_demo %}
<ul class="space-y-4">
<li class="p-4 bg-white rounded-md shadow border border-gray-200">
<small class="text-sm block">
<span class="text-primary font-bold">+1 Merit</span>
<span class="text-text-muted opacity-75">– Upvote received on post:</span>
<a href="#" class="text-primary font-action hover:underline">"Found the perfect focus playlist"</a>
<span class="text-text-muted text-xs opacity-75 ml-1">May 04, 2025 10:30 AM</span>
</small>
</li>
<li class="p-4 bg-white rounded-md shadow border border-gray-200">
<small class="text-sm block">
<span class="text-primary font-bold">+2 Merits</span>
<span class="text-text-muted opacity-75">– New comment on your post:</span>
<a href="#" class="text-primary font-action hover:underline">"My standing desk setup"</a>
<span class="text-text-muted text-xs opacity-75 ml-1">May 03, 2025 08:15 PM</span>
</small>
</li>
<li class="p-4 bg-white rounded-md shadow border border-gray-200">
<small class="text-sm block">
<span class="text-primary font-bold">+5 Merits</span>
<span class="text-text-muted opacity-75">– Created new post:</span>
<a href="#" class="text-primary font-action hover:underline">"The best ergonomic accessories..."</a>
<span class="text-text-muted text-xs opacity-75 ml-1">May 02, 2025 11:00 AM</span>
</small>
</li>
<li class="p-4 bg-white rounded-md shadow border border-gray-200">
<small class="text-sm block">
<span class="text-primary font-bold">+1 Merit</span>
<span class="text-text-muted opacity-75">– Upvote received on comment for:</span>
<a href="#" class="text-primary font-action hover:underline">"Office plants that actually survive..."</a>
<span class="text-text-muted text-xs opacity-75 ml-1">May 01, 2025 09:45 AM</span>
</small>
</li>
</ul>
{% else %}
<div class="text-center text-gray-500 font-action py-10 bg-white rounded-md shadow border border-gray-200">
<p>No merit activity found matching your criteria.</p>
{% comment %} Or: <p>You have no merit activity yet.</p> {% endcomment %}
</div>
{% endif %}
</div>
<!-- Pagination/More Button (Placeholder) -->
{% if static_merit_events_for_demo %}
<div class="pt-6 text-center">
<button type="button" class="px-6 py-3 bg-primary text-white text-sm font-medium rounded-md hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda font-action">
Load More
</button>
</div>
{% endif %}
</div>
{{ content }}