                   :on-click #(do
                                (init-data state)
                                (.preventDefault %))}
-
               (str (t :social/Loadmore) " (" (:messages_left @state) " " (t :social/Messagesleft) ")")]]]]))
 
 

                   (if (= "success" (:connected? data))
                     (do
                       (f/init-data badge_content_id)
                       (swap! state assoc :start-following true)
                       )
                     (swap! state assoc :start-following false))
                   (swap! state assoc :messages []
                                      :page_count 0)
                   (init-data state)))
      :error-handler (fn [{:keys [status status-text]}]
                       )})))

(defn delete-message [id state]
(ajax/POST
     (path-for (str "/obpv1/social/delete_message/" id))
     {:response-format :json
      :keywords? true 
      :handler (fn [data]
                 (do
                   (let [filtered-messages (filter #(not (= id (:id %))) (:messages @state))]
                     (swap! state assoc :messages filtered-messages))
                   ))
      :error-handler (fn [{:keys [status status-text]}]
                       )})
)

(defn delete-message-button [id state]
  (let [delete-clicked (atom nil)]

            [salava.core.i18n :refer [t]]
            [salava.core.helper :refer [dump]]
            [salava.social.ui.follow :as f]
            [salava.core.time :refer [date-from-unix-time]]))

(defn init-data [state]
  (ajax/GET
   (path-for (str "/obpv1/social/messages/" (:badge_content_id @state) "/" (:page_count @state)))
   {:handler (fn [data]
               (swap! state assoc
                      :messages (into (:messages @state) (:messages data))
                      :message ""
                      :page_count (inc (:page_count @state))
                      :messages_left (:messages_left data)))}))


(defn save-message [state]
