You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
5.3 KiB
114 lines
5.3 KiB
{% if preview.type == 'naddr' %} |
|
<div class="card nostr-address-preview"> |
|
{% set _na_share = nostr_event_share(preview) %} |
|
{% if _na_share %} |
|
<div class="nostr-preview-card__menu"> |
|
{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _na_share, event_menu: true } only %} |
|
</div> |
|
{% endif %} |
|
{% for tag in preview.tags %} |
|
{% if tag[0] == 'title' %} |
|
<div class="card-header"> |
|
<h5 class="card-title">{{ tag[1] }}</h5> |
|
</div> |
|
{% endif %} |
|
{% if tag[0] == 'summary' %} |
|
<p class="card-text">{{ tag[1] }}</p> |
|
{% endif %} |
|
{% endfor %} |
|
</div> |
|
{% elseif preview.type == 'nevent' %} |
|
{% if preview.kind == 9802 %} |
|
<div class="card nostr-highlight-preview"> |
|
<div class="card-header nostr-card-header"> |
|
<div> |
|
<twig:Molecules:UserFromNpub ident="{{ preview.pubkey }}" /> |
|
</div> |
|
<div class="nostr-card-header__actions"> |
|
<span class="ui-badge ui-badge--brand">Highlight</span> |
|
{% set _hi_share = nostr_event_share(preview) %} |
|
{% if _hi_share %}{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _hi_share, event_menu: true } only %}{% endif %} |
|
</div> |
|
</div> |
|
<div class="card-body"> |
|
<p>{{ preview.content }}</p> |
|
{% if preview.tags is defined and preview.tags|length > 0 %} |
|
<blockquote class="card-text"> |
|
{% for tag in preview.tags %} |
|
{% if tag[0] == 'textquoteselector' %} |
|
{% for i in 1..tag|length-1 %} |
|
<span class="quoted-text">{{ tag[i] }}</span> |
|
{% if not loop.last %} |
|
<br> |
|
{% endif %} |
|
{% endfor %} |
|
{% endif %} |
|
{% endfor %} |
|
</blockquote> |
|
{% endif %} |
|
</div> |
|
</div> |
|
{% else %} |
|
{% set is_longform = preview.kind == 30023 or preview.kind == 30024 %} |
|
{% set article_title = null %} |
|
{% set article_summary = null %} |
|
{% if preview.tags is defined %} |
|
{% for tag in preview.tags %} |
|
{% if tag[0] == 'title' %} |
|
{% set article_title = tag[1] %} |
|
{% elseif tag[0] == 'summary' %} |
|
{% set article_summary = tag[1] %} |
|
{% endif %} |
|
{% endfor %} |
|
{% endif %} |
|
<div class="card nostr-event-preview"> |
|
<div class="card-header nostr-card-header"> |
|
<div> |
|
<twig:Molecules:UserFromNpub ident="{{ preview.pubkey }}" /> |
|
</div> |
|
<div class="nostr-card-header__actions"> |
|
{% if is_longform %} |
|
<span class="ui-badge ui-badge--secondary">Article</span> |
|
{% else %} |
|
<span class="ui-badge ui-badge--primary">Note</span> |
|
{% endif %} |
|
{% set _evp_share = nostr_event_share(preview) %} |
|
{% if _evp_share %}{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _evp_share, event_menu: true } only %}{% endif %} |
|
</div> |
|
</div> |
|
<div class="card-body"> |
|
{% if is_longform %} |
|
<h5 class="card-title">{{ article_title ?: 'Article' }}</h5> |
|
<p class="card-text"> |
|
{% if article_summary %} |
|
{{ article_summary }} |
|
{% else %} |
|
{{ preview.content|length > 150 ? preview.content|slice(0, 150) ~ '...' : preview.content }} |
|
{% endif %} |
|
</p> |
|
{% else %} |
|
<p class="card-text">{{ preview.content|length > 280 ? preview.content|slice(0, 280) ~ '...' : preview.content }}</p> |
|
{% endif %} |
|
</div> |
|
<div class="card-footer nostr-preview-card__meta text-subtle"> |
|
<small>{{ preview.created_at is defined ? preview.created_at|date('F j Y') : '' }}</small> |
|
</div> |
|
</div> |
|
{% endif %} |
|
{% elseif preview.type == 'nprofile' %} |
|
<div class="card nostr-profile-preview"> |
|
{% set _pr_share = nostr_event_share(preview) %} |
|
{% if _pr_share %} |
|
<div class="nostr-preview-card__menu"> |
|
{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _pr_share, event_menu: true } only %} |
|
</div> |
|
{% endif %} |
|
<div class="card-body nostr-profile-preview__body"> |
|
<h5 class="card-title">{{ preview.display_name ?: preview.name }} </h5> |
|
<small class="text-subtle">@{{ preview.npub|shortenNpub }}</small> |
|
{% if preview.about %} |
|
<p class="card-text">{{ preview.about|length > 150 ? preview.about|slice(0, 150) ~ '...' : preview.about }}</p> |
|
{% endif %} |
|
</div> |
|
</div> |
|
{% endif %}
|
|
|