Files
mc-webui/app/routes/views.py
T
MarekWo cdc8be9eb4 refactor(contacts): Implement multi-page Contact Management with advanced sorting
Split Contact Management into 3 dedicated pages for improved mobile usability:
- /contacts/manage - Settings & navigation hub (manual approval + cleanup)
- /contacts/pending - Full-screen pending contacts view
- /contacts/existing - Full-screen existing contacts with search/filter/sort

New Features:
- Advanced sorting: Name (A-Z/Z-A) & Last advert (newest/oldest)
- URL-based sort state (?sort=name&order=asc)
- Activity indicators: 🟢 active, 🟡 recent, 🔴 inactive
- Changed terminology: "Last seen" → "Last advert" (more accurate)
- Cleanup tool moved from Settings modal to Contact Management page

Technical Changes:
- Created contacts_base.html standalone template
- Split contacts.html into 3 specialized templates
- Refactored contacts.js for multi-page support with page detection
- Added 2 new Flask routes: /contacts/pending, /contacts/existing
- Removed cleanup section from base.html Settings modal

Mobile-first design: Each page has full-screen space with touch-friendly
navigation and back buttons.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 08:40:22 +01:00

86 lines
1.9 KiB
Python

"""
HTML views for mc-webui
"""
import logging
from flask import Blueprint, render_template, request
from app.config import config
logger = logging.getLogger(__name__)
views_bp = Blueprint('views', __name__)
@views_bp.route('/')
def index():
"""
Main chat view - displays message list and send form.
"""
return render_template(
'index.html',
device_name=config.MC_DEVICE_NAME,
refresh_interval=config.MC_REFRESH_INTERVAL
)
@views_bp.route('/dm')
def direct_messages():
"""
Direct Messages view - full-page DM interface.
Query params:
conversation: Optional conversation ID to open initially
"""
initial_conversation = request.args.get('conversation', '')
return render_template(
'dm.html',
device_name=config.MC_DEVICE_NAME,
refresh_interval=config.MC_REFRESH_INTERVAL,
initial_conversation=initial_conversation
)
@views_bp.route('/contacts/manage')
def contact_management():
"""
Contact Management Settings - manual approval + cleanup + navigation.
"""
return render_template(
'contacts-manage.html',
device_name=config.MC_DEVICE_NAME,
refresh_interval=config.MC_REFRESH_INTERVAL
)
@views_bp.route('/contacts/pending')
def contact_pending_list():
"""
Full-screen pending contacts list.
"""
return render_template(
'contacts-pending.html',
device_name=config.MC_DEVICE_NAME,
refresh_interval=config.MC_REFRESH_INTERVAL
)
@views_bp.route('/contacts/existing')
def contact_existing_list():
"""
Full-screen existing contacts list with search, filter, sort.
"""
return render_template(
'contacts-existing.html',
device_name=config.MC_DEVICE_NAME,
refresh_interval=config.MC_REFRESH_INTERVAL
)
@views_bp.route('/health')
def health():
"""
Health check endpoint for monitoring.
"""
return 'OK', 200