{# Item card for timeline display Inspired by Aperture/Monocle reader #}
{# Context bar for interactions (Aperture pattern) #} {# Helper to extract URL from value that may be string or object #} {% macro getUrl(val) %}{{ val.url or val.value or val if val is string else val }}{% endmacro %} {% if item["like-of"] and item["like-of"].length > 0 %} {% set contextUrl = item['like-of'][0].url or item['like-of'][0].value or item['like-of'][0] %}
{{ icon("like") }} Liked {{ contextUrl | replace("https://", "") | replace("http://", "") | truncate(50) }}
{% elif item["repost-of"] and item["repost-of"].length > 0 %} {% set contextUrl = item['repost-of'][0].url or item['repost-of'][0].value or item['repost-of'][0] %}
{{ icon("repost") }} Reposted {{ contextUrl | replace("https://", "") | replace("http://", "") | truncate(50) }}
{% elif item["in-reply-to"] and item["in-reply-to"].length > 0 %} {% set contextUrl = item['in-reply-to'][0].url or item['in-reply-to'][0].value or item['in-reply-to'][0] %}
{{ icon("reply") }} Reply to {{ contextUrl | replace("https://", "") | replace("http://", "") | truncate(50) }}
{% elif item["bookmark-of"] and item["bookmark-of"].length > 0 %} {% set contextUrl = item['bookmark-of'][0].url or item['bookmark-of'][0].value or item['bookmark-of'][0] %}
{{ icon("bookmark") }} Bookmarked {{ contextUrl | replace("https://", "") | replace("http://", "") | truncate(50) }}
{% endif %} {# Author #} {% if item.author %}
{% if item.author.photo %} {% endif %}
{{ item.author.name or "Unknown" }} {% if item._source %} {{ item._source.name or item._source.url }} {% elif item.author.url %} {{ item.author.url | replace("https://", "") | replace("http://", "") }} {% endif %}
{% endif %} {# Title (for articles) #} {% if item.name %}

{{ item.name }}

{% endif %} {# Content with overflow handling #} {% if item.summary or item.content %}
{% if item.content.html %} {{ item.content.html | safe | striptags | truncate(400) }} {% elif item.content.text %} {{ item.content.text | truncate(400) }} {% elif item.summary %} {{ item.summary | truncate(400) }} {% endif %}
{% endif %} {# Categories/Tags #} {% if item.category and item.category.length > 0 %}
{% for cat in item.category %} {% if loop.index0 < 5 %} #{{ cat | replace("#", "") }} {% endif %} {% endfor %}
{% endif %} {# Photo grid (Aperture multi-photo pattern) #} {% if item.photo and item.photo.length > 0 %} {% set photoCount = item.photo.length if item.photo.length <= 4 else 4 %}
{% for photo in item.photo %} {% if loop.index0 < 4 %} {% endif %} {% endfor %}
{% endif %} {# Video preview #} {% if item.video and item.video.length > 0 %}
{% endif %} {# Audio preview #} {% if item.audio and item.audio.length > 0 %}
{% endif %} {# Footer with date and actions #}
{% if item.published %} {% endif %} {% if not item._is_read %} {% endif %}
{# Inline actions (Aperture pattern) #}
{% if item._source and item._source.type === "activitypub" and item.author and item.author.url %} {{ icon("mention") }} Actor profile {% endif %} {% if item.url %} {{ icon("syndicate") }} Original {% endif %} {{ icon("reply") }} Reply {{ icon("like") }} Like {{ icon("repost") }} Repost {{ icon("bookmark") }} Bookmark {% if not item._is_read %} {% if item._feedId %} {% else %} {% endif %} {% endif %} {% if application.readlaterEndpoint %} {% endif %}