[#4310] Added headers to DApps list

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Julien Eluard 2018-05-22 13:53:18 +02:00
parent 590e1f9f4f
commit 25bb59aec6
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
9 changed files with 114 additions and 173 deletions

View File

@ -17,147 +17,5 @@
},
"dapp?": true,
"bot-url": "local://demo-bot"
},
"ethlance":
{
"name":
{
"en": "Ethlance"
},
"photo-path": "contacts://ethlance",
"dapp?": true,
"dapp-url":
{
"en": "https://ethlance.com"
},
"description": "The future of work is now. Hire people or work yourself in return for ETH."
},
"cryptokitties":
{
"name":
{
"en": "CryptoKitties"
},
"photo-path": "contacts://cryptokitties",
"dapp?": true,
"dapp-url":
{
"en": "https://www.cryptokitties.co"
},
"description": "Collect and breed adorable digital cats."
},
"airswap":
{
"name":
{
"en": "AirSwap"
},
"photo-path": "contacts://airswap",
"dapp?": true,
"dapp-url":
{
"en": "https://www.airswap.io/trade"
},
"description": "Meet the future of trading."
},
"cryptopunks": {
"name" : {"en" : "CryptoPunks"},
"description": "10,000 unique collectible punks",
"dapp-url": {"en" :"https://www.larvalabs.com/cryptopunks"},
"dapp?": true,
"photo-path": "contacts://cryptopunks"
},
"name-bazaar": {
"name" : {"en" : "Name Bazaar"},
"description": "ENS name marketplace",
"dapp-url": {"en": "https://namebazaar.io"},
"dapp?": true,
"photo-path": "contacts://name-bazaar"
},
"cent": {
"name" : {"en" : "Cent"},
"description": "Get wisdom, get money",
"dapp-url": {"en" : "https://beta.cent.co"},
"dapp?": true,
"photo-path": "contacts://cent"
},
"erc-dex": {
"name" : {"en" : "ERC dEX"},
"description": "Trustless trading has arrived on Ethereum",
"dapp-url": {"en" : "https://app.ercdex.com/"},
"dapp?": true,
"photo-path": "contacts://erc-dex"
},
"oasis-direct": {
"name" : {"en" : "Oasis Direct"},
"description": "The first decentralized instant exchange",
"dapp-url": {"en" : "https://oasis.direct/"},
"dapp?": true,
"photo-path": "contacts://oasis-direct"
},
"etherbots": {
"name" : {"en" : "Etherbots"},
"description": "Robot wars on the Ethereum Platform",
"dapp-url": {"en" : "https://etherbots.io/"},
"dapp?": true,
"photo-path": "contacts://etherbots"
},
"peepeth": {
"name" : {"en" : "Peepeth"},
"description": "Blockchain-powered microblogging",
"dapp-url": {"en" : "http://peepeth.com/"},
"dapp?": true,
"photo-path": "contacts://peepeth"
},
"hexel": {
"name" : {"en" : "Hexel"},
"description": "Create your own cryptocurrency",
"dapp-url": {"en" : "https://www.onhexel.com/"},
"dapp?": true,
"photo-path": "contacts://hexel"
},
"kyber": {
"name" : {"en" : "Kyber"},
"description": "On-chain, instant and liquid platform for exchange and payment service",
"dapp-url": {"en" : "https://web3.kyber.network"},
"dapp?": true,
"photo-path": "contacts://kyber"
},
"bancor": {
"name" : {"en" : "Bancor"},
"description": "Bancor is a decentralized liquidity network",
"dapp-url": {"en" : "https://www.bancor.network/"},
"dapp?": true,
"photo-path": "contacts://bancor"
},
"opensea": {
"name" : {"en" : "OpenSea"},
"description": "The largest decentralized marketplace for cryptogoods",
"dapp-url": {"en" : "https://opensea.io"},
"dapp?": true,
"photo-path": "contacts://opensea"
},
"cryptocribs": {
"name" : {"en" : "CryptoCribs"},
"description": "Travel the globe. Pay in crypto.",
"dapp-url": {"en" : "https://cryptocribs.com"},
"dapp?": true,
"photo-path": "contacts://cryptocribs"
},
"cryptofighters": {
"name" : {"en" : "CryptoFighters"},
"description": "Collect train and fight digital fighters.",
"dapp-url": {"en" : "https://cryptofighters.io"},
"dapp?": true,
"photo-path": "contacts://cryptofighters"
},
"simple-dapp": {
"name" : {"en" : "Simple Dapp"},
"description": "Request test assets and test basic web3 functionality.",
"dapp-url": {"en" : "https://status-im.github.io/dapp/"},
"dapp?": true
}
}

View File

