{% extends "base.html" %} {% from "components/pagination.html" import render_pagination %} {% from "components/page_header.html" import page_header %} {% block title %}Notifications · CampusCart{% endblock %} {% block content %} {# Icon (Bootstrap Icons) + colour variant per notification type. #} {% set NF_ICONS = { 'message': ('bi-chat-dots-fill', 'blue'), 'offer': ('bi-arrow-left-right', 'blue'), 'offer_accepted': ('bi-check-circle-fill', 'green'), 'offer_rejected': ('bi-x-circle-fill', 'red'), 'favorite': ('bi-bookmark-fill', 'blue'), 'listing': ('bi-box-seam-fill', 'blue'), 'meetup': ('bi-geo-alt-fill', 'blue'), 'premium': ('bi-star-fill', 'amber'), 'advertisement': ('bi-megaphone-fill', 'amber'), 'report': ('bi-flag-fill', 'red'), 'system': ('bi-bell-fill', 'neutral') } %} {# Contextual action button per related-entity type (all open via the existing open_notification route, which marks read then redirects). #} {% set NF_ACTIONS = { 'conversation': ('bi-chat-dots', 'Open Chat'), 'offer': ('bi-arrow-left-right', 'View Negotiation'), 'listing': ('bi-eye', 'View Listing') } %} {# Coarse category used by the client-side type filter. #} {% set NF_CATEGORY = { 'message': 'message', 'offer': 'offer', 'offer_accepted': 'offer', 'offer_rejected': 'offer', 'listing': 'listing', 'favorite': 'listing' } %}
{{ page_header('Notifications', 'Stay updated on your listings, offers, and messages.') }} {% if pagination.items %}
{% for notification in pagination.items %} {% set ntype = notification.notification_type.value %} {% set entity = notification.related_entity_type.value if notification.related_entity_type else none %} {% set icon, tone = NF_ICONS.get(ntype, ('bi-bell-fill', 'neutral')) %} {% set action = NF_ACTIONS.get(entity) %} {# Moderation notifications resolve their button from the shared link map (View Report / View My Listings / Community Guidelines). #} {% if not action and entity == 'report' %} {% set ml = mod_links.get(notification.title) %} {% if ml %}{% set action = (ml.icon, ml.label) %}{% endif %} {% endif %} {% set category = NF_CATEGORY.get(ntype, 'system') %} {% set open_url = url_for('notifications.open_notification', public_id=notification.public_id) %}

{{ notification.title }}

{% if not notification.is_read %}{% endif %}

{{ notification.message }}

{% if action %} {% endif %}
{% endfor %}

No notifications match your search.

{{ render_pagination(pagination, 'notifications.list_notifications') }}
{% else %}

You're all caught up!

New notifications will appear here when there's marketplace activity — offers, messages and updates on your listings.

Browse Marketplace
{% endif %}
{% endblock %} {% block scripts %} {% endblock %}