Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69a92e3e2c |
@@ -5,35 +5,47 @@
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.contexts.wallet.common.empty-tab.view :as empty-tab]
|
||||
[utils.i18n :as i18n]))
|
||||
[utils.i18n :as i18n]
|
||||
[utils.image-server :as image-server]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- f-view-internal
|
||||
[{:keys [theme collectibles filtered? on-collectible-press]}]
|
||||
(fn []
|
||||
(let [no-results-match-query? (and filtered? (empty? collectibles))
|
||||
port (rf/sub [:mediaserver/port])]
|
||||
(cond
|
||||
no-results-match-query?
|
||||
[rn/view {:style {:flex 1 :justify-content :center}}
|
||||
[quo/empty-state
|
||||
{:title (i18n/label :t/nothing-found)
|
||||
:description (i18n/label :t/try-to-search-something-else)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]]
|
||||
|
||||
(empty? collectibles)
|
||||
[empty-tab/view
|
||||
{:title (i18n/label :t/no-collectibles)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]
|
||||
|
||||
:else
|
||||
[rn/flat-list
|
||||
{:data collectibles
|
||||
:style {:flex 1}
|
||||
:content-container-style {:align-items :center}
|
||||
:num-columns 2
|
||||
:render-fn (fn [{:keys [preview-url] :as collectible}]
|
||||
(let [preview-url (image-server/get-preview-image-for-url
|
||||
{:url (:uri preview-url)
|
||||
:size 300
|
||||
:port port})]
|
||||
[quo/collectible
|
||||
{:images [preview-url]
|
||||
:on-press #(when on-collectible-press
|
||||
(on-collectible-press collectible))}]))}]))))
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [theme collectibles filtered? on-collectible-press]}]
|
||||
(let [no-results-match-query? (and filtered? (empty? collectibles))]
|
||||
(cond
|
||||
no-results-match-query?
|
||||
[rn/view {:style {:flex 1 :justify-content :center}}
|
||||
[quo/empty-state
|
||||
{:title (i18n/label :t/nothing-found)
|
||||
:description (i18n/label :t/try-to-search-something-else)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]]
|
||||
|
||||
(empty? collectibles)
|
||||
[empty-tab/view
|
||||
{:title (i18n/label :t/no-collectibles)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]
|
||||
|
||||
:else
|
||||
[rn/flat-list
|
||||
{:data collectibles
|
||||
:style {:flex 1}
|
||||
:content-container-style {:align-items :center}
|
||||
:num-columns 2
|
||||
:render-fn (fn [{:keys [preview-url] :as collectible}]
|
||||
[quo/collectible
|
||||
{:images [preview-url]
|
||||
:on-press #(when on-collectible-press
|
||||
(on-collectible-press collectible))}])}])))
|
||||
[props]
|
||||
[:f> f-view-internal props])
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
(def ^:const account-initials-action "/accountInitials")
|
||||
(def ^:const contact-images-action "/contactImages")
|
||||
(def ^:const generate-qr-action "/GenerateQRCode")
|
||||
(def ^:const image-preview-action "/image-preview")
|
||||
|
||||
(defn get-font-file-ready
|
||||
"setup font file and get the absolute path to it
|
||||
@@ -294,3 +295,14 @@
|
||||
"&size="
|
||||
qr-size)]
|
||||
media-server-url))
|
||||
|
||||
(defn get-preview-image-for-url
|
||||
[{:keys [url size port]}]
|
||||
(let [encoded-url (js/encodeURIComponent url)]
|
||||
(str image-server-uri-prefix
|
||||
port
|
||||
image-preview-action
|
||||
"?image_url="
|
||||
encoded-url
|
||||
"&size="
|
||||
size)))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.172.10",
|
||||
"commit-sha1": "69948a7024df8c4537fc4986b39aded22e89179b",
|
||||
"src-sha256": "0xg32k3f4yy7gwqzh60qdgrgi2zvm8s1w7sisqmcn5vw90jya70w"
|
||||
"version": "feat/media-server-image-preview-gen",
|
||||
"commit-sha1": "26fec07fed62eb430e93a7176768d9f656a33645",
|
||||
"src-sha256": "0k2iwk2wlrij4bk1jz2yax06fdpl6d3mxls2yhx18p7yqkk901w4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user