         [:ul
          (for [shape (map #(get shapes-by-id %) (:items item))
                :let [key (str (:id shape))]]
-           ;; TODO: make polymorphic
-           (case (:type shape)
-             :builtin/rect (rum/with-key (layer-element shape selected) key)
-             :builtin/circle (rum/with-key (layer-element shape selected) key)
-             :builtin/line (rum/with-key (layer-element shape selected) key)
-             :builtin/icon (rum/with-key (layer-element shape selected) key)
-             :builtin/group (rum/with-key (layer-group shape selected) key)))])])))
+           (if (= (:type shape) :builtin/group)
+             (-> (layer-group shape selected)
+                 (rum/with-key key))
+             (-> (layer-element shape selected)
+                 (rum/with-key key))))])])))
 
 (def ^:static ^:private layer-group
   (mx/component

        toggle-open (fn [event]
                      (dom/stop-propagation event)
                      (swap! local assoc :open (not open?)))
        shapes-by-id (rum/react shapes-by-id)]
    (html
     [:li.group {:class (when open? "open")}
      [:div.element-list-body {:class (when selected? "selected")
                               :on-click select}
       [:div.element-actions
        [:div.toggle-element {:class (when-not (:hidden item) "selected")
                              :on-click toggle-visibility}
         i/eye]
        [:div.block-element {:class (when (:blocked item) "selected")
                             :on-click toggle-blocking}
         i/lock]
        [:div.chain-element {:class (when (:locked item) "selected")
                             :on-click toggle-locking}
         i/chain]]
       [:div.element-icon i/folder]
       [:span (:name item "Unnamed group")]

     [:li {:key (str (:id item))
           :on-click select
           :class (when selected? "selected")}
      [:div.element-list-body
       {:class (when selected? "selected")}
       [:div.element-actions
        [:div.toggle-element
         {:class (when-not (:hidden item) "selected")
          :on-click toggle-visibility}
         i/eye]
        [:div.block-element
         {:class (when (:blocked item) "selected")
          :on-click toggle-blocking}
         i/lock]]
       (if (:group item)
         [:div.sublevel-element i/sublevel])
       [:div.element-icon (element-icon item)]
       [:span (:name item "Unnamed")]]])))

(def ^:static ^:private layer-element
  (mx/component
