         [:div.ui.vertical.segment
          [:h2.ui.header
           "Activities"]
-         [:table.ui.table
-          [:thead
-           [:tr
-            [:th "Start"]
-            [:th "End"]
-            [:th "Activity"]
-            [:th "Location"]]]
-          [:tbody
-           (for [activity activities]
-             ^{:key (:ActivityId activity)}
-             [:tr
-              [:td {:noWrap true}
-               (when activity
-                 (unparse datetime-formatter
-                          (from-string (:StartTime activity))))]
-              [:td {:noWrap true}
-               (when activity
-                 (unparse datetime-formatter
-                          (from-string (:EndTime activity))))]
-              [:td (:Name activity)]
-              [:td (:Location activity)]])]
-          [:tfoot
-           [:tr
-            [:th {:colSpan "4"}
-             [:a.ui.right.floated.small.labeled.icon.button
-              {:href (event-activity-add-route event)}
-              [:i.edit.icon]
-              "Edit"]]]]]]
+         [activity-table-component event-id]]
         [:div.ui.vertical.segment
          [:h2.ui.header
           "Attendees"

  [:nav.ui.fixed.menu
   [:a.logo.item {:href (home-route)}
    [:img {:src "images/logo-menu.png"}]]
   (when (:token @session)
     [:a.blue.item {:href (events-route)
                    :class (when (re-find (re-pattern (events-route)) @location)
                             "active")}
      [:i.ticket.icon]
      "Events"])
   [:a.blue.item {:href (organizations-route)
                  :class (when (re-find (re-pattern (organizations-route))
                                        @location)

      (clj->js (:payment-info @session))
      response-handler)))

(defn activity-table-component [event-id]
  (let [activities (doall (map #(into {} (d/entity @activities-db %))
                               (d/q '[:find [?activity-id ...]
                                      :in $ ?event-id
                                      :where [?activity-id :EventId ?event-id]]
                                    @activities-db
                                    event-id)))]
    [:table.ui.table
     [:thead
      [:tr
       [:th "Start Time"]
       [:th "End Time"]
       [:th "Activity"]
       [:th "Location"]
       [:th "Actions"]]]
     [:tbody
      (for [activity activities]
        ^{:key (:ActivityId activity)}
        [:tr
         [:td (let [start (from-string (:StartTime activity))]
                (unparse datetime-formatter start))]
         [:td (let [end   (from-string (:EndTime   activity))]
                (unparse datetime-formatter end))]
         [:td (:Name activity)]
         [:td (:Location activity)]
         [:td [:a.ui.tiny.labeled.icon.button
               {:href (event-activity-edit-route activity)}
               [:i.edit.icon]
               "Edit"]]])]]))


;; Pages
;; =============================================================================
