<commit_before>(in-package :wf/web)

;; Summary tab for root target page

(defun target-summary ()
  (ps

    (def-component target-root-summary
        (psx
         (:div
          :... (format-styling-data (@ this props))
          (:headline :key 1
                     :title (prop title)
                     :external-link (prop url))
          (:display-warstats2 :key 2)
          (:div
           :key 3
           (:h2 "Discussion Statistics")
           (:h3 "Immediate responses:" (prop warstats root replies-immediate))
           (:h3 "Total responses:" (prop warstats root replies-total))
           (:h3 "Incoming references:"))
          )))


    ))
<commit_msg>Implemented list of incoming references<commit_after>(in-package :wf/web)

;; Summary tab for root target page

(defun target-summary ()
  (ps

    (def-component opinion-summary
        (let ((opinion (@ (prop opinions) (list-last (prop tree-address)))))
          (psx
           (:div
            (:vote-value :opinion opinion)
            (:flag-name :key 2 :opinion opinion) " "
            (:date-stamp :key 3 :opinion opinion) " "
            (:author-long :key 4 :opinion opinion) " "
            (:display-warstats2 :key 5)
            (:reply-link :key 6 :url (@ opinion url))))))

    (defun %format-referenced (refs)
      (let ((res (create)))
        (dolist (r refs)
          (setf (getprop res r)
                (strcat "/static/warstats"
                        (make-id-path r)
                        (chain r (to-string))
                        "/opinion-stats.json")))))

    (def-component referenced
        (:div
         (dolist (r (prop referenced))
           (let ((data (getprop (prop inrefs) r)))
             (when data
               (:opinion-summary
                :key (unique-id)
                :opinions (create-from-list (list r data))
                :tree-address (@ data tree-address)
                :warstats (@ data warstats)))))))

    (def-component referenced-loader
        (psx
         (:json-loader
          :sources (%format-referenced (prop referenced))
          :store-name "inrefs"
          (:referenced :... (@ this props)))))

    (def-component target-root-summary
        (let ((rwstats (prop warstats root)))
          (psx
           (:div
            :... (format-styling-data (@ this props))
            (:headline :key 1
                       :title (prop title)
                       :external-link (prop url))
            (:display-warstats2 :key 2)
            (:div
             :key 3
             (:h2 "Discussion Statistics")
             (:h3 "Immediate responses:" (@ rwstats replies-immediate))
             (:h3 "Total responses:" (@ rwstats replies-total))
             (:h3 "Incoming references:")
             (when (@ rwstats referenced)
               (psx (:referenced-loader :key 4 :referenced (@ rwstats referenced))))
             )
            ))))


    ))

{'fraction_non_alphanumeric': 0.1332651670074983, 'fraction_numerical': 0.007839127471029312, 'mean_word_length': 1.5477430555555556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4093200', 'n_tokens_mistral': 878, 'n_tokens_neox': 784, 'n_words': 222}