{% extends "base.html" %} {% from "components/pagination.html" import render_pagination %} {% from "components/empty_state.html" import empty_state %} {% from "components/page_header.html" import page_header %} {% block title %}Messages · CampusCart{% endblock %} {% block content %}
{{ page_header('Messages', pagination.total|string ~ ' active conversation' ~ ('' if pagination.total == 1 else 's')) }} {% if pagination.items %}
{% for conversation in pagination.items %} {% set other = conversation.seller if conversation.buyer_id == current_user.id else conversation.buyer %} {% set other_name = other.profile.full_name if other.profile else other.email %} {% set cover = conversation.listing.images[0] if conversation.listing.images else None %} {% set activity = conversation.last_message_at or conversation.conversation_started_at %} {% set is_unread = conversation.id in unread_ids %}
{% if cover %} {{ conversation.listing.title }} {% else %}
No image
{% endif %} {% if is_unread %} {% endif %}

{{ conversation.listing.title }}

with {{ other_name }}

{% endfor %}

No conversations match your search.

{{ render_pagination(pagination, 'chat.inbox', {'sort': sort if sort != 'newest' else none}) }} {% else %} {{ empty_state('bi-chat-dots', 'No messages yet', 'When you message a seller about a listing, your conversations will appear here.', cta_label='Browse Marketplace', cta_url=url_for('main.marketplace'), cta_icon='bi-shop') }} {% endif %}
{% endblock %} {% block scripts %} {% endblock %}