Skip to content

Commit

Permalink
Remove unused code, use idiomatic clojure
Browse files Browse the repository at this point in the history
Changes made:
✅ ui/src/district/graphql_utils.cljs:184:29: warning: unused binding description
✅ ui/src/ethlance/ui/component/chat.cljs:59:8: warning: redundant do
✅ ui/src/ethlance/ui/component/file_drag_input.cljs:22:31: warning: Missing else branch.
✅ ui/src/ethlance/ui/component/main_layout.cljs:24:41: warning: Unresolved namespace clojure.string. Are you missing a require?
✅ ui/src/ethlance/ui/component/main_navigation_bar.cljs:27:9: warning: unused binding profile-image
✅ ui/src/ethlance/ui/component/main_navigation_bar.cljs:45:13: warning: unused binding active-user-id
✅ ui/src/ethlance/ui/component/main_navigation_menu.cljs:39:39: error: get-in with single key
✅ ui/src/ethlance/ui/component/main_navigation_menu.cljs:9:35: warning: #'re-frame.core/subscribe is referred but never used
✅ ui/src/ethlance/ui/component/mobile_sidebar.cljs:2:3: warning: Docstring should not be blank.
✅ ui/src/ethlance/ui/component/pagination.cljs:77:11: warning: unused binding current-page
✅ ui/src/ethlance/ui/component/scrollable.cljs:31:13: warning: unused binding this
✅ ui/src/ethlance/ui/component/search_input.cljs:94:13: warning: unused binding this
✅ ui/src/ethlance/ui/page/jobs.cljs:197:34: warning: unused binding event
✅ ui/src/ethlance/ui/page/jobs.cljs:30:6: warning: namespace ethlance.ui.util.tokens is required but never used
✅ ui/src/ethlance/ui/page/jobs.cljs:38:33: error: get-in with single key
✅ ui/src/ethlance/ui/page/jobs.cljs:41:34: error: get-in with single key
✅ ui/src/ethlance/ui/page/jobs.cljs:59:32: error: get-in with single key
✅ ui/src/ethlance/ui/page/jobs.cljs:62:33: error: get-in with single key
✅ ui/src/ethlance/ui/page/jobs.cljs:85:35: error: get-in with single key
✅ ui/src/ethlance/ui/page/jobs/events.cljs:34:9: warning: unused binding page-state
✅ ui/src/ethlance/ui/page/jobs/events.cljs:35:23: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/jobs/events.cljs:4:6: warning: namespace district.ui.graphql.events is required but never used
✅ ui/src/ethlance/ui/page/jobs/events.cljs:5:6: warning: namespace district.ui.router.effects is required but never used
✅ ui/src/ethlance/ui/page/jobs/events.cljs:6:6: warning: namespace ethlance.shared.constants is required but never used
✅ ui/src/ethlance/ui/page/jobs/subscriptions.cljs:34:33: error: get-in with single key
✅ ui/src/ethlance/ui/page/me.cljs:16:37: warning: #'ethlance.ui.util.dates/relative-ago is referred but never used
✅ ui/src/ethlance/ui/page/me.cljs:196:9: warning: unused binding active-user
✅ ui/src/ethlance/ui/page/me.cljs:264:9: warning: unused binding active-user
✅ ui/src/ethlance/ui/page/me.cljs:316:52: error: get-in with single key
✅ ui/src/ethlance/ui/page/me.cljs:383:9: warning: unused binding arbiter-name-fn
✅ ui/src/ethlance/ui/page/me.cljs:385:68: error: get-in with single key
✅ ui/src/ethlance/ui/page/me.cljs:386:69: error: get-in with single key
✅ ui/src/ethlance/ui/page/me.cljs:395:59: error: get-in with single key
✅ ui/src/ethlance/ui/page/me.cljs:517:14: warning: unused binding page
✅ ui/src/ethlance/ui/page/me.cljs:518:14: warning: unused binding params
✅ ui/src/ethlance/ui/page/me.cljs:538:65: error: Expected: map, received: keyword.
✅ ui/src/ethlance/ui/page/me.cljs:7:43: warning: #'ethlance.ui.component.button/c-button is referred but never used
✅ ui/src/ethlance/ui/page/me.cljs:7:52: warning: #'ethlance.ui.component.button/c-button-label is referred but never used
✅ ui/src/ethlance/ui/page/me.cljs:7:6: warning: namespace ethlance.ui.component.button is required but never used
✅ ui/src/ethlance/ui/page/me.cljs:8:50: warning: #'ethlance.ui.component.circle-button/c-circle-icon-button is referred but never used
✅ ui/src/ethlance/ui/page/me.cljs:8:6: warning: namespace ethlance.ui.component.circle-button is required but never used
✅ ui/src/ethlance/ui/page/me/events.cljs:26:9: warning: unused binding page-state
✅ ui/src/ethlance/ui/page/me/events.cljs:27:23: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/me/events.cljs:3:6: warning: namespace district.ui.router.effects is required but never used
✅ ui/src/ethlance/ui/page/new_invoice.cljs:54:13: warning: unused binding token-display-name
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:11:6: warning: duplicate require of district.ui.smart-contracts.queries
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:121:8: warning: unused binding db
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:126:8: warning: unused binding db
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:134:22: warning: unused binding event-name
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:138:11: warning: unused binding invoice-created
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:142:25: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:147:8: warning: unused binding db
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:16:36: warning: #'ethlance.shared.utils/eth->wei is referred but never used
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:3:6: warning: namespace cljs-web3-next.eth is required but never used
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:4:6: warning: namespace cljs-web3-next.helpers is required but never used
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:60:32: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/new_invoice/events.cljs:67:33: error: get-in with single key
✅ ui/src/ethlance/ui/page/new_invoice/subscriptions.cljs:35:14: warning: Single arg use of or always returns the arg itself
✅ ui/src/ethlance/ui/page/new_invoice/subscriptions.cljs:3:6: warning: namespace district.ui.conversion-rates.queries is required but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:224:4: warning: unused binding user-id
✅ ui/src/ethlance/ui/page/new_job.cljs:22:6: warning: namespace ethlance.ui.page.new-job.events is required but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:23:6: warning: namespace ethlance.ui.subscriptions is required but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:24:41: warning: #'ethlance.ui.util.component/<sub is referred but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:51:8: warning: Unused private var ethlance.ui.page.new-job/c-submit-button
✅ ui/src/ethlance/ui/page/new_job.cljs:6:6: warning: namespace district.ui.smart-contracts.queries is required but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:7:6: warning: namespace district.ui.web3-tx.events is required but never used
✅ ui/src/ethlance/ui/page/new_job.cljs:97:13: warning: unused binding with-nft?
✅ ui/src/ethlance/ui/page/new_job/events.cljs:14:36: warning: #'ethlance.shared.utils/eth->wei is referred but never used
✅ ui/src/ethlance/ui/page/new_job/events.cljs:172:29: error: get-in with single key
✅ ui/src/ethlance/ui/page/new_job/events.cljs:182:24: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:207:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:213:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:219:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:226:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:232:24: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:257:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:263:24: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:279:4: warning: unused binding db
✅ ui/src/ethlance/ui/page/new_job/events.cljs:287:24: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/new_job/events.cljs:354:8: warning: unused binding db
✅ ui/src/ethlance/ui/page/new_job/events.cljs:359:3: warning: Redundant let expression.
✅ ui/src/ethlance/ui/page/new_job/events.cljs:366:22: warning: unused binding event-name
✅ ui/src/ethlance/ui/page/new_job/events.cljs:3:6: warning: namespace web3 is required but never used
✅ ui/src/ethlance/ui/page/new_job/events.cljs:4:6: warning: namespace alphabase.hex is required but never used
✅ ui/src/ethlance/ui/page/new_job/events.cljs:64:18: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:100:34: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:100:78: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:101:32: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:11:43: warning: #'ethlance.shared.utils/ilike!= is referred but never used
✅ ui/src/ethlance/ui/page/profile.cljs:14:50: warning: #'ethlance.ui.component.circle-button/c-circle-icon-button is referred but never used
✅ ui/src/ethlance/ui/page/profile.cljs:14:6: warning: namespace ethlance.ui.component.circle-button is required but never used
✅ ui/src/ethlance/ui/page/profile.cljs:215:8: warning: use the idiom (seq x) rather than (not (empty? x))
✅ ui/src/ethlance/ui/page/profile.cljs:241:30: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:264:9: warning: unused binding page-params
✅ ui/src/ethlance/ui/page/profile.cljs:481:17: warning: unused binding name
✅ ui/src/ethlance/ui/page/profile.cljs:481:22: warning: unused binding params
✅ ui/src/ethlance/ui/page/profile.cljs:485:35: warning: unused binding params
✅ ui/src/ethlance/ui/page/profile.cljs:53:30: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:54:26: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile.cljs:5:6: warning: namespace district.format is required but never used
✅ ui/src/ethlance/ui/page/profile.cljs:6:6: warning: namespace district.graphql-utils is required but never used
✅ ui/src/ethlance/ui/page/profile.cljs:99:36: error: get-in with single key
✅ ui/src/ethlance/ui/page/profile/events.cljs:107:8: warning: unused binding db
✅ ui/src/ethlance/ui/page/profile/events.cljs:120:21: warning: unused binding event
✅ ui/src/ethlance/ui/page/profile/events.cljs:134:24: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/profile/events.cljs:134:30: warning: unused binding event
✅ ui/src/ethlance/ui/page/profile/events.cljs:25:9: warning: unused binding page-state
✅ ui/src/ethlance/ui/page/profile/events.cljs:30:23: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/profile/events.cljs:53:16: warning: unused binding db
✅ ui/src/ethlance/ui/page/profile/events.cljs:5:41: warning: #'district.ui.router.queries/active-page-params is referred but never used
✅ ui/src/ethlance/ui/page/profile/events.cljs:5:6: warning: namespace district.ui.router.queries is required but never used
✅ ui/src/ethlance/ui/page/profile/events.cljs:8:36: warning: #'ethlance.shared.utils/eth->wei is referred but never used
✅ ui/src/ethlance/ui/page/sign_up.cljs:101:8: warning: Unused private var ethlance.ui.page.sign-up/c-user-linkedin-input
✅ ui/src/ethlance/ui/page/sign_up.cljs:155:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:156:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:223:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:224:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:265:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:266:45: error: get-in with single key
✅ ui/src/ethlance/ui/page/sign_up.cljs:26:6: warning: namespace ethlance.ui.subscriptions is required but never used
✅ ui/src/ethlance/ui/page/sign_up.cljs:27:41: warning: #'ethlance.ui.util.component/<sub is referred but never used
✅ ui/src/ethlance/ui/page/sign_up.cljs:87:8: warning: Unused private var ethlance.ui.page.sign-up/c-user-github-input
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:163:8: warning: unused binding cofx
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:3:6: warning: namespace district.parsers is required but never used
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:46:23: error: assoc-in with single key
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:6:6: warning: namespace district.ui.web3-accounts.events is required but never used
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:9:41: warning: #'ethlance.ui.util.component/>evt is referred but never used
✅ ui/src/ethlance/ui/page/sign_up/events.cljs:9:6: warning: namespace ethlance.ui.util.component is required but never used
✅ ui/src/ethlance/ui/page/sign_up/subscriptions.cljs:4:6: warning: namespace ethlance.ui.subscriptions is required but never used
✅ ui/src/ethlance/ui/page/sign_up/subscriptions.cljs:5:6: warning: namespace ethlance.ui.util.urls is required but never used
✅ ui/src/ethlance/ui/subscriptions.cljs:37:11: warning: Unresolved namespace ethlance.shared.utils. Are you missing a require?
✅ ui/src/ethlance/ui/util/graphql.cljs:8:57: error: get-in with single key
✅ ui/src/ethlance/ui/util/tokens.cljs:68:9: warning: Unresolved namespace clojure.walk. Are you missing a require?
✅ ui/src/ethlance/ui/util/tokens.cljs:7:6: warning: namespace re-frame.core is required but never used
✅ ui/src/ethlance/ui/util/urls.cljs:17:10: warning: Unresolved namespace clojure.string. Are you missing a require?
✅ ui/src/ethlance/ui/util/urls.cljs:3:6: warning: namespace ethlance.ui.config is required but never used
✅ ui/src/ethlance/ui/util/users.cljs:16:34: error: Unresolved symbol: ilike=
✅ ui/src/ethlance/ui/util/users.cljs:7:35: error: get-in with single key
  • Loading branch information
madis committed Mar 6, 2024
1 parent bd09239 commit aa3d9a9
Show file tree
Hide file tree
Showing 30 changed files with 109 additions and 260 deletions.
2 changes: 1 addition & 1 deletion ui/src/district/graphql_utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@


(defn add-scalar-type
[schema-ast {:keys [:name :description :serialize :parseValue :parseLiteral]
[schema-ast {:keys [:name :serialize :parseValue :parseLiteral]
:or {serialize identity
parseValue identity
parseLiteral identity}
Expand Down
5 changes: 2 additions & 3 deletions ui/src/ethlance/ui/component/chat.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@
[:div.ethlance-chat-log
(doall
(for [message chat-listing]
(do
^{:key (str "chat-message-" (:id message) "-" (hash (:text message)))}
[c-chat-message message])))])
^{:key (str "chat-message-" (:id message) "-" (hash (:text message)))}
[c-chat-message message]))])
2 changes: 1 addition & 1 deletion ui/src/ethlance/ui/component/file_drag_input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:or {file-accept-pred (constantly true)}}]
(let [allow-drop #(.preventDefault %)
handle-files-select (fn [files]
(if-let [f (aget files 0)]
(when-let [f (aget files 0)]
(let [fprops {:name (.-name f)
:type (.-type f)
:size (.-size f)
Expand Down
6 changes: 1 addition & 5 deletions ui/src/ethlance/ui/component/main_layout.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns ethlance.ui.component.main-layout
(:require
[akiroz.re-frame.storage]
[clojure.string]
[district.ui.component.notification :as component.notification]
[district.ui.router.subs :as router.subs]
[ethlance.ui.component.circle-button :refer [c-circle-icon-button]]
Expand All @@ -27,11 +28,6 @@
(clojure.string/join " " (map clojure.string/capitalize name-parts))))


(defn has-active-session?
[]
(not (nil? (akiroz.re-frame.storage/<-store :ethlance))))


(defn c-main-layout
"The main layout of each page in the ethlance ui.
Expand Down
8 changes: 2 additions & 6 deletions ui/src/ethlance/ui/component/main_navigation_bar.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[ethlance.ui.component.ethlance-logo :refer [c-ethlance-logo]]
[ethlance.ui.component.profile-image :refer [c-profile-image]]
[ethlance.ui.event.sign-in]
[ethlance.ui.subscriptions :as ethlance-subs]
[ethlance.ui.util.navigation :as util.navigation]
[print.foo :include-macros true]
[re-frame.core :as re]))
Expand All @@ -23,8 +22,7 @@
:user/name
:user/email
:user/profile-image]]
result (re/subscribe [::gql/query {:queries [query]} {:refetch-on #{:ethlance.user-profile-updated}}])
profile-image (get-in @result [:user :user/profile-image])]
result (re/subscribe [::gql/query {:queries [query]} {:refetch-on #{:ethlance.user-profile-updated}}])]
[:a.profile (util.navigation/link-params {:route :route.user/profile :params {:address active-account}})
(when (not (:graphql/loading? @result))
[c-profile-image {:size :small :src (get-in @result [:user :user/profile-image])}])
Expand All @@ -39,11 +37,9 @@
"Main Navigation bar seen while the site is in desktop-mode."
[]
(let [active-account (re/subscribe [::accounts-subs/active-account])
active-session (re/subscribe [::ethlance-subs/active-session])
balance-eth (re/subscribe [::balances-subs/active-account-balance])]
(fn []
(let [active-user-id (or (:user/id @active-session) @active-account)
eth-balance (web3-utils/wei->eth-number (or @balance-eth 0))]
(let [eth-balance (web3-utils/wei->eth-number (or @balance-eth 0))]
[:div.main-navigation-bar
[c-ethlance-logo
{:color :white
Expand Down
4 changes: 2 additions & 2 deletions ui/src/ethlance/ui/component/main_navigation_menu.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[ethlance.ui.component.icon :refer [c-icon]]
[ethlance.ui.subscriptions :as ethlance-subs]
[ethlance.ui.util.navigation :as util.navigation]
[re-frame.core :as re :refer [subscribe]]))
[re-frame.core :as re]))


(defn- c-menu-item
Expand Down Expand Up @@ -36,7 +36,7 @@
:user/name
:user/profile-image]]
result (re/subscribe [::gql/query {:queries [query]}])
active-user (get-in @result [:user])]
active-user (get @result :user)]
[:div.main-navigation-menu
[c-menu-item {:name :new-job :label "New Job" :route :route.job/new}]
[c-menu-item {:name :jobs :label "Jobs" :route :route.job/jobs}]
Expand Down
1 change: 0 additions & 1 deletion ui/src/ethlance/ui/component/mobile_sidebar.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(ns ethlance.ui.component.mobile-sidebar
""
(:require
;; Ethlance Components
[ethlance.ui.component.icon :refer [c-icon]]
Expand Down
1 change: 0 additions & 1 deletion ui/src/ethlance/ui/component/pagination.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
offset
set-offset-event]}]
(let [total-count (or total-count 0)
current-page (-> offset (/ limit) ceil inc)
num-pages (-> total-count (/ limit) ceil)
prev-offset (- offset limit)
prev-offset (if (< prev-offset 0) 0 prev-offset)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/ethlance/ui/component/scrollable.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{:display-name "c-scrollable"

:component-did-mount
(fn [this]
(fn [_this]
(let [elnode (.-current react-ref)
simplebar (simplebar elnode (clj->js opts))]
(reset! *instance simplebar)))
Expand Down
2 changes: 1 addition & 1 deletion ui/src/ethlance/ui/component/search_input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
(r/create-class
{:display-name "ethlance-chip-search-input"
:component-did-mount
(fn [this]
(fn [_this]
(let [root-dom (.-current react-ref)
search-input (.querySelector root-dom ".search-input")]
(.addEventListener
Expand Down
32 changes: 13 additions & 19 deletions ui/src/ethlance/ui/page/jobs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,21 @@
[ethlance.ui.component.text-input :refer [c-text-input]]
[ethlance.ui.component.token-info :refer [c-token-info]]
[ethlance.ui.util.navigation :as util.navigation]
[ethlance.ui.util.tokens :as tokens]
[inflections.core :as inflections]
[re-frame.core :as re]))


(defn c-user-employer-detail
[employer]
(let [name (get-in employer [:user :user/name])
rating (get-in employer [:employer/rating])
rating (get employer :employer/rating)
rating-count (get-in employer [:employer/feedback :total-count])
country (get-in employer [:user :user/country])
address (get-in employer [:user/id])]
address (get employer :user/id)]
[:div.user-detail.employer
{:on-click (util.navigation/create-handler {:route :route.user/profile
:params {:address address}
:query {:tab :employer}})
:href (util.navigation/resolve-route {:route :route.user/profile
:params {:address address}
:query {:tab :employer}})}
(util.navigation/link-params {:route :route.user/profile
:params {:address address}
:query {:tab :employer}})
[:div.name name]
[:div.rating-container
[c-rating {:size :small :color :primary :default-rating rating}]
Expand All @@ -56,17 +52,14 @@
(defn c-user-arbiter-detail
[arbiter]
(let [name (get-in arbiter [:user :user/name])
rating (get-in arbiter [:employer/rating])
rating (get arbiter :employer/rating)
rating-count (get-in arbiter [:arbiter/feedback :total-count])
country (get-in arbiter [:user :user/country])
address (get-in arbiter [:user/id])]
address (get arbiter :user/id)]
[:div.user-detail.arbiter
{:on-click (util.navigation/create-handler {:route :route.user/profile
:params {:address address}
:query {:tab :arbiter}})
:href (util.navigation/resolve-route {:route :route.user/profile
:params {:address address}
:query {:tab :arbiter}})}
(util.navigation/link-params {:route :route.user/profile
:params {:address address}
:query {:tab :arbiter}})
[c-inline-svg {:class "arbiter-icon" :src "images/svg/hammer.svg"}]
[:div.name name]
[:div.rating-container
Expand All @@ -82,7 +75,7 @@
:beginner "Novice ($)"
:intermediate "Professional ($$)"
:expert "Expert ($$$)")
token-details (get-in job [:token-details])
token-details (get job :token-details)
amount (:job/token-amount job)]
[:div.job-detail-table
[:div.name "Payment Type"]
Expand Down Expand Up @@ -194,7 +187,8 @@
relative-ago (format/time-ago (new js/Date date-created))
pluralized-proposals (inflections/pluralize proposals-count "proposal")]
[:div.job-element
[:div.title {:on-click (fn [event] (re/dispatch [::router-events/navigate :route.job/detail {:id id}]))}
[:a.title (util.navigation/link-params {:route :route.job/detail
:params {:id id}})
title]
[:div.description description]
[:div.date (str "Posted " relative-ago " | " pluralized-proposals)]
Expand Down
6 changes: 1 addition & 5 deletions ui/src/ethlance/ui/page/jobs/events.cljs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
(ns ethlance.ui.page.jobs.events
(:require
[district.parsers :refer [parse-int]]
[district.ui.graphql.events :as gql-events]
[district.ui.router.effects :as router.effects]
[ethlance.shared.constants :as constants]
[ethlance.ui.event.templates :as event.templates]
[ethlance.ui.event.utils :as event.utils]
[re-frame.core :as re]))
Expand Down Expand Up @@ -31,8 +28,7 @@
(defn initialize-page
"Event FX Handler. Setup listener to dispatch an event when the page is active/visited."
[{:keys [db]} _]
(let [page-state (get db state-key)]
{:db (assoc-in db [state-key] state-default)}))
{:db (assoc db state-key state-default)})


(defn add-skill
Expand Down
4 changes: 1 addition & 3 deletions ui/src/ethlance/ui/page/jobs/subscriptions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

(re/reg-sub :page.jobs/offset (create-get-handler :offset))
(re/reg-sub :page.jobs/limit (create-get-handler :limit))
(re/reg-sub :page.jobs/job-listing (create-get-handler :job-listing))
(re/reg-sub :page.jobs/job-listing-state (create-get-handler :job-listing/state))
(re/reg-sub :page.jobs/skills (create-get-handler :skills))
(re/reg-sub :page.jobs/category (create-get-handler :category))
(re/reg-sub :page.jobs/feedback-max-rating (create-get-handler :feedback-max-rating))
Expand All @@ -31,7 +29,7 @@
(re/reg-sub
:page.jobs/job-search-params
(fn [db _]
(let [page-state (get-in db [jobs.events/state-key] {})
(let [page-state (get db jobs.events/state-key {})
filters [[:skills #(into [] %)]
[:category second]
[:feedback-max-rating]
Expand Down
25 changes: 9 additions & 16 deletions ui/src/ethlance/ui/page/me.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
[district.ui.graphql.subs :as gql]
[district.ui.router.events :as router.events]
[district.ui.router.subs :as router.subs]
[ethlance.ui.component.button :refer [c-button c-button-label]]
[ethlance.ui.component.circle-button :refer [c-circle-icon-button]]
[ethlance.ui.component.info-message :refer [c-info-message]]
[ethlance.ui.component.loading-spinner :refer [c-loading-spinner]]
[ethlance.ui.component.main-layout :refer [c-main-layout]]
[ethlance.ui.component.mobile-sidebar :refer [c-mobile-sidebar]]
[ethlance.ui.component.pagination :refer [c-pagination-ends]]
[ethlance.ui.component.table :refer [c-table]]
[ethlance.ui.component.tabular-layout :refer [c-tabular-layout]]
[ethlance.ui.util.dates :refer [relative-ago formatted-date]]
[ethlance.ui.util.dates :refer [formatted-date]]
[ethlance.ui.util.navigation :refer [link-params] :as util.navigation]
[ethlance.ui.util.tokens :as tokens]
[re-frame.core :as re]))
Expand Down Expand Up @@ -193,8 +191,7 @@

(defn c-contract-listing
[user-type user-address]
(let [active-user (:user/id @(re/subscribe [:ethlance.ui.subscriptions/active-session]))
url-query @(re/subscribe [::router.subs/active-page-query])
(let [url-query @(re/subscribe [::router.subs/active-page-query])
tab (or (:tab url-query) "invitation")
tab-to-index {"invitation" 0 "proposal" 1 "active" 2 "finished" 3}
tab-index (get tab-to-index tab 0)
Expand Down Expand Up @@ -261,8 +258,7 @@

(defn c-invoice-listing
[user-type user-address]
(let [active-user (:user/id @(re/subscribe [:ethlance.ui.subscriptions/active-session]))
url-query @(re/subscribe [::router.subs/active-page-query])
(let [url-query @(re/subscribe [::router.subs/active-page-query])
tab (or (:tab url-query) "pending")
tab-to-index {"pending" 0 "paid" 1}
tab-index (get tab-to-index tab 0)
Expand Down Expand Up @@ -313,7 +309,7 @@
{:title "Candidate" :source user-name-fn}
{:title "Amount Requested" :source amount-requested-fn}
{:title "Created at" :source invoice-date-created-fn}
{:title "Status" :source #(get-in % [:invoice/status])}]
{:title "Status" :source #(get % :invoice/status)}]
invoice-link-fn (fn [invoice]
{:route :route.invoice/index
:params {:job-id (:job/id invoice) :invoice-id (:invoice/id invoice)}})
Expand Down Expand Up @@ -380,10 +376,9 @@
:offset offset}
disputes (get-in disputes-result [:dispute-search :items])
candidate-name-fn (fn [invoice] (get-in invoice [:candidate :user :user/name]))
arbiter-name-fn (fn [invoice] (get-in invoice [:arbiter :user :user/name]))
arbiter-name-fn (fn [invoice] (get-in invoice [:dispute-resolved-message :creator :user/name]))
dispute-date-created-fn (partial formatted-date #(get-in % [:dispute/date-created]))
dispute-date-resolved-fn (partial formatted-date #(get-in % [:dispute/date-resolved]))
dispute-date-created-fn (partial formatted-date #(get % :dispute/date-created))
dispute-date-resolved-fn (partial formatted-date #(get % :dispute/date-resolved))
contract-link-fn (fn [dispute] {:route :route.job/contract :params {:job-story-id (:job-story/id dispute)}})
amount-fn (fn [amount-source invoice]
(str (tokens/human-amount
Expand All @@ -392,7 +387,7 @@
(get-in invoice [:job :token-details :token-detail/decimals]))
" " (get-in invoice [:job :token-details :token-detail/symbol])))
truncated-dispute-fn (fn [text-source invoice]
(let [text (get-in invoice [text-source] "")
(let [text (get invoice text-source "")
max-chars 20]
(if (empty? text)
""
Expand Down Expand Up @@ -514,9 +509,7 @@
[]
(let [active-page (re/subscribe [::router.subs/active-page])]
(fn []
(let [{page :name
params :param
query :query} @active-page
(let [{query :query} @active-page
*current-sidebar-choice (or (keyword (:sidebar query)) :my-employer-job-listing)]
[:div.listing
(case *current-sidebar-choice
Expand All @@ -535,7 +528,7 @@
:my-arbiter-job-listing [c-my-arbiter-job-listing]
:my-arbiter-dispute-listing [c-my-arbiter-dispute-listing]

(throw (ex-info "Unable to determine sidebar choice" *current-sidebar-choice)))]))))
(throw (ex-info "Unable to determine sidebar choice" {:current-sidebar-choice *current-sidebar-choice})))]))))


(defmethod page :route.me/index []
Expand Down
4 changes: 1 addition & 3 deletions ui/src/ethlance/ui/page/me/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns ethlance.ui.page.me.events
(:require
[district.ui.router.effects :as router.effects]
[ethlance.ui.event.utils :as event.utils]
[re-frame.core :as re]))

Expand All @@ -23,8 +22,7 @@
(defn initialize-page
"Event FX Handler. Setup listener to dispatch an event when the page is active/visited."
[{:keys [db]} _]
(let [page-state (get db state-key)]
{:db (assoc-in db [state-key] state-default)}))
{:db (assoc db state-key state-default)})


;;
Expand Down
1 change: 0 additions & 1 deletion ui/src/ethlance/ui/page/new_invoice.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
:items
(sort-by :job-story/date-created ,,,)
reverse)
token-display-name (-> @job-token :symbol (or ,,, "") name)
token-display-name (name (or (@job-token :symbol) (@job-token :type) ""))
job-token-decimals (get-in @*invoiced-job [:job :token-details :token-detail/decimals])]
[c-main-layout {:container-opts {:class :new-invoice-main-container}}
Expand Down
Loading

0 comments on commit aa3d9a9

Please sign in to comment.