feat: Display merit earnings in account settings with icons and details
This commit is contained in:
1 parent
f9fe51b543
commit
787c5b36ec
1 file changed
+80
-1
@@ -28,6 +28,11 @@
|
|||||||
[&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300">
|
[&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300">
|
||||||
Links
|
Links
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#tab-merits" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm
|
||||||
|
[&:target]:border-primary [&:target]:text-primary
|
||||||
|
[&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300">
|
||||||
|
Merits
|
||||||
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -121,7 +126,81 @@
|
|||||||
</div>
|
</div>
|
||||||
</div> <!-- End of tab-links -->
|
</div> <!-- End of tab-links -->
|
||||||
|
|
||||||
<!-- Update Button (Moved outside tab panes) -->
|
<div id="tab-merits" class="hidden [&:target]:block space-y-4">
|
||||||
|
<h3 class="text-lg font-medium text-primary mb-4">Recent Merit Activity</h3>
|
||||||
|
{% comment %}
|
||||||
|
Placeholder for fetching actual merit events for the user.
|
||||||
|
Example structure:
|
||||||
|
{% assign user_merit_events = site.merit_events | where: "username", page.username | sort: "date" | reverse | limit: 10 %}
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% assign user_merit_events = "" %} <!-- Placeholder: Remove this line when real data is available -->
|
||||||
|
|
||||||
|
{% if user_merit_events.size > 0 %}
|
||||||
|
<ul class="space-y-4">
|
||||||
|
{% for event in user_merit_events %}
|
||||||
|
<li class="flex items-start space-x-3 p-3 border border-gray-200 rounded-md bg-white/50">
|
||||||
|
<div class="flex-shrink-0 pt-1">
|
||||||
|
{% if event.type == 'upvote' %}
|
||||||
|
<i class="fas fa-arrow-up text-green-500 fa-fw" title="Upvote"></i>
|
||||||
|
{% elsif event.type == 'comment' %}
|
||||||
|
<i class="fas fa-comment text-blue-500 fa-fw" title="Comment"></i>
|
||||||
|
{% elsif event.type == 'post' %}
|
||||||
|
<i class="fas fa-file-alt text-purple-500 fa-fw" title="Post"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fas fa-star text-yellow-500 fa-fw" title="Merit"></i>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow">
|
||||||
|
<p class="text-sm font-medium text-primary">
|
||||||
|
<span class="font-bold text-green-600">+{{ event.amount | default: 1 }} Merit</span>
|
||||||
|
{% if event.reason %} - {{ event.reason }}{% endif %}
|
||||||
|
{% if event.content_title %}
|
||||||
|
on <a href="{{ event.content_url }}" class="hover:underline">"{{ event.content_title | truncate: 50 }}"</a>
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
<p class="text-xs text-text-muted">{{ event.date | date: "%b %d, %Y %I:%M %p" }}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<!-- Static Examples for Demonstration -->
|
||||||
|
<ul class="space-y-4">
|
||||||
|
<li class="flex items-start space-x-3 p-3 border border-gray-200 rounded-md bg-white/50">
|
||||||
|
<div class="flex-shrink-0 pt-1"><i class="fas fa-arrow-up text-green-500 fa-fw" title="Upvote"></i></div>
|
||||||
|
<div class="flex-grow">
|
||||||
|
<p class="text-sm font-medium text-primary"><span class="font-bold text-green-600">+1 Merit</span> - Upvote received on post <a href="#" class="hover:underline">"Found the perfect focus playlist"</a></p>
|
||||||
|
<p class="text-xs text-text-muted">May 04, 2025 10:30 AM</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-start space-x-3 p-3 border border-gray-200 rounded-md bg-white/50">
|
||||||
|
<div class="flex-shrink-0 pt-1"><i class="fas fa-comment text-blue-500 fa-fw" title="Comment"></i></div>
|
||||||
|
<div class="flex-grow">
|
||||||
|
<p class="text-sm font-medium text-primary"><span class="font-bold text-green-600">+2 Merits</span> - New comment on your post <a href="#" class="hover:underline">"My standing desk setup"</a></p>
|
||||||
|
<p class="text-xs text-text-muted">May 03, 2025 08:15 PM</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-start space-x-3 p-3 border border-gray-200 rounded-md bg-white/50">
|
||||||
|
<div class="flex-shrink-0 pt-1"><i class="fas fa-file-alt text-purple-500 fa-fw" title="Post"></i></div>
|
||||||
|
<div class="flex-grow">
|
||||||
|
<p class="text-sm font-medium text-primary"><span class="font-bold text-green-600">+5 Merits</span> - Created new post <a href="#" class="hover:underline">"The best ergonomic accessories..."</a></p>
|
||||||
|
<p class="text-xs text-text-muted">May 02, 2025 11:00 AM</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-start space-x-3 p-3 border border-gray-200 rounded-md bg-white/50">
|
||||||
|
<div class="flex-shrink-0 pt-1"><i class="fas fa-arrow-up text-green-500 fa-fw" title="Upvote"></i></div>
|
||||||
|
<div class="flex-grow">
|
||||||
|
<p class="text-sm font-medium text-primary"><span class="font-bold text-green-600">+1 Merit</span> - Upvote received on comment for <a href="#" class="hover:underline">"Office plants that actually survive..."</a></p>
|
||||||
|
<p class="text-xs text-text-muted">May 01, 2025 09:45 AM</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- End Static Examples -->
|
||||||
|
{% endif %}
|
||||||
|
</div> <!-- End of tab-merits -->
|
||||||
|
|
||||||
|
<!-- Update Button (Remains outside tab panes) -->
|
||||||
<div class="pt-4 border-t border-gray-200">
|
<div class="pt-4 border-t border-gray-200">
|
||||||
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base 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">Update Profile</button>
|
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base 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">Update Profile</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user