Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fixes: don't show invite arbiter for himself. Remove dead code #388

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ui/src/ethlance/ui/component/token_info.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
(defn token-info-str
[token-amount token-detail]
(let [token-type (:token-detail/type token-detail)
token-name (:token-detail/name token-detail)
token-symbol (:token-detail/symbol token-detail)
decimals (:token-detail/decimals token-detail)]
(str (util.tokens/human-amount token-amount token-type decimals)
" "
(if token-name
token-name
(if token-symbol
(name token-symbol)
(clojure.string/upper-case (name (or token-type :?)))))))


Expand Down
23 changes: 0 additions & 23 deletions ui/src/ethlance/ui/page/job_detail.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,6 @@
[re-frame.core :as re]))


(defn c-token-values
[{:keys [token-type token-amount token-address token-id disabled? token-symbol token-name]}]
(let [token-type (keyword token-type)
step (if (= token-type :eth) 0.001 1)]
(cond
(= :erc721 token-type)
[:div "The payment will be NFT (ERC721)"]

(#{:eth :erc1155 :erc20} token-type)
[:div.amount-input
[c-text-input
{:placeholder "Token amount"
:step step
:type :number
:default-value nil
:disabled disabled?
:value token-amount
:on-change #(re/dispatch [:page.job-detail/set-proposal-token-amount (js/parseFloat %)])}]
[:a {:href (token-utils/address->token-info-url token-address) :target "_blank"}
[:label token-symbol]
[:label (str "(" (or token-name (name token-type)) ")")]]])))


(defn c-invoice-listing
[contract-address]
(let [invoices-query [:job {:job/id contract-address}
Expand Down
26 changes: 18 additions & 8 deletions ui/src/ethlance/ui/page/profile.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[district.ui.router.events :as router-events]
[district.ui.router.subs :as router-subs]
[ethlance.shared.utils :refer [ilike=]]
[ethlance.ui.component.button :refer [c-button c-button-label c-button-icon-label]]
[ethlance.ui.component.button :refer [c-button c-button-label]]
[ethlance.ui.component.carousel :refer [c-carousel c-feedback-slide]]
[ethlance.ui.component.main-layout :refer [c-main-layout]]
[ethlance.ui.component.pagination :refer [c-pagination-ends]]
Expand All @@ -19,6 +19,7 @@
[ethlance.ui.component.tabular-layout :refer [c-tabular-layout]]
[ethlance.ui.component.tag :refer [c-tag c-tag-label]]
[ethlance.ui.component.textarea-input :refer [c-textarea-input]]
[ethlance.ui.component.token-info :as token-info]
[ethlance.ui.page.profile.events :as profile-events]
[ethlance.ui.page.profile.subscriptions]
[ethlance.ui.util.dates :as util.dates]
Expand Down Expand Up @@ -94,7 +95,7 @@
[arbitration]
{:title (get-in arbitration [:job :job/title])
:start-date (get arbitration :arbitration/date-arbiter-accepted) ;
:fee (str (get arbitration :arbitration/fee) " " (get arbitration :arbitration/fee-currency-id))
:fee (token-info/token-info-str (get arbitration :arbitration/fee) (get arbitration :fee-token-details))
:status (get arbitration :arbitration/status)})


Expand All @@ -114,8 +115,13 @@
[:id
:arbitration/date-arbiter-accepted
:arbitration/fee
:arbitration/fee-currency-id
:arbitration/status
[:fee-token-details
[:token-detail/id
:token-detail/type
:token-detail/name
:token-detail/symbol
:token-detail/decimals]]
[:job
[:job/title]]]]]]]]
results @(re/subscribe [::gql/query {:queries [query]} {:refetch-on #{::profile-events/invite-arbiter-tx-success}}])
Expand Down Expand Up @@ -398,8 +404,9 @@

(defn c-arbiter-profile
[]
(let [user-address (re/subscribe [:page.profile/viewed-user-address])
query [:arbiter {:user/id @user-address}
(let [viewed-user-address (re/subscribe [:page.profile/viewed-user-address])
logged-in-user-address (:user/id @(re/subscribe [:ethlance.ui.subscriptions/active-session]))
query [:arbiter {:user/id @viewed-user-address}
[:arbiter/professional-title
:arbiter/bio
:arbiter/rating
Expand All @@ -409,7 +416,9 @@
[:user/name
:user/profile-image
:user/country
:user/languages]]
:user/languages
:user/is-registered-employer
:user/is-registered-arbiter]]
[:arbiter/feedback
[:total-count
[:items
Expand All @@ -428,7 +437,8 @@
languages (get-in @results [:arbiter :user :user/languages])
feedback-list (map prepare-feedback-cards (get-in @results [:arbiter :arbiter/feedback :items]))
rating {:average (get-in @results [:arbiter :arbiter/rating]) :count (count feedback-list)}
has-arbiter-profile? (not (nil? biography))]
has-arbiter-profile? (get-in @results [:arbiter :user :user/is-registered-arbiter])
viewing-own-profile? (ethlance.shared.utils/ilike= @viewed-user-address logged-in-user-address)]
[:<>
(if has-arbiter-profile?
[:div.arbiter-profile
Expand All @@ -444,7 +454,7 @@
[c-tag-list "Languages" languages]]]

[c-missing-profile-notification :arbiter])
(when has-arbiter-profile? [c-invite-arbiter])
(when (and has-arbiter-profile? (not viewing-own-profile?)) [c-invite-arbiter])
(when has-arbiter-profile? (c-arbitration-activity))
(c-feedback-listing professional-title feedback-list)]))

Expand Down
Loading