mirror of https://github.com/status-im/pluto.git
Fixed missing support for external components
This commit is contained in:
parent
80f6d2e806
commit
aa755e3c23
|
@ -9,12 +9,13 @@
|
||||||
(defn ^:export from-clj [o]
|
(defn ^:export from-clj [o]
|
||||||
(clj->js o))
|
(clj->js o))
|
||||||
|
|
||||||
|
(defn component [])
|
||||||
|
|
||||||
(def ctx
|
(def ctx
|
||||||
{:capacities {:components {'text {:value :text} 'view {:value :div} 'token-selector {:value :div} 'asset-selector {:value :div}
|
{:capacities {:components {'text {:value component} 'view {:value component} 'token-selector {:value component} 'asset-selector {:value component}
|
||||||
'send-status {:value :div} 'nft-token {:value :div}}
|
'send-status {:value component} 'nft-token {:value component}}
|
||||||
:queries {'get-collectible-token {:value :get-collectible-token}}
|
:queries {'get-collectible-token {:value :get-collectible-token}}
|
||||||
:hooks {:commands {:properties {:scope #{:personal-chats :public-chats}
|
:hooks {:commands {:properties {:scope #{:personal-chats :public-chats}
|
||||||
:description :string
|
|
||||||
:short-preview :view
|
:short-preview :view
|
||||||
:preview :view
|
:preview :view
|
||||||
:parameters [{:id :keyword
|
:parameters [{:id :keyword
|
||||||
|
|
|
@ -105,7 +105,8 @@
|
||||||
[(or component element)])
|
[(or component element)])
|
||||||
%)))
|
%)))
|
||||||
(nil? component) (errors/accumulate-errors [(errors/error ::errors/unknown-component element)])
|
(nil? component) (errors/accumulate-errors [(errors/error ::errors/unknown-component element)])
|
||||||
(seq errors) (errors/accumulate-errors errors))))))
|
(seq errors) (errors/accumulate-errors errors)))
|
||||||
|
:else {:errors [(errors/error ::errors/unknown-component o)]})))
|
||||||
|
|
||||||
(defn parse [ctx ext o]
|
(defn parse [ctx ext o]
|
||||||
(if (list? o) ;; TODO introduce a block? fn
|
(if (list? o) ;; TODO introduce a block? fn
|
||||||
|
@ -138,8 +139,10 @@
|
||||||
(defmethod types/resolve :view [ctx ext type value]
|
(defmethod types/resolve :view [ctx ext type value]
|
||||||
(let [{:keys [data errors]} (reference/resolve ctx ext type value)]
|
(let [{:keys [data errors]} (reference/resolve ctx ext type value)]
|
||||||
(if data
|
(if data
|
||||||
(let [{:keys [data errors] :as m} (parse ctx ext data)]
|
(if (fn? data)
|
||||||
;; TODO Might fail at runtime if destructuring is incorrect
|
{:data data}
|
||||||
(errors/merge-errors (when data {:data (fn [o] (hiccup-with-properties data o))})
|
(let [{:keys [data errors] :as m} (parse ctx ext data)]
|
||||||
(concat errors (:errors ext))))
|
;; TODO Might fail at runtime if destructuring is incorrect
|
||||||
|
(errors/merge-errors (when data {:data (fn [o] (hiccup-with-properties data o))})
|
||||||
|
(concat errors (:errors ext)))))
|
||||||
{:errors errors})))
|
{:errors errors})))
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
const ipfs = new window.Ipfs();
|
const ipfs = new window.Ipfs();
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
const buffer = await loadIPFS(ipfs, "QmQ6FDAMYV728mAQdox3zFuZ4pj4CfaEu1pMe1JA9duJ13");
|
const buffer = await loadIPFS(ipfs, "QmWDY22VajAr2LMWV8nTUTnvgDXXfmhWnZbW8jUDP2Pth7");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue