opencompletion.com/templates/browse.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

294 lines
9.5 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>Browse Rooms - OpenCompletion</title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<style>
body {
font-family: Arial, sans-serif;
background-color: var(--bg-page);
color: var(--text-primary);
margin: 0;
padding: 20px;
transition: background-color 0.3s ease, color 0.3s ease;
}
.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 ease;
}
.header-actions {
display: grid;
grid-auto-flow: column;
gap: 10px;
}
.btn {
background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 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;
}
.room-tabs {
max-width: 1400px;
margin: 0 auto 20px;
display: grid;
grid-auto-flow: column;
grid-auto-columns: max-content;
gap: 10px;
border-bottom: 2px solid #e1e1e1;
}
.room-tab {
background: none;
border: none;
padding: 12px 24px;
font-size: 16px;
cursor: pointer;
color: var(--text-secondary);
border-bottom: 3px solid transparent;
transition: all 0.3s;
}
.room-tab:hover {
color: var(--button-primary);
}
.room-tab.active {
color: var(--button-primary);
border-bottom-color: var(--button-primary);
font-weight: bold;
}
.rooms-container {
max-width: 1400px;
margin: 0 auto;
}
.room-section {
display: none;
}
.room-section.active {
display: block;
}
.rooms-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.room-card {
background: var(--bg-card);
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s ease;
cursor: pointer;
text-decoration: none;
color: inherit;
display: block;
}
.room-card:hover {
transform: translateY(-4px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.room-card-header {
display: grid;
grid-template-columns: 1fr auto;
align-items: start;
margin-bottom: 10px;
}
.room-name {
font-size: 20px;
font-weight: bold;
color: var(--button-primary);
margin: 0 0 5px 0;
}
.room-title {
color: var(--text-secondary);
font-size: 14px;
margin: 8px 0;
line-height: 1.4;
transition: color 0.3s ease;
}
.room-meta {
display: grid;
grid-auto-flow: column;
grid-auto-columns: max-content;
gap: 15px;
margin-top: 12px;
font-size: 14px;
color: var(--text-muted);
transition: color 0.3s ease;
}
.room-meta-item {
display: grid;
grid-auto-flow: column;
align-items: center;
gap: 5px;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: var(--text-muted);
transition: color 0.3s ease;
}
.empty-state h3 {
color: var(--text-secondary);
margin-bottom: 10px;
transition: color 0.3s ease;
}
.auth-prompt {
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: 8px;
padding: 20px;
text-align: center;
margin-bottom: 20px;
}
.auth-prompt button {
margin-top: 10px;
}
@media (max-width: 768px) {
.rooms-grid {
grid-template-columns: 1fr;
}
.header {
grid-template-columns: 1fr;
}
.header-actions {
grid-auto-flow: row;
}
}
</style>
</head>
<body>
<div class="header">
<h1>🚀 Browse Rooms</h1>
<div class="header-actions">
<a href="/" class="btn">🏠 Home</a>
{% if user %}
<a href="/profile" class="btn btn-secondary">👤 {{ user.display_name }}</a>
{% else %}
<a href="/auth" class="btn btn-secondary">🔐 Sign In</a>
{% endif %}
</div>
</div>
<div class="room-tabs">
<button class="room-tab active" onclick="switchTab('public')">
🌍 Public Rooms
</button>
<button class="room-tab" onclick="switchTab('private')">
🔐 Private Rooms
</button>
</div>
<div class="rooms-container">
<!-- Public Rooms -->
<div id="public-section" class="room-section active">
{% if public_rooms %}
<div class="rooms-grid">
{% for room in public_rooms %}
<a href="{{ url_for('chat', room_name=room.name) }}" class="room-card">
<div class="room-card-header">
<h3 class="room-name">{{ room.name }}</h3>
<span class="badge badge-public">Public</span>
</div>
{% if room.title %}
<p class="room-title">{{ room.title }}</p>
{% endif %}
<div class="room-meta">
<span class="room-meta-item">
👥 {{ room.get_active_users()|length }} active
</span>
</div>
</a>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<h3>No public rooms yet</h3>
<p>Be the first to create one!</p>
<a href="/" class="btn">Create a Room</a>
</div>
{% endif %}
</div>
<!-- Private Rooms -->
<div id="private-section" class="room-section">
{% if user %}
{% if private_rooms %}
<div class="rooms-grid">
{% for room in private_rooms %}
<a href="{{ url_for('chat', room_name=room.name) }}" class="room-card">
<div class="room-card-header">
<h3 class="room-name">{{ room.name }}</h3>
<span class="badge badge-private">Private</span>
</div>
{% if room.title %}
<p class="room-title">{{ room.title }}</p>
{% endif %}
<div class="room-meta">
<span class="room-meta-item">
👥 {{ room.get_active_users()|length }} active
</span>
</div>
</a>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<h3>No private rooms yet</h3>
<p>Create your first private room!</p>
<a href="/" class="btn">Create a Room</a>
</div>
{% endif %}
{% else %}
<div class="auth-prompt">
<h3>🔒 Private rooms are only visible to you</h3>
<p>Sign in to create and access your private rooms</p>
<a href="/auth" class="btn">Sign In / Sign Up</a>
</div>
{% endif %}
</div>
</div>
<script>
// Theme persistence
const savedTheme = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', savedTheme);
function switchTab(tab) {
// Update tab buttons
document.querySelectorAll('.room-tab').forEach(btn => {
btn.classList.remove('active');
});
event.target.classList.add('active');
// Update sections
document.querySelectorAll('.room-section').forEach(section => {
section.classList.remove('active');
});
document.getElementById(tab + '-section').classList.add('active');
}
</script>
</body>
</html>