@ -7,11 +7,9 @@
[status-im.chat.models :as models]
[status-im.chat.models.message :as models.message]
[status-im.chat.console :as console]
[status-im.chat.constants :as chat.constants]
[status-im.commands.events.loading :as events.loading]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.screens.navigation :as navigation]
[status-im.ui.screens.group.events :as group.events]
[status-im.utils.handlers :as handlers]
[status-im.utils.handlers-macro :as handlers-macro]
[status-im.utils.contacts :as utils.contacts]
@ -143,7 +141,7 @@
pending-messages)})))
(defn init-console-chat
[{:keys [db] :as cofx}]
[{:keys [db]}]
(when-not (get-in db [:chats constants/console-chat-id])
{:db (-> db
(assoc :current-chat-id constants/console-chat-id)
@ -188,6 +186,7 @@
(handlers/register-handler-fx
:initialize-chats
[(re-frame/inject-cofx :get-default-contacts)
(re-frame/inject-cofx :get-default-dapps)
(re-frame/inject-cofx :data-store/all-chats)
(re-frame/inject-cofx :data-store/get-messages)
(re-frame/inject-cofx :data-store/unviewed-messages)
@ -195,6 +194,7 @@
(re-frame/inject-cofx :data-store/get-unanswered-requests)
(re-frame/inject-cofx :data-store/get-local-storage-data)]
(fn [{:keys [db
default-dapps
all-stored-chats
stored-unanswered-requests
get-stored-messages
@ -216,7 +216,9 @@
{}
all-stored-chats)]
(handlers-macro/merge-fx cofx
{:db (assoc db :chats chats)}
{:db (assoc db
:chats chats
:contacts/dapps default-dapps)}
(init-console-chat)
(group-chat-messages)
(add-default-contacts)))))
@ -402,7 +404,7 @@
(handlers/register-handler-fx
:create-new-group-chat-and-open
[re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db now random-id] :as cofx} [group-name]]
(fn [{:keys [db random-id] :as cofx} [group-name]]
(let [selected-contacts (:group/selected-contacts db)
chat-name (if-not (string/blank? group-name)
group-name

View File

@ -4,7 +4,6 @@
[status-im.ui.components.react :as react]
[status-im.ui.components.icons.vector-icons :as vector-icons]
[status-im.ui.components.chat-icon.screen :as chat-icon]
[status-im.ui.components.checkbox.view :as checkbox]
[status-im.ui.components.contact.styles :as styles]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.list.views :as list]
@ -20,7 +19,7 @@
:number-of-lines 1}
(when dapp? {:accessibility-label :dapp-name})
props)
(if (pos? (count (:name contact)))
(if (pos? (count name))
(i18n/get-contact-translated whisper-identity :name name)
;;TODO is this correct behaviour?
(gfycat/generate-gfy whisper-identity))]

View File

@ -87,12 +87,11 @@
{:font-size 14
:color colors/gray
:margin-left 16
:android {:margin-top 11
:margin-bottom 3}
:ios {:margin-top 10
:margin-bottom 10}})
:margin-top 16
:android {:margin-bottom 3}
:ios {:margin-bottom 10}})
(defstyle section-header-container
(def section-header-container
{:background-color colors/white})
(def action-list

View File

@ -14,9 +14,9 @@
[status-im.ui.screens.add-new.styles :as add-new.styles]
[status-im.ui.screens.add-new.open-dapp.styles :as styles]))
(defn render-row [row _ _]
[contact-view/contact-view {:contact row
:on-press #(re-frame/dispatch [:navigate-to :dapp-description row])
(defn- render-contact [contact]
[contact-view/contact-view {:contact contact
:on-press #(re-frame/dispatch [:navigate-to :dapp-description contact])
:show-forward? true
:accessibility-label :dapp-item}])
@ -38,14 +38,12 @@
:style add-new.styles/input
:accessibility-label :dapp-url-input
:return-key-type :go}]]
[react/text {:style styles/list-title}
(i18n/label :t/selected-dapps)]
[list/flat-list {:data dapps
:key-fn :dapp-url
:render-fn render-row
:default-separator? true
:enableEmptySections true
:keyboardShouldPersistTaps :always}]]))
[list/section-list {:sections dapps
:key-fn :dapp-url
:render-fn render-contact
:default-separator? true
:enableEmptySections true
:keyboardShouldPersistTaps :always}]]))
(views/defview dapp-description []
(views/letsubs [{:keys [name dapp-url description] :as dapp} [:get-screen-params]]

View File

@ -0,0 +1,76 @@
(ns status-im.ui.screens.contacts.default-dapps)
(def all
[{:title "Exchanges"
:data [{:name "Airswap"
:dapp-url "https://www.airswap.io/trade"
:photo-path "contacts://airswap"
:description "Meet the future of trading."}
{:name "Bancor"
:dapp-url "https://www.bancor.network/"
:photo-path "contacts://bancor"
:description "Bancor is a decentralized liquidity network"}
{:name "ERC dEX"
:dapp-url "https://app.ercdex.com/"
:photo-path "contacts://erc-dex"
:description "Trustless trading has arrived on Ethereum"}
{:name "Kyber"
:dapp-url "https://web3.kyber.network"
:photo-path "contacts://kyber"
:description "On-chain, instant and liquid platform for exchange and payment service"}
{:name "Oasis Direct"
:dapp-url "https://oasis.direct/"
:photo-path "contacts://oasis-direct"
:description "The first decentralized instant exchange"}]}
{:title "Marketplaces"
:data [{:name "CryptoCribs"
:dapp-url "https://cryptocribs.com"
:photo-path "contacts://cryptocribs"
:description "Travel the globe. Pay in crypto."}
{:name "Ethlance"
:dapp-url "https://ethlance.com"
:photo-path "contacts://ethlance"
:description "The future of work is now. Hire people or work yourself in return for ETH."}
{:name "OpenSea"
:dapp-url "https://opensea.io"
:photo-path "contacts://opensea"
:description "The largest decentralized marketplace for cryptogoods"}
{:name "Name Bazaar"
:dapp-url "https://namebazaar.io"
:photo-path "contacts://name-bazaar"
:description "ENS name marketplace"}]}
{:title "Fun & Games"
:data [{:name "CryptoKitties"
:dapp-url "https://www.cryptokitties.co"
:photo-path "contacts://cryptokitties"
:description "Collect and breed adorable digital cats."}
{:name "CryptoFighters"
:dapp-url "https://cryptofighters.io"
:photo-path "contacts://cryptofighters"
:description "Collect train and fight digital fighters."}
{:name "CryptoPunks"
:dapp-url "https://www.larvalabs.com/cryptopunks"
:photo-path "contacts://cryptopunks"
:description "10,000 unique collectible punks"}
{:name "Etherbots"
:dapp-url "https://etherbots.io/"
:photo-path "contacts://etherbots"
:description "Robot wars on the Ethereum Platform"}]}
{:title "Social Networks"
:data [{:name "Cent"
:dapp-url "https://beta.cent.co"
:photo-path "contacts://cent"
:description "Get wisdom, get money"}
{:name "Peepeth"
:dapp-url "http://peepeth.com/"
:photo-path "contacts://peepeth"
:description "Blockchain-powered microblogging"}]}
{:title "Utilities"
:data [{:name "Hexel"
:dapp-url "https://www.onhexel.com/"
:photo-path "contacts://hexel"
:description "Create your own cryptocurrency"}
{:name "Status Test DApp"
:dapp-url "https://status-im.github.io/dapp/"
:description "Request test assets and test basic web3 functionality."
:developer? true}]}])

View File

@ -1,14 +1,14 @@
(ns status-im.ui.screens.contacts.events
(:require [cljs.reader :as reader]
[re-frame.core :as re-frame]
(:require [re-frame.core :as re-frame]
[status-im.utils.handlers :as handlers]
[status-im.utils.handlers-macro :as handlers-macro]
[status-im.utils.contacts :as utils.contacts]
[status-im.ui.screens.navigation :as navigation]
[status-im.chat.events :as chat.events]
[status-im.transport.message.core :as transport]
[status-im.transport.message.v1.contact :as message.v1.contact]
[status-im.ui.screens.add-new.new-chat.db :as new-chat.db]
[status-im.ui.screens.contacts.default-dapps :as default-dapps]
[status-im.ui.screens.navigation :as navigation]
[status-im.data-store.contacts :as contacts-store]
[status-im.utils.js-resources :as js-res]))
@ -17,6 +17,11 @@
(fn [coeffects _]
(assoc coeffects :default-contacts js-res/default-contacts)))
(re-frame/reg-cofx
:get-default-dapps
(fn [coeffects _]
(assoc coeffects :default-dapps default-dapps/all)))
;;;; Handlers
(defn- update-contact [{:keys [whisper-identity] :as contact} {:keys [db]}]

View File

@ -8,6 +8,8 @@
(reg-sub :get-contacts :contacts/contacts)
(reg-sub :get-dapps :contacts/dapps)
(reg-sub :get-current-contact
:<- [:get-contacts]
:<- [:get-current-contact-identity]
@ -41,13 +43,14 @@
(fn [contacts]
(remove :dapp? contacts)))
(defn- filter-dapps [v dev-mode?]
(remove #(when-not dev-mode? (true? (:developer? %))) v))
(reg-sub :all-dapp-with-url-contacts
:<- [:all-added-contacts]
:<- [:get-dapps]
:<- [:get-current-account]
(fn [[contacts {:keys [dev-mode?]}]]
(filter #(and (:dapp? %) (:dapp-url %) (or dev-mode?
(not= "simple-dapp" (:whisper-identity %))))
contacts)))
(fn [[dapps {:keys [dev-mode?]}]]
(map (fn [m] (update m :data #(filter-dapps % dev-mode?))) dapps)))
(reg-sub :get-people-in-current-chat
:<- [:get-current-chat-contacts]

View File

@ -145,6 +145,7 @@
(spec/def ::db (allowed-keys
:opt
[:contacts/contacts
:contacts/dapps
:contacts/new-identity
:contacts/new-public-key-error
:contacts/identity