feat: Modernize user profile with tabs for about, submissions, etc.
This commit is contained in:
1 parent
295f5f588e
commit
258348cb0d
1 file changed
+88
-17
@@ -1,25 +1,96 @@
|
||||
<div class="user-profile space-y-4">
|
||||
<div>
|
||||
<span class="font-medium text-text-title">Username:</span>
|
||||
<span class="text-text-muted">{{ page.username }}</span>
|
||||
<div class="user-profile">
|
||||
<!-- User Header -->
|
||||
<div class="mb-6 pb-4 border-b border-gray-200">
|
||||
<h1 class="text-3xl font-bold text-text-title mb-1">{{ page.username }}</h1>
|
||||
<p class="text-sm text-text-muted">
|
||||
Joined: {{ page.created }} | Merits: {{ page.merits }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span class="font-medium text-text-title">Created:</span>
|
||||
<span class="text-text-muted">{{ page.created }}</span>
|
||||
|
||||
<!-- Tabs Navigation -->
|
||||
<div class="mb-4 border-b border-gray-200">
|
||||
<nav class="-mb-px flex space-x-8" aria-label="Tabs">
|
||||
<button class="tab-button whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm border-primary text-primary" data-target="tab-about">
|
||||
About
|
||||
</button>
|
||||
<button class="tab-button whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-target="tab-submissions">
|
||||
Submissions
|
||||
</button>
|
||||
<button class="tab-button whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-target="tab-comments">
|
||||
Comments
|
||||
</button>
|
||||
<button class="tab-button whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-target="tab-favorites">
|
||||
Favorites
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content Panes -->
|
||||
<div>
|
||||
<span class="font-medium text-text-title">Merits:</span>
|
||||
<span class="text-text-muted">{{ page.merits }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="font-medium text-text-title block mb-1">About:</span>
|
||||
<div class="text-text-muted mb-3">
|
||||
<div id="tab-about" class="tab-pane">
|
||||
<div class="text-text-muted prose max-w-none"> <!-- Added prose for potential markdown styling -->
|
||||
{{ page.about | markdownify }}
|
||||
</div>
|
||||
<div class="flex space-x-4 text-sm font-action">
|
||||
<a href="{{ page.submissions_uri }}" class="text-primary hover:underline">submissions</a>
|
||||
<a href="{{ page.comments_uri }}" class="text-primary hover:underline">comments</a>
|
||||
<a href="{{ page.favorites_uri }}" class="text-primary hover:underline">favorites</a>
|
||||
</div>
|
||||
<div id="tab-submissions" class="tab-pane hidden">
|
||||
<p class="text-text-muted">User submissions will be listed here.</p>
|
||||
<!-- Placeholder: Add Liquid logic to loop through user's submissions -->
|
||||
<!-- Example:
|
||||
{% assign user_submissions = site.posts | where: "author", page.username %}
|
||||
<ul>
|
||||
{% for post in user_submissions %}
|
||||
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<div id="tab-comments" class="tab-pane hidden">
|
||||
<p class="text-text-muted">User comments will be listed here.</p>
|
||||
<!-- Placeholder: Add Liquid logic to loop through user's comments -->
|
||||
<!-- Example:
|
||||
{% assign user_comments = site.comments | where: "author", page.username %}
|
||||
<ul>
|
||||
{% for comment in user_comments %}
|
||||
<li>{{ comment.content | truncatewords: 15 }} - <a href="{{ comment.post_url }}#comment-{{ comment.id }}">view</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<div id="tab-favorites" class="tab-pane hidden">
|
||||
<p class="text-text-muted">User favorites will be listed here.</p>
|
||||
<!-- Placeholder: Add Liquid logic to loop through user's favorites -->
|
||||
<!-- This depends heavily on how favorites are stored -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const tabs = document.querySelectorAll('.tab-button');
|
||||
const panes = document.querySelectorAll('.tab-pane');
|
||||
|
||||
tabs.forEach(tab => {
|
||||
tab.addEventListener('click', function() {
|
||||
const targetId = this.getAttribute('data-target');
|
||||
|
||||
// Update tab appearance
|
||||
tabs.forEach(t => {
|
||||
t.classList.remove('border-primary', 'text-primary');
|
||||
t.classList.add('border-transparent', 'text-gray-500', 'hover:text-gray-700', 'hover:border-gray-300');
|
||||
});
|
||||
this.classList.add('border-primary', 'text-primary');
|
||||
this.classList.remove('border-transparent', 'text-gray-500', 'hover:text-gray-700', 'hover:border-gray-300');
|
||||
|
||||
|
||||
// Update pane visibility
|
||||
panes.forEach(pane => {
|
||||
if (pane.id === targetId) {
|
||||
pane.classList.remove('hidden');
|
||||
} else {
|
||||
pane.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user