       [action-button track])]
    [:td (track :title)] [:td (track :artist)] [:td (track :album)]])
 
-(defn tracks-table [tracks action-button]
-  [:table.tracks
-   [:thead
-    [:tr [:th] [:th  "Title"] [:th "Artist"] [:th "Album"]]]
-   [:tbody (for [track tracks]
-             ^{:key track} [track-tr track action-button])]])
+;; -------------------------
+;; Playlist
+
+(defn playlist-section []
+  [:section#playlist
+   [:h2 "Playlist"]
+   (if-let [tracks (not-empty (@app-state :playlist))]
+     [:table.tracks
+      [:thead
+       [:tr [:th] [:th  "Title"] [:th "Artist"] [:th "Album"]]]
+      [:tbody (for [track tracks]
+                ^{:key track} [track-tr track playlist-remove-button])]]
+     "The playlist is empty")])
+
+;; -------------------------
+;; Search
+
+(defn on-query-change [e]
+  (update-state! :query (-> e .-target .-value))
+  (req/get-library!))
+
+(defn search-form []
+  [:section#search
+   [:form
+    [:label {:for "query"} "Search:"]
+    [:input {:type "text"
+             :id "query"
+             :value (@app-state :query)
+             :on-change on-query-change}]]])
+
+;; -------------------------
+;; Library
 
 (defn update-sort-field! [new-field]
   (if (= new-field (:sort-field @app-state))


       [:p (@app-state :upload-status)]])))

(defn playlist-add-button [track]
  [:button.add
   {:on-click #(req/playlist-add! (:uuid track))}

         [now-playing]
         [:a {:href url} "↗"]]))))

;; -------------------------
;; Upload

(defn progress-bar []
  (let [percentage (@app-state :upload-percentage)]
    (if (< 0 percentage 100)
