{% extends "base.html" %} {% from "components/my_listing_card.html" import my_listing_card with context %} {% from "components/activity_feed_card.html" import activity_feed_card %} {% 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 %}My Listings · CampusCart{% endblock %} {% block content %}
{{ page_header('My Listings', "Items you've listed for sale.") }} {% if not has_any %} {{ empty_state('bi-bag-plus', "You haven't listed anything yet", 'Add your first campus item and start managing your marketplace presence from one polished dashboard.', cta_label='Create new listing', cta_url=url_for('marketplace.create_listing_view'), cta_icon='bi-plus-lg') }} {% else %} {% set ns = namespace(sort_label='Newest') %} {% for key, label in sort_options %} {% if key == sort %}{% set ns.sort_label = label %}{% endif %} {% endfor %} {# ---------- KPI cards ---------- #}
{% for label, value, icon, tone in [ ('Total Listings', overview.total_listings, 'bi-collection-fill', 'primary'), ('Total Views', overview.total_views, 'bi-eye-fill', 'info'), ('Favorites', overview.total_favorites, 'bi-heart-fill', 'danger'), ('Conversations', overview.total_conversations, 'bi-chat-dots-fill', 'success') ] %}
{{ "{:,}".format(value) }}
{{ label }}
{% endfor %}
{# ---------- Weekly insights ---------- #}

This week's activity

A quick pulse on how your listings performed in the last 7 days.

+{{ "{:,}".format(overview.views_7d) }}Views
+{{ "{:,}".format(overview.favorites_7d) }}New saves
+{{ "{:,}".format(overview.conversations_7d) }}New chats
{% if overview.top_listing %}
Top listing {{ overview.top_listing.title }} {{ "{:,}".format(overview.top_listing.views) }} views
{% endif %}
{# ---------- Premium Insights (Premium-only; free sees upgrade card) ---------- #} {% include "marketplace/_premium_insights.html" %} {# ---------- Compact activity preview ---------- #} {{ activity_feed_card(recent_activity) }} {# ---------- Filters + chips with counts ---------- #}
All {{ status_counts.total }} {% for s in statuses %} {% set count = status_counts.by_status.get(s, 0) %} {{ s|title }} {{ count }} {% endfor %}
{% if pagination.items %}
{% for listing in pagination.items %} {{ my_listing_card(listing, premium_ids=premium_seller_ids, offers=offers_by_listing.get(listing.id, 0)) }} {% endfor %}
{{ render_pagination(pagination, 'marketplace.my_listings', {'q': q or none, 'status': status or none, 'sort': sort}) }}
{% else %} {{ empty_state('bi-search', 'No listings match your search', 'Try adjusting your search term or switching the filter to see more results.', cta_label='Clear filters', cta_url=url_for('marketplace.my_listings')) }} {% endif %} {% include "components/delete_listing_modal.html" %} {% endif %}
{% endblock %}