feat: Implement tabbed layout for account settings page

This commit is contained in:
Kerby Martino (aider) committed 2025-05-04 16:04:38 +08:00
1 parent db9cd51de9
commit 3120c54b6c
1 file changed
+42 -13
+42 -13
View File
@@ -9,10 +9,34 @@
</p> </p>
</div> </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-profile" 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">
Profile
</a>
<a href="#tab-preferences" 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">
Preferences
</a>
<a href="#tab-links" 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">
Links
</a>
</nav>
</div>
<!-- Tab Content Panes -->
<form class="space-y-6"> <form class="space-y-6">
<!-- Read-only Info --> <div id="tab-profile" class="block [&:not(:target)]:hidden [&:not(:target):not(:has(~:target))]:block space-y-6">
<div class="grid grid-cols-3 gap-4 text-sm"> <!-- Read-only Info -->
<div> <div class="grid grid-cols-3 gap-4 text-sm">
<div>
<span class="font-medium text-primary">User:</span> <span class="font-medium text-primary">User:</span>
<span class="text-primary ml-2">{{ page.username }}</span> <span class="text-primary ml-2">{{ page.username }}</span>
</div> </div>
@@ -41,11 +65,13 @@
<input type="email" id="email" name="email" value="{{ page.email }}" class="w-full text-primary text-sm px-3 py-2 bg-transparent border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out"> <input type="email" id="email" name="email" value="{{ page.email }}" class="w-full text-primary text-sm px-3 py-2 bg-transparent border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out">
<p class="mt-1 text-xs text-text-muted">Only admins see your email. To share publicly, add to the 'about' box.</p> <p class="mt-1 text-xs text-text-muted">Only admins see your email. To share publicly, add to the 'about' box.</p>
</div> </div>
</div> <!-- End of tab-profile -->
<!-- Settings Grid --> <div id="tab-preferences" class="hidden [&:target]:block space-y-6">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4"> <!-- Settings Grid -->
<!-- showdead --> <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div> <!-- showdead -->
<div>
<label for="showdead" class="block text-sm font-medium text-primary mb-1">Show Dead?</label> <label for="showdead" class="block text-sm font-medium text-primary mb-1">Show Dead?</label>
<select id="showdead" name="showd" class="w-full text-primary text-sm px-3 py-2 bg-white border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out"> <select id="showdead" name="showd" class="w-full text-primary text-sm px-3 py-2 bg-white border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out">
<option value="yes" {% if page.showdead == "yes" %}selected{% endif %}>Yes</option> <option value="yes" {% if page.showdead == "yes" %}selected{% endif %}>Yes</option>
@@ -75,10 +101,12 @@
<label for="delay" class="block text-sm font-medium text-primary mb-1">Submit Delay (mins)</label> <label for="delay" class="block text-sm font-medium text-primary mb-1">Submit Delay (mins)</label>
<input type="number" id="delay" name="delay" value="{{ page.delay }}" class="w-full text-primary text-sm px-3 py-2 bg-transparent border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out"> <input type="number" id="delay" name="delay" value="{{ page.delay }}" class="w-full text-primary text-sm px-3 py-2 bg-transparent border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition duration-150 ease-in-out">
</div> </div>
</div> </div>
</div> <!-- End of tab-preferences -->
<!-- Links Section --> <div id="tab-links" class="hidden [&:target]:block space-y-2">
<div class="pt-4 border-t border-gray-200 space-y-2"> <!-- Links Section -->
<div> <!-- Removed top border and padding from original div -->
<p><a href="{{ page.change_password_uri }}" class="text-primary text-sm hover:underline">Change Password</a></p> <p><a href="{{ page.change_password_uri }}" class="text-primary text-sm hover:underline">Change Password</a></p>
<p><a href="{{ page.submissions_uri }}" class="text-primary text-sm hover:underline">View Submissions</a></p> <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><a href="{{ page.comments_uri }}" class="text-primary text-sm hover:underline">View Comments</a></p>
@@ -87,10 +115,11 @@
<a href="{{ page.favorites_uri }}&amp;comments=t" class="text-primary hover:underline">Favorite Comments</a> <a href="{{ page.favorites_uri }}&amp;comments=t" class="text-primary hover:underline">Favorite Comments</a>
<span class="text-text-muted text-xs"> (Publicly Visible)</span> <span class="text-text-muted text-xs"> (Publicly Visible)</span>
</p> </p>
</div> </div>
</div> <!-- End of tab-links -->
<!-- Update Button --> <!-- Update Button (Moved outside tab panes) -->
<div class="pt-2"> <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>
</form> </form>