opencompletion.com/templates/index.html
Russell d46818b5dd
Redesign user interface across all pages (#42)
* 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>
2025-11-12 09:24:49 -05:00

279 lines
9.2 KiB
HTML

<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenCompletion - AI-Powered Chat Rooms</title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
<style>
body {
font-family: Arial, sans-serif;
background-color: var(--bg-page);
color: var(--text-primary);
display: grid;
place-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
transition: background-color 0.3s ease, color 0.3s ease;
}
#main-container {
background-color: var(--bg-card);
border-radius: 10px;
padding: 30px;
width: 100%;
max-width: 800px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s ease;
}
h1 {
color: var(--text-primary);
margin-bottom: 10px;
text-align: center;
transition: color 0.3s ease;
}
.tagline {
text-align: center;
color: var(--text-secondary);
margin-bottom: 30px;
transition: color 0.3s ease;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
margin-bottom: 30px;
}
.stat-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 8px;
text-align: center;
}
.stat-number {
font-size: 32px;
font-weight: bold;
margin-bottom: 5px;
}
.stat-label {
font-size: 14px;
opacity: 0.9;
}
#join-section {
background-color: var(--bg-section);
border-radius: 8px;
padding: 25px;
margin-bottom: 20px;
transition: background-color 0.3s ease;
}
#join-section h2 {
margin-top: 0;
color: var(--text-primary);
transition: color 0.3s ease;
}
#join-room-form {
display: grid;
gap: 10px;
}
input[type="text"] {
width: 100%;
border: 2px solid var(--border-color);
border-radius: 5px;
padding: 12px;
font-size: 16px;
box-sizing: border-box;
background-color: var(--bg-card);
color: var(--text-primary);
transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
input[type="text"]:focus {
outline: none;
border-color: #667eea;
}
.room-type-selector {
display: grid;
grid-auto-flow: column;
grid-auto-columns: max-content;
gap: 20px;
align-items: center;
padding: 10px 0;
}
.room-type-selector label {
display: grid;
grid-auto-flow: column;
align-items: center;
gap: 5px;
cursor: pointer;
font-size: 16px;
}
.room-type-selector input[type="radio"] {
width: auto;
cursor: pointer;
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 5px;
padding: 12px;
font-size: 16px;
cursor: pointer;
transition: transform 0.2s;
}
button:hover {
transform: translateY(-2px);
}
.auth-status {
text-align: center;
padding: 15px;
background: var(--bg-status);
border-radius: 8px;
margin-bottom: 20px;
transition: background-color 0.3s ease;
}
.auth-status.logged-in {
background: var(--bg-status-logged);
}
.browse-link {
text-align: center;
margin-top: 20px;
}
.browse-link a {
color: #667eea;
text-decoration: none;
font-weight: bold;
}
.browse-link a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="main-container">
<h1>🚀 OpenCompletion</h1>
<p class="tagline">Machine Learning Powered Collaboration</p>
<!-- Statistics -->
<div class="stats-grid">
<div class="stat-card">
<div class="stat-number">{{ stats.total_public_rooms }}</div>
<div class="stat-label">Public Rooms</div>
</div>
{% if user %}
<div class="stat-card">
<div class="stat-number">{{ stats.total_private_rooms }}</div>
<div class="stat-label">Private Rooms</div>
</div>
{% endif %}
<div class="stat-card">
<div class="stat-number">{{ stats.active_public_rooms }}</div>
<div class="stat-label">Active Rooms</div>
</div>
<div class="stat-card">
<div class="stat-number">{{ stats.active_users }}</div>
<div class="stat-label">Active Users</div>
</div>
</div>
<!-- Auth status -->
{% if user %}
<div class="auth-status logged-in">
✅ Signed in as <strong>{{ user.display_name }}</strong> ({{ user.email }})
<div style="margin-top: 10px;">
<a href="/profile" style="color: #667eea; text-decoration: none; font-weight: bold;">⚙️ Profile Settings</a>
</div>
</div>
{% else %}
<div class="auth-status">
👋 Welcome! <a href="/auth">Sign in</a> to create private rooms
</div>
{% endif %}
<!-- Join room form -->
<div id="join-section">
<h2>Join or Create a Room</h2>
<form id="join-room-form">
<input id="room" type="text" placeholder="Enter room name" required>
<div class="room-type-selector">
<label>
<input type="radio" name="room-type" value="public" checked>
🌍 Public Room
</label>
<label>
<input type="radio" name="room-type" value="private">
🔐 Private Room
</label>
</div>
<button type="submit">Create/Join Room</button>
</form>
</div>
<div class="browse-link">
<a href="/browse">Or browse existing rooms →</a>
</div>
</div>
<script>
// Theme persistence
const savedTheme = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', savedTheme);
document.getElementById('join-room-form').addEventListener('submit', async function(e) {
e.preventDefault();
const roomInput = document.getElementById('room').value.trim();
const roomType = document.querySelector('input[name="room-type"]:checked').value;
if (!roomInput) {
alert('Please enter a room name');
return;
}
const room = slugify(roomInput);
if (!room) {
alert('Please enter a valid room name with at least some letters or numbers');
return;
}
// If private room, check authentication
if (roomType === 'private') {
{% if not user %}
alert('You must be signed in to create private rooms. Please sign in first.');
window.location.href = '/auth';
return;
{% endif %}
// Create private room via API
try {
const response = await fetch('/api/rooms/create', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: room,
is_private: true
})
});
const data = await response.json();
if (response.ok) {
window.location.href = `/chat/${data.room.name}`;
} else {
alert(data.error || 'Failed to create private room');
}
} catch (error) {
alert('Network error. Please try again.');
}
} else {
// Public room - just navigate
window.location.href = `/chat/${room}`;
}
});
</script>
</body>
</html>