89 lines
No EOL
4.2 KiB
HTML
89 lines
No EOL
4.2 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Settings - Vim Docs{% endblock %}
|
|
|
|
{% block header_title %}Settings{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="max-w-4xl mx-auto p-6">
|
|
<div class="bg-gray-800 shadow-md rounded-lg overflow-hidden">
|
|
<div class="border-b border-gray-700 p-6">
|
|
<h2 class="text-xl font-semibold text-white mb-2">User Settings</h2>
|
|
<p class="text-gray-400">Customize your Vim Docs experience</p>
|
|
</div>
|
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="p-4 m-4 {{ 'bg-red-600/20 text-red-400' if category == 'error' else 'bg-green-600/20 text-green-400' }} rounded-md">
|
|
{{ message }}
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
<form method="POST" action="{{ url_for('auth.settings') }}" class="p-6 space-y-6">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<div>
|
|
<h3 class="text-lg font-medium text-white mb-4">Theme Settings</h3>
|
|
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-400 mb-2">
|
|
Primary Color
|
|
</label>
|
|
<div class="flex items-center">
|
|
<input type="color" id="theme_color" name="theme_color"
|
|
value="{{ current_user.theme_color }}"
|
|
class="h-10 w-20 bg-transparent rounded border border-gray-600">
|
|
<span class="ml-3 text-gray-400 text-sm">{{ current_user.theme_color }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
<p class="text-sm text-gray-400 mb-2">Color Presets</p>
|
|
<div class="flex gap-2">
|
|
<button type="button" data-color="#50fa7b" class="preset-color w-8 h-8 rounded-full bg-[#50fa7b]"></button>
|
|
<button type="button" data-color="#bd93f9" class="preset-color w-8 h-8 rounded-full bg-[#bd93f9]"></button>
|
|
<button type="button" data-color="#ff79c6" class="preset-color w-8 h-8 rounded-full bg-[#ff79c6]"></button>
|
|
<button type="button" data-color="#f1fa8c" class="preset-color w-8 h-8 rounded-full bg-[#f1fa8c]"></button>
|
|
<button type="button" data-color="#8be9fd" class="preset-color w-8 h-8 rounded-full bg-[#8be9fd]"></button>
|
|
<button type="button" data-color="#ffb86c" class="preset-color w-8 h-8 rounded-full bg-[#ffb86c]"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-6 pt-6 border-t border-gray-700">
|
|
<button type="submit" class="px-4 py-2 bg-primary text-black rounded-md hover:bg-primary-dark transition-colors">
|
|
Save Settings
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const colorInput = document.getElementById('theme_color');
|
|
const presetButtons = document.querySelectorAll('.preset-color');
|
|
|
|
presetButtons.forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
const color = this.getAttribute('data-color');
|
|
colorInput.value = color;
|
|
|
|
// Apply selected style to the button
|
|
presetButtons.forEach(btn => btn.classList.remove('ring-2', 'ring-white'));
|
|
this.classList.add('ring-2', 'ring-white');
|
|
});
|
|
|
|
// Apply selected style to the current color on load
|
|
if (button.getAttribute('data-color') === colorInput.value) {
|
|
button.classList.add('ring-2', 'ring-white');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |