1.2 KiB · text History b1da290
<li id="notif-{{ n.id }}" class="card bg-base-200 border p-3 flex flex-row items-center gap-3 {% if not n.is_read %}border-primary{% else %}border-base-300{% endif %}">
  <i class="fas fa-bell {% if not n.is_read %}text-primary{% else %}opacity-40{% endif %}"></i>
  <div class="flex-1 text-sm min-w-0">
    {% if n.kind == "new_topic" %}
      <a href="/t/{{ n.topic_id }}" class="link link-hover">
        <span class="font-semibold">{{ n.actor }}</span> posted a new topic:
        <span class="font-medium">{{ n.topic_title }}</span>
      </a>
    {% elif n.kind == "reaction" %}
      <a href="/p/{{ n.post_id }}" hx-boost="false" class="link link-hover">
        <span class="font-semibold">{{ n.actor }}</span> reacted to your post{% if n.topic_title %} in
        <span class="font-medium">{{ n.topic_title }}</span>{% endif %}
      </a>
    {% else %}
      <span>{{ n.actor }} · {{ n.kind }}</span>
    {% endif %}
  </div>
  <span class="opacity-60 text-xs shrink-0" title="{{ n.created_abs }}">{{ n.created }}</span>
  {% if not n.is_read %}
  <button hx-post="/notifications/{{ n.id }}/read" hx-target="#notif-{{ n.id }}" hx-select="unset" hx-swap="outerHTML"
          type="button" class="btn btn-ghost btn-xs shrink-0">Mark read</button>
  {% endif %}
</li>