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.
 
 
 
 
 
 

218 lines
13 KiB

{% set ctx = comment_reply_context|default(null) %}
{# `rows` can be non-empty for nested replies when the article-level NIP-22 row is missing; do not require length > 0. #}
{% if ctx and ctx.can_publish|default(false) %}
{% for row in ctx.rows %}
{% if row.mode|default('') == 'article' %}
<div
class="comment-reply comment-reply--article card"
data-controller="comment-reply"
data-comment-reply-publish-url-value="{{ path('comment_reply_publish')|e('html_attr') }}"
data-comment-reply-csrf-value="{{ csrf_token('comment_reply')|e('html_attr') }}"
data-comment-reply-expected-coordinate-value="{{ ctx.coordinate|e('html_attr') }}"
data-comment-reply-article-event-id-value="{{ ctx.article_event_id|default('')|e('html_attr') }}"
data-comment-reply-fragment-url-value="{{ ctx.fragment_url|default('')|e('html_attr') }}"
data-comment-reply-refresh-after-value="1"
data-comment-reply-blurb-label-value="{{ row.blurbLabel|default('Article')|e('html_attr') }}"
data-comment-reply-expected-tags-value='{{ row.expectedTags|default([])|json_encode|e('html_attr') }}'
data-comment-reply-parent-kind-value="{{ row.parentKind|default(0) }}"
data-comment-reply-parent-id-value="{{ row.parentId|default('')|e('html_attr') }}"
data-comment-reply-author-pubkey-value="{{ row.authorPubkey|default('')|e('html_attr') }}"
>
<div class="card-body comment-reply--article__inner">
<div class="comment-reply__toolbar">
<p class="comment-reply__lede text-subtle">Reply to this note on Nostr (kind 1111).</p>
<button
type="button"
class="btn btn-secondary btn-sm comment-reply__toggle"
data-comment-reply-target="toggleBtn"
data-action="click->comment-reply#togglePanel"
aria-expanded="false"
>Reply</button>
</div>
<div class="comment-reply__panel comment-reply__panel--hidden" data-comment-reply-target="panel">
<form
class="comment-reply__form"
data-action="submit->comment-reply#publish"
>
<div class="comment-reply__body">
<label class="visually-hidden" for="comment-reply-article-body">Your reply</label>
<textarea
class="form-control"
id="comment-reply-article-body"
name="body"
rows="4"
required
minlength="1"
placeholder="Write a NIP-22 comment (kind 1111). A quoted parent line is added when you publish."
></textarea>
</div>
<div class="comment-reply__actions">
<button class="btn btn-primary" type="submit">Sign &amp; publish</button>
</div>
<p class="comment-reply__hint text-subtle" data-comment-reply-target="hint" aria-live="polite"></p>
</form>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
<div class="comments">
{% for item in list %}
{% set cid = item.id|default('')|lower %}
{% set cpk = item.pubkey|default('') %}
{% set cts = item.created_at|default(null) %}
{% set cdepth = item.unfold_depth|default(0) %}
{% set is_nip18_repost = item.kind is defined and (item.kind == 6 or item.kind == 16) %}
<div class="card comment comment--depth-{{ cdepth }}"{% if cid != '' %} data-event-id="{{ cid|e('html_attr') }}"{% endif %}>
<div class="metadata comment-card__head">
<p>
{% if item.kind is defined and item.kind == 1 %}
<span class="ui-badge ui-badge--neutral" title="Legacy text-note reply (pre–NIP-22)">kind 1</span>
{% elseif item.kind is defined and item.kind == 1111 %}
<span class="ui-badge ui-badge--secondary" title="NIP-22 comment">1111</span>
{% elseif is_nip18_repost %}
<span class="ui-badge ui-badge--neutral" title="NIP-18 repost (body omitted)">repost</span>
{% endif %}
{% if cpk != '' %}<twig:Molecules:UserFromNpub ident="{{ cpk }}" />{% else %}<span class="text-subtle">Unknown</span>{% endif %}
</p>
<div class="metadata__end">
<small>{% if cts is not null and cts != '' %}{{ cts|date('F j Y') }}{% endif %}</small>
{% set _ev_share = nostr_event_share(item) %}
{% if _ev_share %}{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _ev_share, event_menu: true } only %}{% endif %}
</div>
</div>
{% if not is_nip18_repost and item.unfold_reply_blurb|default('')|trim != '' %}
<div class="comment__reply-blurb" role="note" aria-label="Reply context">
<twig:Atoms:Content content="{{ item.unfold_reply_blurb }}" />
</div>
{% endif %}
<div class="card-body">
{% if is_nip18_repost %}
<p class="text-subtle">Repost</p>
{% else %}
<twig:Atoms:Content content="{{ item.unfold_body|default(item.content|default('')) }}" />
{% endif %}
</div>
{% if not is_nip18_repost and cid != '' and commentLinks[cid] is defined and commentLinks[cid]|length > 0 %}
<div class="card-footer nostr-previews mt-3">
<div class="preview-container">
{% for link in commentLinks[cid] %}
<div>
<twig:Molecules:NostrPreview preview="{{ link }}" />
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if ctx and ctx.can_publish|default(false) and item.kind|default(0) == 1111 %}
{% for row in ctx.rows|default([]) %}
{% if row.mode|default('') == 'comment' and row.parentId|default('') == cid %}
<div
class="comment-reply comment-reply--nested"
data-controller="comment-reply"
data-comment-reply-publish-url-value="{{ path('comment_reply_publish')|e('html_attr') }}"
data-comment-reply-csrf-value="{{ csrf_token('comment_reply')|e('html_attr') }}"
data-comment-reply-expected-coordinate-value="{{ ctx.coordinate|e('html_attr') }}"
data-comment-reply-article-event-id-value="{{ ctx.article_event_id|default('')|e('html_attr') }}"
data-comment-reply-fragment-url-value="{{ ctx.fragment_url|default('')|e('html_attr') }}"
data-comment-reply-refresh-after-value="1"
data-comment-reply-blurb-label-value="{{ row.blurbLabel|default('Comment')|e('html_attr') }}"
data-comment-reply-expected-tags-value='{{ row.expectedTags|default([])|json_encode|e('html_attr') }}'
data-comment-reply-parent-kind-value="{{ row.parentKind|default(0) }}"
data-comment-reply-parent-id-value="{{ row.parentId|default('')|e('html_attr') }}"
data-comment-reply-author-pubkey-value="{{ row.authorPubkey|default('')|e('html_attr') }}"
>
<div class="comment-reply__toolbar comment-reply__toolbar--inline">
<button
type="button"
class="btn btn-secondary btn-sm comment-reply__toggle"
data-comment-reply-target="toggleBtn"
data-action="click->comment-reply#togglePanel"
aria-expanded="false"
>Reply</button>
</div>
<div class="comment-reply__panel comment-reply__panel--hidden" data-comment-reply-target="panel">
<form
class="comment-reply__form"
data-action="submit->comment-reply#publish"
>
<div class="comment-reply__head text-subtle">Reply to this note</div>
<div class="comment-reply__body">
<label class="visually-hidden" for="comment-reply-{{ cid }}">Your reply</label>
<textarea
class="form-control"
id="comment-reply-{{ cid }}"
name="body"
rows="3"
required
minlength="1"
placeholder="NIP-22 comment; parent quote line is added on publish…"
></textarea>
</div>
<div class="comment-reply__actions">
<button class="btn btn-primary" type="submit">Sign &amp; publish</button>
</div>
<p class="comment-reply__hint text-subtle" data-comment-reply-target="hint" aria-live="polite"></p>
</form>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
{% if quotes is defined and quotes|length > 0 %}
<div class="comments-quotes">
<h3 class="comments-quotes__title">Quotes and references</h3>
<p class="text-subtle comments-quotes__lede">Other notes that cite this article in a <code>q</code> tag (NIP-18) or reference its address in <code>a</code> / <code>A</code> (e.g. generic reposts, highlights).</p>
<div class="comments-quotes__list">
{% for item in quotes %}
{% set cid = item.id|default('') %}
{% set cpk = item.pubkey|default('') %}
{% set cts = item.created_at|default(null) %}
{% set q_repost = item.kind is defined and (item.kind == 6 or item.kind == 16) %}
<div class="card comment comment--quote">
<div class="metadata comment-card__head">
<p>
{% if q_repost %}
<span class="ui-badge ui-badge--neutral" title="NIP-18 repost (body omitted)">repost (kind {{ item.kind }})</span>
{% else %}
<span class="ui-badge ui-badge--neutral">kind {{ item.kind|default('?') }}</span>
{% endif %}
{% if cpk != '' %}<twig:Molecules:UserFromNpub ident="{{ cpk }}" />{% else %}<span class="text-subtle">Unknown</span>{% endif %}
</p>
<div class="metadata__end">
<small>
{% if cts is not null and cts != '' %}{{ cts|date('F j Y') }}{% endif %}
</small>
{% set _qv_share = nostr_event_share(item) %}
{% if _qv_share %}{% include 'components/Molecules/NostrShareMenu.html.twig' with { share: _qv_share, event_menu: true } only %}{% endif %}
</div>
</div>
<div class="card-body">
{% if q_repost %}
<p class="text-subtle">Repost</p>
{% else %}
<twig:Atoms:Content content="{{ item.content|default('') }}" />
{% endif %}
</div>
{% if not q_repost and cid != '' and quoteLinks[cid] is defined and quoteLinks[cid]|length > 0 %}
<div class="card-footer nostr-previews mt-3">
<div class="preview-container">
{% for link in quoteLinks[cid] %}
<div>
<twig:Molecules:NostrPreview preview="{{ link }}" />
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endif %}