* Redesign UI: unified design system across all pages
- Replace scattered inline CSS with comprehensive single style.css
- Implement modern design system:
- System font stack (-apple-system, Segoe UI, etc.)
- Consistent spacing scale (4px base)
- Unified color tokens for light/dark themes
- Reusable component classes (buttons, cards, badges, forms)
- Update all templates to use new CSS classes:
- browse.html: Less chunky, better space usage with room-grid
- index.html: Cleaner centered card layout
- auth.html: Streamlined 4-step flow with gradient background
- profile.html: Modern settings interface
- search.html: Browse-style card layout
- Chat page improvements:
- Tighter layouts (240px/280px sidebars instead of 15%/25%)
- Better message spacing
- Improved code blocks with proper padding
- Cleaner utility belt
- Better responsive design and dark mode support
* modified: app.py
modified: templates/base.html
modified: templates/profile.html
* Revert standalone pages to original design
- Browse, index, auth, profile restored to original inline CSS
- Chat page improvements preserved in style.css
- Search page still uses improved card layout
* Add dark mode support to index and browse pages
- index.html now supports dark mode with CSS variables
- browse.html now supports dark mode with CSS variables
- Theme persists from localStorage across pages
* Remove theme toggle from chat page
- Theme toggle button removed from desktop chat sidebar
- Theme toggle button removed from mobile chat modal
- Theme management now done via profile page only
* Make usernames clickable links to profile pages in chat
* Update search page to match browse page layout and CSS
* Fix chat layout positioning
* Fix room list auto-update when title changes
* Fix new room creation appearing in sidebar
- Add socketio.emit in create_room_api() to broadcast new rooms
- Update socket handler to add new rooms to sidebar dynamically
- Rooms now appear without hard refresh
* Fix /title and /cancel commands being sent to LLM
- Add missing return statements after command handlers
- Commands now properly terminate message processing
- Prevents commands from being interpreted as chat messages
* Make usernames in user lists clickable links to profiles
- Update updateUserLists() to create links for all usernames
- Add hover effect CSS for user list links
- Works for both active and inactive users
- Works for both desktop and mobile views
* Revert user list profile links and update profile page layout
- Remove profile links from user lists (no backend route for other users)
- Update profile page to full-screen layout like browse page
- Add header with navigation buttons
- Remove centered container, use full-width layout
- Add box shadows to sections for visual separation
* Convert all flexbox layouts to CSS grid
- Replace all display: flex with CSS grid equivalents
- Update templates: profile, browse, search, index, auth
- Update static CSS for consistent grid usage
- Use grid-template-columns, grid-auto-flow, and place-items
- Improve layout consistency across all pages
* Fix chatroom horizontal scrolling
- Add overflow-x: hidden to #chat-container and #chat to prevent horizontal scroll
- Add word-break and overflow-wrap to message content for text wrapping
- Change pre tags from overflow: hidden to overflow-x: auto for individual scrolling
- Add min-width: 0 to grid containers to prevent overflow
- Code blocks can now scroll individually while chatroom wraps content
* Remove duplicate CSS variables and fix XSS vulnerability
- search.html: Remove inline styles, link to style.css
- index.html: Remove duplicate CSS variable blocks, link to style.css
- browse.html: Remove duplicate CSS variable blocks, link to style.css
- chat.html: Fix XSS vulnerability in room list updates
- Use textContent/createTextNode instead of innerHTML for user data
- Use DOM methods instead of string concatenation
- Encode URL components with encodeURIComponent
- Extract user count from textContent instead of innerHTML regex
* Merge duplicate CSS rules and replace inline styles with design system
style.css:
- Merge duplicate html, body rules (lines 137-143 and 159-167)
- Consolidate typography and layout properties in single rule
- Remove duplicate BASE LAYOUT section
profile.html:
- Replace style.display mutations with classList API
- Add .availability-indicator.show CSS rule for visibility
- Use classList.add('show') and classList.remove('show')
- Consistent with existing .message.show pattern
browse.html:
- Replace hard-coded gradient colors with CSS variables
- Use var(--gradient-start) and var(--gradient-end) for buttons
- Replace #667eea with var(--button-primary) for tabs and room names
- Remove inline .room-badge styles, use .badge .badge-public/.badge-private
- Apply existing badge classes from style.css for dark mode support
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Russell Ballestrini <russell@unturf.com>
437 lines
14 KiB
HTML
437 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Profile Settings - OpenCompletion</title>
|
|
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
|
<style>
|
|
:root {
|
|
--bg-primary: #ffffff;
|
|
--bg-secondary: #f7f7f7;
|
|
--bg-tertiary: #e1e1e1;
|
|
--text-primary: #333333;
|
|
--text-secondary: #666666;
|
|
--border-color: #e1e1e1;
|
|
--button-primary: #667eea;
|
|
--button-hover: #764ba2;
|
|
--input-bg: #ffffff;
|
|
--input-border: #e1e1e1;
|
|
--success-color: #28a745;
|
|
--error-color: #dc3545;
|
|
}
|
|
|
|
[data-theme="dark"] {
|
|
--bg-primary: #1a1a1a;
|
|
--bg-secondary: #2d2d2d;
|
|
--bg-tertiary: #3d3d3d;
|
|
--text-primary: #e1e1e1;
|
|
--text-secondary: #a0a0a0;
|
|
--border-color: #3d3d3d;
|
|
--button-primary: #667eea;
|
|
--button-hover: #764ba2;
|
|
--input-bg: #2d2d2d;
|
|
--input-border: #3d3d3d;
|
|
--success-color: #28a745;
|
|
--error-color: #dc3545;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: var(--bg-secondary);
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
padding: 20px;
|
|
transition: background-color 0.3s, color 0.3s;
|
|
}
|
|
|
|
.header {
|
|
max-width: 1400px;
|
|
margin: 0 auto 30px;
|
|
display: grid;
|
|
grid-template-columns: 1fr auto;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.header h1 {
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.header-actions {
|
|
display: grid;
|
|
grid-auto-flow: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.btn {
|
|
background: linear-gradient(135deg, var(--button-primary) 0%, var(--button-hover) 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
padding: 10px 20px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.btn:hover {
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #6c757d;
|
|
}
|
|
|
|
.content-container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.subtitle {
|
|
text-align: center;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 30px;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.section {
|
|
background-color: var(--bg-primary);
|
|
border-radius: 8px;
|
|
padding: 25px;
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.section h2 {
|
|
margin-top: 0;
|
|
color: var(--text-primary);
|
|
font-size: 18px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
color: var(--text-secondary);
|
|
font-size: 14px;
|
|
}
|
|
|
|
input[type="text"] {
|
|
width: 100%;
|
|
border: 2px solid var(--input-border);
|
|
border-radius: 5px;
|
|
padding: 12px;
|
|
font-size: 16px;
|
|
box-sizing: border-box;
|
|
background-color: var(--input-bg);
|
|
color: var(--text-primary);
|
|
transition: border-color 0.3s;
|
|
}
|
|
|
|
input[type="text"]:focus {
|
|
outline: none;
|
|
border-color: var(--button-primary);
|
|
}
|
|
|
|
.availability-indicator {
|
|
font-size: 14px;
|
|
margin-top: 5px;
|
|
min-height: 20px;
|
|
display: none;
|
|
}
|
|
|
|
.availability-indicator.show {
|
|
display: block;
|
|
}
|
|
|
|
.available {
|
|
color: var(--success-color);
|
|
}
|
|
|
|
.unavailable {
|
|
color: var(--error-color);
|
|
}
|
|
|
|
.current-value {
|
|
background-color: var(--bg-tertiary);
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
margin-bottom: 15px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.current-value strong {
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
button {
|
|
background: linear-gradient(135deg, var(--button-primary) 0%, var(--button-hover) 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
padding: 12px 24px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
transition: transform 0.2s;
|
|
width: 100%;
|
|
}
|
|
|
|
button:hover {
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
button:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.theme-selector {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 10px;
|
|
}
|
|
|
|
.theme-option {
|
|
padding: 15px;
|
|
border: 2px solid var(--input-border);
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
text-align: center;
|
|
transition: all 0.3s;
|
|
background-color: var(--input-bg);
|
|
}
|
|
|
|
.theme-option:hover {
|
|
border-color: var(--button-primary);
|
|
}
|
|
|
|
.theme-option.active {
|
|
border-color: var(--button-primary);
|
|
background-color: var(--bg-tertiary);
|
|
}
|
|
|
|
.theme-option .icon {
|
|
font-size: 32px;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.header {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
.header-actions {
|
|
grid-auto-flow: row;
|
|
}
|
|
}
|
|
|
|
.message {
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
margin-bottom: 15px;
|
|
display: none;
|
|
}
|
|
|
|
.message.success {
|
|
background-color: var(--success-color);
|
|
color: white;
|
|
}
|
|
|
|
.message.error {
|
|
background-color: var(--error-color);
|
|
color: white;
|
|
}
|
|
|
|
.message.show {
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>⚙️ Profile Settings</h1>
|
|
<div class="header-actions">
|
|
<a href="/" class="btn">🏠 Home</a>
|
|
<a href="/browse" class="btn btn-secondary">📋 Browse Rooms</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-container">
|
|
<p class="subtitle">Manage your account preferences</p>
|
|
|
|
<!-- Username Section -->
|
|
<div class="section">
|
|
<h2>Change Username</h2>
|
|
<div class="current-value">
|
|
Current username: <strong>{{ user.display_name }}</strong>
|
|
</div>
|
|
<div id="username-message" class="message"></div>
|
|
<form id="username-form">
|
|
<div class="form-group">
|
|
<label for="new-username">New Username</label>
|
|
<input
|
|
type="text"
|
|
id="new-username"
|
|
placeholder="Enter new username"
|
|
pattern="[a-zA-Z0-9_-]{3,50}"
|
|
title="3-50 characters (letters, numbers, underscores, hyphens only)"
|
|
required
|
|
>
|
|
<div id="availability-indicator" class="availability-indicator"></div>
|
|
</div>
|
|
<button type="submit" id="update-username-btn" disabled>Update Username</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Theme Section -->
|
|
<div class="section">
|
|
<h2>Appearance</h2>
|
|
<div class="theme-selector">
|
|
<div class="theme-option" data-theme="light" onclick="setTheme('light')">
|
|
<div class="icon">☀️</div>
|
|
<div>Light Mode</div>
|
|
</div>
|
|
<div class="theme-option" data-theme="dark" onclick="setTheme('dark')">
|
|
<div class="icon">🌙</div>
|
|
<div>Dark Mode</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let checkTimeout;
|
|
const currentUsername = "{{ user.display_name }}";
|
|
|
|
// Theme Management
|
|
function setTheme(theme) {
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
localStorage.setItem('theme', theme);
|
|
|
|
// Update active state
|
|
document.querySelectorAll('.theme-option').forEach(option => {
|
|
option.classList.remove('active');
|
|
});
|
|
document.querySelector(`.theme-option[data-theme="${theme}"]`).classList.add('active');
|
|
}
|
|
|
|
// Load saved theme on page load
|
|
const savedTheme = localStorage.getItem('theme') || 'light';
|
|
setTheme(savedTheme);
|
|
|
|
// Username availability check
|
|
document.getElementById('new-username').addEventListener('input', function(e) {
|
|
const username = e.target.value.trim();
|
|
const indicator = document.getElementById('availability-indicator');
|
|
const submitBtn = document.getElementById('update-username-btn');
|
|
|
|
// Clear previous timeout
|
|
clearTimeout(checkTimeout);
|
|
|
|
// Hide indicator and disable button if same as current username
|
|
if (username === currentUsername) {
|
|
indicator.textContent = '';
|
|
indicator.classList.remove('show');
|
|
submitBtn.disabled = true;
|
|
return;
|
|
}
|
|
|
|
// Show indicator when username changes
|
|
indicator.classList.add('show');
|
|
|
|
// Reset if empty
|
|
if (!username) {
|
|
indicator.textContent = '';
|
|
indicator.classList.remove('show');
|
|
submitBtn.disabled = true;
|
|
return;
|
|
}
|
|
|
|
// Validate format
|
|
const isValid = /^[a-zA-Z0-9_-]{3,50}$/.test(username);
|
|
if (!isValid) {
|
|
indicator.textContent = 'Invalid format (3-50 chars: letters, numbers, _, -)';
|
|
indicator.className = 'availability-indicator unavailable show';
|
|
submitBtn.disabled = true;
|
|
return;
|
|
}
|
|
|
|
// Check availability after 500ms delay
|
|
indicator.textContent = 'Checking availability...';
|
|
indicator.className = 'availability-indicator show';
|
|
|
|
checkTimeout = setTimeout(async () => {
|
|
try {
|
|
const response = await fetch(`/api/check-username?username=${encodeURIComponent(username)}`);
|
|
const data = await response.json();
|
|
|
|
if (data.available) {
|
|
indicator.textContent = '✓ Username is available';
|
|
indicator.className = 'availability-indicator available show';
|
|
submitBtn.disabled = false;
|
|
} else {
|
|
indicator.textContent = '✗ Username is already taken';
|
|
indicator.className = 'availability-indicator unavailable show';
|
|
submitBtn.disabled = true;
|
|
}
|
|
} catch (error) {
|
|
indicator.textContent = 'Error checking availability';
|
|
indicator.className = 'availability-indicator unavailable show';
|
|
submitBtn.disabled = true;
|
|
}
|
|
}, 500);
|
|
});
|
|
|
|
// Username update form
|
|
document.getElementById('username-form').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
|
|
const newUsername = document.getElementById('new-username').value.trim();
|
|
const messageDiv = document.getElementById('username-message');
|
|
const submitBtn = document.getElementById('update-username-btn');
|
|
|
|
submitBtn.disabled = true;
|
|
submitBtn.textContent = 'Updating...';
|
|
|
|
try {
|
|
const response = await fetch('/api/update-username', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({ new_username: newUsername })
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (response.ok) {
|
|
messageDiv.textContent = 'Username updated successfully! Redirecting...';
|
|
messageDiv.className = 'message success show';
|
|
|
|
// Redirect after 2 seconds
|
|
setTimeout(() => {
|
|
window.location.reload();
|
|
}, 2000);
|
|
} else {
|
|
messageDiv.textContent = data.error || 'Failed to update username';
|
|
messageDiv.className = 'message error show';
|
|
submitBtn.disabled = false;
|
|
submitBtn.textContent = 'Update Username';
|
|
}
|
|
} catch (error) {
|
|
messageDiv.textContent = 'Network error. Please try again.';
|
|
messageDiv.className = 'message error show';
|
|
submitBtn.disabled = false;
|
|
submitBtn.textContent = 'Update Username';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|