{{ define "repo/fragments/reactions" }}
  <div class="reactions flex flex-wrap items-center gap-2" hx-include="this">
    {{- $reactions   := .Reactions -}}
    {{- $userReacted := .UserReacted -}}
    {{- $threadAt    := .ThreadAt -}}
    {{- $parts       := splitOn (string $threadAt) "/" -}}
    {{- $commentRkey := index $parts (sub (len $parts) 1) -}}

    <input name="subject-uri" type="hidden" value="{{ $threadAt }}">

    {{ range $kind := const.OrderedReactionKinds }}
      {{ $reactionData := index $reactions $kind }}
      {{ template "repo/fragments/reaction"
        (dict
          "Kind"        $kind
          "Count"       $reactionData.Count
          "IsReacted"   (index $userReacted $kind)
          "Users"       $reactionData.Users
          "CommentRkey" $commentRkey
          "SubjectUri"  $threadAt) }}
    {{ end }}

    {{ if or (not .HideIfEmpty) (gt (len $reactions) 0) }}
      {{ template "repo/fragments/reactionsPopup" (dict "CommentRkey" $commentRkey "Scope" "body") }}
    {{ end }}

  </div>
{{ end }}
