       
 (defn get-price [unit]
   ((peek (:prices @app-state)) unit 1))
+  
+(defn get-value [amount unit]
+  (* amount (get-price unit)))
 
 (defn summarize [txs]
   (->> txs


(defn render-summary [summary-rows]
  (dom/table nil
    (render-table-headings ["Account" "Value" "Amount"])
    (apply dom/tbody nil
      (for [{:keys [account value amount]} summary-rows]
        (dom/tr nil
          (dom/td nil account)
          (dom/td right-align value)
          (dom/td right-align amount))))))

(defn render-detail [state]
  (dom/div nil

                (map #(assoc part :account (take % account))
                     (range 1 (inc (count account)))))))
       (apply concat)
       (group-by :account)
       (map (fn [[account parts]]
              (let [units (map (fn [[unit parts]] 
                                 (let [amount (apply + (map :amount parts))]
                                   {:amount amount, :unit unit, :value (get-value amount unit)}))
                               (group-by :unit parts))]
                {:account (account-vec->str account)
                 :value (display-amount (apply + (map :value units)))
                 :amounts (map (fn [{:keys [amount unit]}] (display-amount amount unit)) units)})))
       (sort-by :account)))

(defn register-parts [account txs]
