;; Federation social pages
;; All data fetching via (service ...) IO primitives, no Python helpers.

(defpage home-timeline
  :path "/social/"
  :auth :login
  :layout :social
  :data (service "federation-page" "home-timeline-data")
  :content (~social/timeline-content
    :items items
    :timeline-type timeline-type
    :actor actor))

(defpage public-timeline
  :path "/social/public"
  :auth :public
  :layout :social
  :data (service "federation-page" "public-timeline-data")
  :content (~social/timeline-content
    :items items
    :timeline-type timeline-type
    :actor actor))

(defpage compose-form
  :path "/social/compose"
  :auth :login
  :layout :social
  :data (service "federation-page" "compose-data")
  :content (~social/compose-content
    :reply-to reply-to))

(defpage search
  :path "/social/search"
  :auth :public
  :layout :social
  :data (service "federation-page" "search-data")
  :content (~search/content
    :query query
    :actors actors
    :total total
    :followed-urls followed-urls
    :actor actor))

(defpage following-list
  :path "/social/following"
  :auth :login
  :layout :social
  :data (service "federation-page" "following-data")
  :content (~search/following-content
    :actors actors
    :total total
    :actor actor))

(defpage followers-list
  :path "/social/followers"
  :auth :login
  :layout :social
  :data (service "federation-page" "followers-data")
  :content (~search/followers-content
    :actors actors
    :total total
    :followed-urls followed-urls
    :actor actor))

(defpage actor-timeline
  :path "/social/actor/<int:id>"
  :auth :public
  :layout :social
  :data (service "federation-page" "actor-timeline-data" :id id)
  :content (~profile/actor-timeline-content
    :remote-actor remote-actor
    :items items
    :is-following is-following
    :actor actor))

(defpage notifications
  :path "/social/notifications"
  :auth :login
  :layout :social
  :data (service "federation-page" "notifications-data")
  :content (~notifications/content
    :notifications notifications))
