       [word-ui]
       [suggested-hyphenation-ui]
       [hyphenation-ui]
-      [hyphenation-add-ui]]]]
+      [hyphenation-add-ui]
+      [feedback-ui feedback]]]]
    [hyphenation-lookup-ui spelling @word]
    [:h2 "Similar words"]
    [:div.row

    :spelling 1
    :word ""
    :hyphenation ""
    :suggested-hyphenation ""}))

(def spelling (reagent/cursor app-state [:spelling]))
(def word (reagent/cursor app-state [:word]))
(def hyphenations (reagent/cursor app-state [:hyphenations]))
(def hyphenation (reagent/cursor app-state [:hyphenation]))
(def suggested-hyphenation (reagent/cursor app-state [:suggested-hyphenation]))

(defn update-hyphenations! [f & args]
  (apply swap! app-state update-in [:hyphenations] f args))

(defn remove-hyphenation! [{:keys [word]}]
  (update-hyphenations! dissoc word))

(defn load-hyphenation-patterns!
  [spelling word]

  [pattern]
  (ajax/POST "/api/words"
   :params pattern
   :handler (fn []
              (set-feedback! "Word has been added" :success)
              (load-hyphenation-patterns! @spelling @word))
   :error-handler (fn [details]
                    (.warn js/console
                           (str "Failed to add hyphenation pattern: " details)))
