                       ; if we select a different app
                       :else
                       (do
-                        (div {:onClick     #(go  (write-ui app [:submode] "editappname")
-                                                 (write-ui app [:app-id] (<-- :id)))
+                        (div {:onClick     #(go  (write-ui app [:mode] "view")
+                                                 ;(write-ui app [:submode] "editappname")
+                                                 (write-ui app [:app-id] (<-- :id))
+                                                 (evalapp (<-- :id))
+                                                 )
 
                               :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
                              (str (<-- :application_name)))))

       (div {:style     {:border "0px" :backgroundColor "black" :width "100%" :height "3em" :verticalAlign "top"}}
            (img {:style {:display "inline-block" :marginTop "-0.0em"} :src "appshare_logo_dark_background.png"})

            (button {:className    "btn btn-default"
                     :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "-0.3em"}
                     :onClick     #(write-ui app [:mode] "browse")} "Browse")

            (button {:className    "btn btn-default"
                     :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "-0.3em"}
                     :onClick     #(go
                                      (remote !newapp {}))   } "New")



            (cond

               "AppShare on Github"))


;       (div {} (str "mode: " (read-ui app [:mode])))
;       (div {} (str "sub-mode: " (read-ui app [:sub-mode])))
;       (div {} (str "app-id: " (read-ui app [:app-id])))


       (div {:style {:display "inline-block" :width "1200" :height "800" :verticalAlign "top"}}

            (cond

              (or (= (read-ui app [:mode]) nil) (= (read-ui app [:mode]) "browse"))
              (div {:style {}} (component browser-component app []))


              (= (read-ui app [:mode]) "edit")
              (div {:style {} } (component editor-component app []))

            )


            (div {:style {:display (if (= (read-ui app [:mode]) "view") "" "none")}} (component  view-app-component  app [])))


       ))


