42 lines
1.8 KiB
Plaintext
42 lines
1.8 KiB
Plaintext
{% comment %}
|
|
Mobile Comment View: Renders a flat list of top-level comments for the current post.
|
|
Assumes JavaScript will handle the navigation to nested replies using fragment identifiers.
|
|
{% endcomment %}
|
|
|
|
{% assign top_level_comments = site.comments | where: "post", page.slug | where_exp: "item", "item.parent == nil" | sort: "date" %}
|
|
|
|
<div id="mobile-comments-list" class="space-y-4">
|
|
{% if top_level_comments.size > 0 %}
|
|
{% for comment in top_level_comments %}
|
|
{% assign direct_replies = site.comments | where: "parent", comment.slug %}
|
|
<div class="border-b border-gray-200 pb-3 mb-3" id="comment-{{ comment.slug }}">
|
|
<div class="flex justify-between items-center mb-1">
|
|
<small class="text-xs text-primary">
|
|
<a href="#" class="text-text-muted hover:underline">@{{ comment.author }}</a>
|
|
<span class="text-text-muted opacity-75 ml-2">{{ comment.date | date: "%b %d, %Y" }}</span>
|
|
</small>
|
|
</div>
|
|
<p class="text-sm mb-2">{{ comment.content }}</p>
|
|
<div class="text-right">
|
|
<a href="#comment-{{ comment.slug }}" class="view-replies text-xs text-primary hover:underline">
|
|
View Replies ({{ direct_replies.size }}) <i class="fas fa-chevron-right text-xs"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<p class="text-sm text-text-muted">No comments yet.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% comment %}
|
|
Placeholder for where JavaScript would load the replies for a selected comment.
|
|
Example structure for a reply view (to be managed by JS):
|
|
|
|
<div id="mobile-comment-thread-{{ some_comment_slug }}" class="hidden">
|
|
<button class="back-to-list text-primary mb-2"> < Back to Comments</button>
|
|
<!-- Display parent comment -->
|
|
<!-- List replies for parent comment -->
|
|
</div>
|
|
{% endcomment %}
|