chat.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <div class="chat">
  2. <div class="chat-bubbles">
  3. {% for message in site.data.chat %}
  4. {% assign person = site.data.people[message.person-id] %}
  5. {% capture chat-avatar %}
  6. <div class="col-auto">{% include ui/avatar.html person=person %}</div>
  7. {% endcapture %}
  8. {% capture chat-message %}
  9. <div class="{% if message.loading %}col-auto{% else %}col{% if include.wide %} col-lg-6{% endif %}{% endif %}">
  10. <div class="chat-bubble{% if message.person-id == 0 %} chat-bubble-me{% endif %}">
  11. {% unless message.loading %}
  12. <div class="chat-bubble-title">
  13. <div class="row">
  14. <div class="col chat-bubble-author">{{ person.full_name }}</div>
  15. <div class="col-auto chat-bubble-date">{{ message.timestamp }}</div>
  16. </div>
  17. </div>
  18. {% endunless %}
  19. <div class="chat-bubble-body">
  20. {% if message.loading %}
  21. <p class="text-secondary text-italic">typing<span class="animated-dots"></span></p>
  22. {% else %}
  23. <p>{{ message.message }}</p>
  24. {% endif %}
  25. {% if message.gif %}
  26. <div class="mt-2">
  27. <img src="{{ message.gif }}" alt="" class="rounded img-fluid" />
  28. </div>
  29. {% endif %}
  30. </div>
  31. </div>
  32. </div>
  33. {% endcapture %}
  34. <div class="chat-item">
  35. <div class="row align-items-end{% if message.person-id == 0 %} justify-content-end{% endif %}">{% if message.person-id == 0 %} {{ chat-message }} {{ chat-avatar }} {% else %} {{ chat-avatar }} {{ chat-message }} {% endif %}</div>
  36. </div>
  37. {% endfor %}
  38. </div>
  39. </div>