;; Search and actor card components ;; Aliases — delegate to shared ~avatar (defcomp ~federation-actor-avatar-img (&key src cls) (~avatar :src src :cls cls)) (defcomp ~federation-actor-avatar-placeholder (&key cls initial) (~avatar :cls cls :initial initial)) (defcomp ~federation-actor-name-link (&key href name) (a :href href :class "font-semibold text-stone-900 hover:underline" name)) (defcomp ~federation-actor-name-link-external (&key href name) (a :href href :target "_blank" :rel "noopener" :class "font-semibold text-stone-900 hover:underline" name)) (defcomp ~federation-actor-summary (&key summary) (div :class "text-sm text-stone-600 mt-1 truncate" (~rich-text :html summary))) (defcomp ~federation-unfollow-button (&key action csrf actor-url) (div :class "flex-shrink-0" (form :method "post" :action action :sx-post action :sx-target "closest article" :sx-swap "outerHTML" (input :type "hidden" :name "csrf_token" :value csrf) (input :type "hidden" :name "actor_url" :value actor-url) (button :type "submit" :class "text-sm border border-stone-300 rounded px-3 py-1 hover:bg-stone-100" "Unfollow")))) (defcomp ~federation-follow-button (&key action csrf actor-url label) (div :class "flex-shrink-0" (form :method "post" :action action :sx-post action :sx-target "closest article" :sx-swap "outerHTML" (input :type "hidden" :name "csrf_token" :value csrf) (input :type "hidden" :name "actor_url" :value actor-url) (button :type "submit" :class "text-sm bg-stone-800 text-white rounded px-3 py-1 hover:bg-stone-700" label)))) (defcomp ~federation-actor-card (&key cls id avatar name username domain summary button) (article :class cls :id id avatar (div :class "flex-1 min-w-0" name (div :class "text-sm text-stone-500" "@" username "@" domain) summary) button)) (defcomp ~federation-search-info (&key cls text) (p :class cls text)) (defcomp ~federation-search-page (&key search-url search-page-url query info results) (h1 :class "text-2xl font-bold mb-6" "Search") (form :method "get" :action search-url :class "mb-6" :sx-get search-page-url :sx-target "#search-results" :sx-push-url search-url (div :class "flex gap-2" (input :type "text" :name "q" :value query :class "flex-1 border border-stone-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-stone-500" :placeholder "Search users or @user@instance.tld") (button :type "submit" :class "bg-stone-800 text-white px-6 py-2 rounded hover:bg-stone-700" "Search"))) info (div :id "search-results" results)) ;; Following / Followers list page (defcomp ~federation-actor-list-page (&key title count-str items) (h1 :class "text-2xl font-bold mb-6" title " " (span :class "text-stone-400 font-normal" count-str)) (div :id "actor-list" items))