diff options
| author | BigCoke233 <hi@guhub.cn> | 2026-02-07 20:39:36 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2026-02-07 20:39:36 +0800 |
| commit | 7640a330780fda4306c1922f631a71b581caf6c6 (patch) | |
| tree | c6e3786024494684a3ae2d5037c299a2b21ea513 /layouts/_partials/posts | |
| parent | e543ffe95311d0bffc88d9c4068239f021d5cb5d (diff) | |
feat(ui): collapse webmention replies and mentions
Diffstat (limited to 'layouts/_partials/posts')
| -rw-r--r-- | layouts/_partials/posts/action-menu.html | 12 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-likes.html | 9 |
2 files changed, 17 insertions, 4 deletions
diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index c6c2abfc..9358ce0d 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -15,9 +15,15 @@ {{ end }} <div id="action-menu" class="my-4 mb-5"> - {{ partial "posts/webmention-likes" (dict "likes" $likes "page" .) }} - {{ partial "posts/webmention-replies" $replies }} - {{ partial "posts/webmention-mentions" $mentions }} + {{ partial "posts/webmention-likes" (dict + "likes" $likes + "page" . + "othercount" (add (len $replies) (len $mentions)) + ) }} + <div id="webmention-collapse" class="hidden"> + {{ partial "posts/webmention-replies" $replies }} + {{ partial "posts/webmention-mentions" $mentions }} + </div> <!-- kept for legacy pages --> {{ partial "posts/comment" . }} diff --git a/layouts/_partials/posts/webmention-likes.html b/layouts/_partials/posts/webmention-likes.html index df2ff83b..2c23c67f 100644 --- a/layouts/_partials/posts/webmention-likes.html +++ b/layouts/_partials/posts/webmention-likes.html @@ -1,11 +1,13 @@ {{ $likes := .likes }} {{ $page := .page }} +{{ $othercount := .othercount }} <section class="mb-6 flex gap-2 items-center"> <div class="flex gap-1 group relative items-center"> <button data-tooltip id="action-area-btn" title="{{ T "actionMenu.interact" }}" class="m-0 p-0 bg-transparent hover:no-underline cursor-pointer"> <div class="w-5 h-5 bg-neutral-200 dark:bg-neutral-600 flex justify-center items-center rd-full font-800">+</div> </button> + <!-- Action Area --> <div id="action-area" class="hidden absolute top-7 left-0 z-50 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-600 rd-md shadow-lg p-4 w-80"> <div class="grid grid-cols-2 gap-4"> @@ -29,6 +31,11 @@ </a> {{ end }} </div> - <p class="text-secondary m-0 text-sm">{{ printf (T "webmention.likedBy") (len $likes ) }}</p> + <p class="text-secondary m-0 text-sm"> + {{ printf (T "webmention.likedBy") (len $likes ) }} + {{ if gt $othercount 0 }} + <a id="toggle-webmentions" class="cursor-pointer" onclick="document.getElementById('webmention-collapse').classList.toggle('hidden')">{{ printf (T "webmention.repliedAndMentionedBy") $othercount }}</a> + {{ end }} + </p> </section> |
