{% extends 'base.html.twig' %} {% block title %}Notifications - Na+{% endblock %} {% block body %}

Notifications

{# Compteurs par catégorie #} {% if notifications|length > 0 %} {% set cntFollow = notifications|filter(n => n.type == 'follow_request' and not n.isRead)|length %} {% set cntFollowOk = notifications|filter(n => n.type == 'follow_accepted' and not n.isRead)|length %} {% set cntMsg = notifications|filter(n => n.type == 'new_message' and not n.isRead)|length %} {% set cntComment = notifications|filter(n => n.type == 'new_comment' and not n.isRead)|length %} {% set cntLike = notifications|filter(n => n.type == 'new_like' and not n.isRead)|length %} {% set cntCommunity = notifications|filter(n => n.type starts with 'community' and not n.isRead)|length %} {% if cntFollow + cntFollowOk + cntMsg + cntComment + cntLike + cntCommunity > 0 %}
{% if cntFollow > 0 %} 👤 {{ cntFollow }} demande{{ cntFollow > 1 ? 's' : '' }} de suivi {% endif %} {% if cntFollowOk > 0 %} 🤝 {{ cntFollowOk }} suivi{{ cntFollowOk > 1 ? 's' : '' }} accepté{{ cntFollowOk > 1 ? 's' : '' }} {% endif %} {% if cntMsg > 0 %} 💬 {{ cntMsg }} nouveau{{ cntMsg > 1 ? 'x' : '' }} message{{ cntMsg > 1 ? 's' : '' }} {% endif %} {% if cntComment > 0 %} 🗨️ {{ cntComment }} commentaire{{ cntComment > 1 ? 's' : '' }} {% endif %} {% if cntLike > 0 %} ❤️ {{ cntLike }} like{{ cntLike > 1 ? 's' : '' }} {% endif %} {% if cntCommunity > 0 %} 🏘️ {{ cntCommunity }} communauté{{ cntCommunity > 1 ? 's' : '' }} {% endif %}
{% endif %} {% endif %} {% if notifications|length == 0 %}
Aucune notification pour l'instant.
{% else %}
{% for notif in notifications %}
{# Icône selon le type #}
{% if notif.type == 'community_invite' %}🏘️ {% elseif notif.type == 'community_request' %}📥 {% elseif notif.type == 'community_accepted' %}✅ {% elseif notif.type == 'follow_request' %}👤 {% elseif notif.type == 'follow_accepted' %}🤝 {% elseif notif.type == 'new_message' %}💬 {% elseif notif.type == 'new_comment' %}🗨️ {% elseif notif.type == 'new_like' %}❤️ {% else %}🔔{% endif %}
{# Contenu #}
{{ notif.message }}
{{ notif.createdAt|date('d/m/Y à H:i') }}
{% if notif.type == 'follow_request' and notif.sender and not notif.isRead %}
{% endif %}
{# Lien #} {% if notif.link %} Voir {% endif %}
{% endfor %}
{% endif %}
{% endblock %}