Files
balanceboard/templates/settings_profile.html
chelsea e821a26b48 Initial commit: BalanceBoard - Reddit-style content aggregator
- Flask-based web application with PostgreSQL
- User authentication and session management
- Content moderation and filtering
- Docker deployment with docker-compose
- Admin interface for content management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-11 16:11:13 -05:00

350 lines
10 KiB
HTML

{% extends "base.html" %}
{% block title %}Profile Settings - BalanceBoard{% endblock %}
{% block extra_css %}
<style>
.settings-container {
max-width: 800px;
margin: 0 auto;
padding: 24px;
}
.settings-header {
margin-bottom: 32px;
}
.settings-header h1 {
color: var(--text-primary);
margin-bottom: 8px;
}
.settings-header p {
color: var(--text-secondary);
font-size: 1.1rem;
}
.settings-content {
background: var(--surface-color);
border-radius: 12px;
padding: 32px;
border: 1px solid var(--border-color);
}
.profile-section {
margin-bottom: 32px;
}
.profile-section:last-child {
margin-bottom: 0;
}
.profile-section h2 {
color: var(--text-primary);
margin-bottom: 16px;
font-size: 1.3rem;
}
.profile-avatar {
display: flex;
align-items: center;
gap: 24px;
margin-bottom: 32px;
padding: 24px;
background: var(--surface-elevation-1);
border-radius: 12px;
}
.avatar-preview {
width: 120px;
height: 120px;
border-radius: 50%;
background: var(--primary-color);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 2.5rem;
font-weight: bold;
position: relative;
overflow: hidden;
}
.avatar-preview img {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
.avatar-info h3 {
color: var(--text-primary);
margin-bottom: 8px;
}
.avatar-info p {
color: var(--text-secondary);
margin-bottom: 16px;
}
.form-group {
margin-bottom: 24px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: var(--text-primary);
}
.form-group input {
width: 100%;
padding: 12px 16px;
border: 2px solid var(--border-color);
border-radius: 8px;
font-size: 1rem;
transition: all 0.2s ease;
box-sizing: border-box;
}
.form-group input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(77, 182, 172, 0.1);
}
.file-upload {
position: relative;
display: inline-block;
}
.file-upload input[type="file"] {
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.file-upload-label {
display: inline-block;
padding: 10px 20px;
background: var(--primary-color);
color: white;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s ease;
font-weight: 500;
}
.file-upload-label:hover {
background: var(--primary-hover);
transform: translateY(-1px);
}
.btn-primary {
padding: 12px 24px;
background: var(--primary-color);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-primary:hover {
background: var(--primary-hover);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(77, 182, 172, 0.3);
}
.btn-secondary {
background: var(--surface-elevation-1);
color: var(--text-primary);
margin-left: 12px;
}
.btn-secondary:hover {
background: var(--surface-elevation-2);
}
.form-actions {
display: flex;
gap: 12px;
padding-top: 24px;
border-top: 1px solid var(--divider-color);
}
.help-text {
font-size: 0.9rem;
color: var(--text-secondary);
margin-top: 4px;
}
.flash-messages {
margin-bottom: 24px;
}
.flash-message {
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 12px;
font-size: 0.95rem;
}
.flash-message.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.flash-message.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
@media (max-width: 768px) {
.profile-avatar {
flex-direction: column;
text-align: center;
}
.form-actions {
flex-direction: column;
}
.btn-secondary {
margin-left: 0;
}
}
</style>
{% endblock %}
{% block content %}
<div class="settings-container">
<div class="settings-header">
<h1>Profile Settings</h1>
<p>Manage your account information and profile picture</p>
</div>
<div class="settings-content">
<div class="flash-messages">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="flash-message {{ category }}">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>
<form method="POST">
<div class="profile-section">
<h2>Profile Picture</h2>
<div class="profile-avatar">
<div class="avatar-preview">
{% if user.profile_picture_url %}
<img src="{{ user.profile_picture_url }}" alt="{{ user.username }}">
{% else %}
{{ user.username[0]|upper }}
{% endif %}
</div>
<div class="avatar-info">
<h3>Current Avatar</h3>
<p>Upload a new profile picture to personalize your account</p>
<div class="file-upload">
<input type="file" id="avatar" name="avatar" accept="image/*" onchange="document.getElementById('upload-form').submit()">
<label for="avatar" class="file-upload-label">Choose New Picture</label>
</div>
<p class="help-text">PNG, JPG, or GIF. Maximum size 2MB.</p>
</div>
</div>
</div>
</form>
<form id="upload-form" method="POST" action="{{ url_for('upload_avatar') }}" enctype="multipart/form-data" style="display: none;">
<input type="hidden" name="avatar" id="avatar-hidden">
</form>
<form method="POST">
<div class="profile-section">
<h2>Account Information</h2>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" value="{{ user.username }}" required>
<p class="help-text">This is how other users will see you on BalanceBoard</p>
</div>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" value="{{ user.email }}" required>
<p class="help-text">We'll use this for account notifications and password recovery</p>
</div>
</div>
<div class="profile-section">
<h2>Account Details</h2>
<div style="padding: 20px; background: var(--surface-elevation-1); border-radius: 8px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
<span style="color: var(--text-secondary);">Account Type:</span>
<span style="color: var(--text-primary); font-weight: 500;">
{% if user.is_admin %}Administrator{% else %}User{% endif %}
</span>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
<span style="color: var(--text-secondary);">Member Since:</span>
<span style="color: var(--text-primary); font-weight: 500;">
{{ user.created_at.strftime('%B %d, %Y') }}
</span>
</div>
{% if user.last_login %}
<div style="display: flex; justify-content: space-between;">
<span style="color: var(--text-secondary);">Last Login:</span>
<span style="color: var(--text-primary); font-weight: 500;">
{{ user.last_login.strftime('%B %d, %Y at %I:%M %p') }}
</span>
</div>
{% endif %}
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn-primary">Save Changes</button>
<a href="{{ url_for('settings') }}" class="btn-primary btn-secondary">Cancel</a>
</div>
</form>
</div>
</div>
<script>
// Handle file upload
document.getElementById('avatar').addEventListener('change', function(e) {
const file = e.target.files[0];
if (file) {
// Check file size (2MB limit)
if (file.size > 2 * 1024 * 1024) {
alert('File size must be less than 2MB');
e.target.value = '';
return;
}
// Check file type
const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'];
if (!allowedTypes.includes(file.type)) {
alert('Please upload a valid image file (PNG, JPG, or GIF)');
e.target.value = '';
return;
}
// Submit the upload form
document.getElementById('upload-form').submit();
}
});
</script>
{% endblock %}