feat: Replace user profile tabs with a "Links" section
This commit is contained in:
1 parent
54584f1953
commit
c0b76a6eac
1 file changed
+12
-192
+12
-192
@@ -7,204 +7,24 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Tabs Navigation -->
|
||||
<div class="mb-4 border-b border-gray-200">
|
||||
<nav class="-mb-px flex space-x-8" aria-label="Tabs">
|
||||
<a href="#tab-about" class="group whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm
|
||||
border-primary text-primary [&:not(:target):not(:has(~:target))]:border-primary [&:not(:target):not(:has(~:target))]:text-primary
|
||||
[&: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">
|
||||
About
|
||||
</a>
|
||||
<a href="#tab-submissions" 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">
|
||||
Submissions
|
||||
</a>
|
||||
<a href="#tab-comments" 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">
|
||||
Comments
|
||||
</a>
|
||||
<a href="#tab-favorites" 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">
|
||||
Favorites
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content Panes -->
|
||||
<!-- Main Content Area -->
|
||||
<div>
|
||||
<div id="tab-about" class="block [&:not(:target)]:hidden [&:not(:target):not(:has(~:target))]:block">
|
||||
<!-- About Section (formerly tab-about) -->
|
||||
<div id="about-section">
|
||||
<div class="text-text-muted prose max-w-none">
|
||||
{{ page.about | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-submissions" class="hidden [&:target]:block">
|
||||
<p class="text-text-muted">User submissions will be listed here.</p>
|
||||
<!-- Post List -->
|
||||
<div class="post-list space-y-4">
|
||||
{% for post in site.posts %}
|
||||
<div class="mb-4">
|
||||
<article class="flex flex-col md:flex-row items-start">
|
||||
<div class="flex-1 text-left">
|
||||
<div>
|
||||
<!-- Post Title -->
|
||||
<p class="mt-0 mb-0.5">
|
||||
<strong>
|
||||
<a href="{{ post.url }}" class="text-text-title font-bold text-md md:text-sm hover:underline">
|
||||
{{ post.title }}
|
||||
</a>
|
||||
</strong>
|
||||
|
||||
<!-- Links Section -->
|
||||
<div class="pt-4 mt-6 border-t border-gray-200 space-y-4 font-action">
|
||||
<p><a href="{{ page.submissions_uri }}" class="text-primary text-sm hover:underline">View Submissions</a></p>
|
||||
<p><a href="{{ page.comments_uri }}" class="text-primary text-sm hover:underline">View Comments</a></p>
|
||||
<p class="text-sm">
|
||||
<a href="{{ page.favorites_uri }}" class="text-primary hover:underline">Favorite Submissions</a> /
|
||||
<a href="{{ page.favorites_uri }}&comments=t" class="text-primary hover:underline">Favorite Comments</a>
|
||||
<span class="text-text-muted text-xs"> (Publicly Visible)</span>
|
||||
</p>
|
||||
|
||||
<!-- Post Metadata -->
|
||||
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
|
||||
<div class="flex items-start space-x-2 mb-2 md:mb-0">
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fa-solid fa-arrow-up mr-1"></i> {{ post.upvotes }}
|
||||
</span>
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-reply mr-1"></i> REPLY
|
||||
</span>
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-comment mr-1"></i> {{ post.comments_count }}
|
||||
</span>
|
||||
</div>
|
||||
<small class="text-sm font-action">
|
||||
<a href="#" class="text-sm hover:underline">{{ post.author }}</a>
|
||||
<span class="text-text-muted text-sm opacity-75">{{ post.date | date: "%d %b %Y" }}</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<hr class="border-border-light my-4">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-comments" class="hidden [&:target]:block">
|
||||
<p class="text-text-muted">User comments will be listed here.</p>
|
||||
{% assign top_comments = site.comments | sort: "date" %}
|
||||
|
||||
<div class="mt-4">
|
||||
<div id="mobile-comments-list" class="space-y-4">
|
||||
{% for comment in top_comments %}
|
||||
<div class="border-b border-gray-200 pb-3 mb-3" id="mobile-comment-comment1">
|
||||
<p class="text-sm mb-2">{{ comment.content }}
|
||||
</p>
|
||||
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
|
||||
<div class="flex items-start space-x-2 mb-2 md:mb-0">
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fa-solid fa-arrow-up mr-1"></i> {{ comment.upvotes }}
|
||||
</span>
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-reply mr-1"></i> REPLY
|
||||
</span>
|
||||
<a href="/comments/{{ comment.slug }}" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-comment mr-1"></i> {{ comment.replies }}
|
||||
</a>
|
||||
</div>
|
||||
<small class="text-sm font-action">
|
||||
<a href="#" class="text-sm hover:underline">{{ comment.author }}</a>
|
||||
<span class="text-text-muted text-sm opacity-75">{{ comment.date | date: "%d %b %Y" }}</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-favorites" class="hidden [&:target]:block">
|
||||
{% assign user_posts = site.posts | where_exp: "post", "post.author == page.username" %}
|
||||
{% assign user_comments = site.comments | where_exp: "comment", "comment.author == page.username" %}
|
||||
{% assign user_activity = user_posts | concat: user_comments | sort: "date" | reverse %}
|
||||
|
||||
{% if user_activity and user_activity.size > 0 %}
|
||||
<div class="favorites-list space-y-4">
|
||||
{% for item in user_activity %}
|
||||
{% if item.title %}
|
||||
<!-- Render as Post -->
|
||||
<div class="mb-4">
|
||||
<article class="flex flex-col md:flex-row items-start">
|
||||
<div class="flex-1 text-left">
|
||||
<div>
|
||||
<!-- Post Title -->
|
||||
<p class="mt-0 mb-0.5">
|
||||
<strong>
|
||||
<a href="{{ item.url }}" class="text-text-title font-bold text-md md:text-sm hover:underline">
|
||||
{{ item.title }}
|
||||
</a>
|
||||
</strong>
|
||||
</p>
|
||||
<!-- Post Metadata -->
|
||||
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
|
||||
<div class="flex items-start space-x-2 mb-2 md:mb-0">
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fa-solid fa-arrow-up mr-1"></i> {{ item.upvotes | default: 0 }}
|
||||
</span>
|
||||
<!-- Link to the post's comment section -->
|
||||
<a href="{{ item.url }}#comments" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-reply mr-1"></i> REPLY
|
||||
</a>
|
||||
<a href="{{ item.url }}#comments" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-comment mr-1"></i> {{ item.comments_count | default: 0 }}
|
||||
</a>
|
||||
</div>
|
||||
<small class="text-sm font-action">
|
||||
<a href="/user/{{ item.author }}/" class="text-sm hover:underline">{{ item.author }}</a>
|
||||
<span class="text-text-muted text-sm opacity-75">{{ item.date | date: "%d %b %Y" }}</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<hr class="border-border-light my-4">
|
||||
</div>
|
||||
{% else %}
|
||||
<!-- Render as Comment -->
|
||||
{% comment %} Try to find the parent post using post_slug from comment front matter {% endcomment %}
|
||||
{% assign parent_post = site.posts | where: "slug", item.post_slug | first %}
|
||||
|
||||
{% if parent_post %}
|
||||
{% comment %} Construct URL to the comment on the parent post's page {% endcomment %}
|
||||
{% assign comment_anchor = '#comment-' | append: item.slug %}
|
||||
{% assign comment_url = parent_post.url | append: comment_anchor %}
|
||||
<div class="border-b border-gray-200 pb-3 mb-3">
|
||||
<p class="text-sm mb-2">{{ item.content | markdownify | strip_html }}</p>
|
||||
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
|
||||
<div class="flex items-start space-x-2 mb-2 md:mb-0">
|
||||
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fa-solid fa-arrow-up mr-1"></i> {{ item.upvotes | default: 0 }}
|
||||
</span>
|
||||
<!-- Link to the comment itself on the post page -->
|
||||
<a href="{{ comment_url }}" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-reply mr-1"></i> REPLY
|
||||
</a>
|
||||
<!-- Link to the comment itself on the post page -->
|
||||
<a href="{{ comment_url }}" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
|
||||
<i class="fas fa-link mr-1"></i> VIEW
|
||||
</a>
|
||||
</div>
|
||||
<small class="text-sm font-action">
|
||||
<a href="/user/{{ item.author }}/" class="text-sm hover:underline">{{ item.author }}</a>
|
||||
<span class="text-text-muted text-sm opacity-75">{{ item.date | date: "%d %b %Y" }}</span>
|
||||
<span class="text-text-muted text-sm opacity-75">on: <a href="{{ parent_post.url }}" class="hover:underline">{{ parent_post.title }}</a></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{% comment %} Optional: Render a fallback or error if parent post not found {% endcomment %}
|
||||
<!-- <div class="border-b border-gray-200 pb-3 mb-3 text-red-500 text-xs">Comment by {{item.author}} on {{item.date | date: "%d %b %Y"}} - Parent post '{{ item.post_slug }}' not found.</div> -->
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-text-muted">This user has no submissions or comments yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user