mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
Replace bidi with funcool/bide.
And upgrade all dependencies.
This commit is contained in:
parent
4069b183a7
commit
38bead08e9
5 changed files with 47 additions and 54 deletions
20
project.clj
20
project.clj
|
@ -10,25 +10,25 @@
|
|||
:profiles {:dev {:source-paths ["dev"]}}
|
||||
|
||||
:dependencies [[org.clojure/clojure "1.9.0-alpha10" :scope "provided"]
|
||||
[org.clojure/clojurescript "1.9.198" :scope "provided"]
|
||||
[org.clojure/clojurescript "1.9.227" :scope "provided"]
|
||||
|
||||
;; Build
|
||||
[figwheel-sidecar "0.5.4-7" :scope "test"]
|
||||
[figwheel-sidecar "0.5.6" :scope "test"]
|
||||
|
||||
;; runtime
|
||||
[com.cognitect/transit-cljs "0.8.239"]
|
||||
[rum "0.10.5"]
|
||||
[cljsjs/react "15.3.0-0"]
|
||||
[cljsjs/react-dom "15.3.0-0"]
|
||||
[cljsjs/react-dom-server "15.3.0-0"]
|
||||
[rum "0.10.6"]
|
||||
[cljsjs/react "15.3.1-0"]
|
||||
[cljsjs/react-dom "15.3.1-0"]
|
||||
[cljsjs/react-dom-server "15.3.1-0"]
|
||||
[cljsjs/moment "2.10.6-4"]
|
||||
[funcool/struct "1.0.0"]
|
||||
[funcool/lentes "1.1.0"]
|
||||
[funcool/httpurr "0.6.1"]
|
||||
[funcool/promesa "1.4.0"]
|
||||
[funcool/beicon "2.2.0"]
|
||||
[funcool/httpurr "0.6.2"]
|
||||
[funcool/promesa "1.5.0"]
|
||||
[funcool/beicon "2.3.0"]
|
||||
[funcool/cuerdas "0.8.0"]
|
||||
[bidi "2.0.9"]]
|
||||
[funcool/bide "1.0.2"]]
|
||||
:plugins [[lein-ancient "0.6.10"]]
|
||||
:clean-targets ^{:protect false} ["resources/public/js" "target"]
|
||||
)
|
||||
|
|
|
@ -141,8 +141,8 @@
|
|||
(-apply-watch [_ state s]
|
||||
(letfn [(navigate [pages]
|
||||
(let [pageid (:id (first pages))
|
||||
params {:project-uuid projectid
|
||||
:page-uuid pageid}]
|
||||
params {:project (str projectid)
|
||||
:page (str pageid)}]
|
||||
(r/navigate :workspace/page params)))]
|
||||
(rx/merge
|
||||
(rx/of #(assoc % :loader true)
|
||||
|
@ -156,8 +156,8 @@
|
|||
(defrecord GoToPage [projectid pageid]
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
(let [params {:project-uuid projectid
|
||||
:page-uuid pageid}]
|
||||
(let [params {:project (str projectid)
|
||||
:page (str pageid)}]
|
||||
(rx/of (r/navigate :workspace/page params)))))
|
||||
|
||||
(defn go-to
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
(ns uxbox.main.ui
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[bidi.bidi :as bidi]
|
||||
[promesa.core :as p]
|
||||
[beicon.core :as rx]
|
||||
[goog.dom :as gdom]
|
||||
|
@ -96,8 +95,8 @@
|
|||
:settings/profile (settings/profile-page)
|
||||
:settings/password (settings/password-page)
|
||||
:settings/notifications (settings/notifications-page)
|
||||
:workspace/page (let [projectid (:project-uuid params)
|
||||
pageid (:page-uuid params)]
|
||||
:workspace/page (let [projectid (uuid (:project params))
|
||||
pageid (uuid (:page params))]
|
||||
(workspace projectid pageid))
|
||||
nil
|
||||
))))
|
||||
|
@ -117,25 +116,18 @@
|
|||
|
||||
;; --- Routes
|
||||
|
||||
(def ^:private page-route
|
||||
[[bidi/uuid :project-uuid] "/" [bidi/uuid :page-uuid]])
|
||||
|
||||
(def routes
|
||||
["/" [["auth/login" :auth/login]
|
||||
["auth/register" :auth/register]
|
||||
["auth/recovery/request" :auth/recovery-request]
|
||||
[["auth/recovery/token/" :token] :auth/recovery]
|
||||
|
||||
["settings/" [["profile" :settings/profile]
|
||||
["password" :settings/password]
|
||||
["notifications" :settings/notifications]]]
|
||||
|
||||
["dashboard/" [["projects" :dashboard/projects]
|
||||
["elements" :dashboard/elements]
|
||||
["icons" :dashboard/icons]
|
||||
["images" :dashboard/images]
|
||||
["colors" :dashboard/colors]]]
|
||||
["workspace/" [[page-route :workspace/page]]]]])
|
||||
[["/auth/login" :auth/login]
|
||||
["/auth/recovery/token/:token" :auth/recovery]
|
||||
["/settings/profile" :settings/profile]
|
||||
["/settings/password" :settings/password]
|
||||
["/settings/notifications" :settings/notifications]
|
||||
["/dashboard/projects" :dashboard/projects]
|
||||
["/dashboard/elements" :dashboard/elements]
|
||||
["/dashboard/icons" :dashboard/icons]
|
||||
["/dashboard/images" :dashboard/images]
|
||||
["/dashboard/colors" :dashboard/colors]
|
||||
["/workspace/:project/:page" :workspace/page]])
|
||||
|
||||
;; --- Main Entry Point
|
||||
|
||||
|
|
|
@ -6,17 +6,13 @@
|
|||
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
|
||||
|
||||
(ns uxbox.util.router
|
||||
(:require [bidi.router]
|
||||
[bidi.bidi :as bidi]
|
||||
[goog.events :as events]
|
||||
[lentes.core :as l]
|
||||
(:require [bide.core :as r]
|
||||
[beicon.core :as rx]
|
||||
[uxbox.util.rstore :as rs]))
|
||||
|
||||
(enable-console-print!)
|
||||
|
||||
(defonce +router+ nil)
|
||||
(defonce +routes+ nil)
|
||||
|
||||
;; --- Update Location (Event)
|
||||
|
||||
|
@ -33,8 +29,8 @@
|
|||
(instance? UpdateLocation v))
|
||||
|
||||
(defn update-location
|
||||
[{:keys [handler route-params] :as params}]
|
||||
(UpdateLocation. handler route-params))
|
||||
[name params]
|
||||
(UpdateLocation. name params))
|
||||
|
||||
;; --- Navigate (Event)
|
||||
|
||||
|
@ -44,7 +40,7 @@
|
|||
(let [loc (merge {:handler id}
|
||||
(when params
|
||||
{:route-params params}))]
|
||||
(bidi.router/set-location! +router+ loc))))
|
||||
(r/navigate! +router+ id params))))
|
||||
|
||||
(defn navigate
|
||||
([id] (navigate id nil))
|
||||
|
@ -58,11 +54,12 @@
|
|||
([routes]
|
||||
(init routes nil))
|
||||
([routes {:keys [default] :or {default :auth/login}}]
|
||||
(let [opts {:on-navigate #(rs/emit! (update-location %))
|
||||
:default-location {:handler default}}
|
||||
router (bidi.router/start-router! routes opts)]
|
||||
(set! +routes+ routes)
|
||||
(set! +router+ router))))
|
||||
(let [opts {:on-navigate #(rs/emit! (update-location %1 %2))
|
||||
:default default}
|
||||
router (-> (r/router routes)
|
||||
(r/start! opts))]
|
||||
(set! +router+ router)
|
||||
router)))
|
||||
|
||||
(defn go
|
||||
"Redirect the user to other url."
|
||||
|
@ -74,6 +71,10 @@
|
|||
"Given a location handler and optional parameter map, return the URI
|
||||
for such handler and parameters."
|
||||
([id]
|
||||
(bidi/path-for +routes+ id))
|
||||
(if +router+
|
||||
(r/resolve +router+ id)
|
||||
""))
|
||||
([id params]
|
||||
(apply bidi/path-for +routes+ id (into [] (mapcat (fn [[k v]] [k v])) params))))
|
||||
(if +router+
|
||||
(r/resolve +router+ id params)
|
||||
"")))
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
(ns uxbox.view.ui
|
||||
(:require [sablono.core :refer-macros [html]]
|
||||
[bidi.bidi :as bidi]
|
||||
[goog.dom :as gdom]
|
||||
[lentes.core :as l]
|
||||
[rum.core :as rum]
|
||||
|
@ -63,9 +62,10 @@
|
|||
|
||||
;; --- Routes
|
||||
|
||||
(def routes ["/" [[[:token "/" :id] :view/viewer]
|
||||
[[:token] :view/viewer]
|
||||
["not-found" :view/notfound]]])
|
||||
(def routes
|
||||
[["/:token/:id" :view/viewer]
|
||||
["/:token" :view/viewer]
|
||||
["/not-found" :view/notfound]])
|
||||
|
||||
;; --- Main Entry Point
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue