 (defmethod packet-view "netTick" [p]
   (str "Tick: " (p "tick") " frameTime: " (p "frameTime")
        " stdDev: " (p "stdDev")))
-(defmethod packet-view "gameEvent" [p] (p "event"))
+(defmethod packet-view "gameEvent" [p]
+  (-> (p "event") clj->js js/JSON.stringify))
 ;; (defmethod packet-view "serverInfo" [p]
 ;;   (str "frameTime: " (p "frameTime") " stdDev: " (p "stdDev")))
 (defmethod packet-view "consoleCmd" [p] (p "command"))

(defn direct-read [state k] {:value (get @state k nil)})
(defmethod read nil [{:keys [state] :as env} k] (direct-read state k))
(defmethod read "file"
  [{:keys [state ast] :as env} k {:keys [file offset limit]}]
  (case k
    :file/packets
    {:value (->> (get @state :packets []) (drop offset) (take limit) vec)}



(defui RootComponent
  static om/IQueryParams
  (params [_] {:file nil :idx nil :offset 0 :limit 50})
  static om/IQuery
  (query [this]
         '[:title
           (:file/packet {:idx ?idx})
           (:file/packets {:offset ?offset :limit ?limit})
           :file/packets-count
           :file/results
           (:file/file {:file/file ?file})])
  Object
  (render [this]
    (let [{:keys [results title file/packet file/packets file/packets-count]}
          (om/props this)
          {:keys [offset file]} (om/get-params this)]
      (dom/div nil
        (dom/h1 nil title)
        (dom/p nil results)
        (file-upload this)
        (when packet
          (dom/div nil (js/JSON.stringify (clj->js packet))))
        (when packets
          (dom/p nil
                 (str "Loaded " packets-count " packets. Displaying: "
