Skip to content

Commit

Permalink
Link feedback slides to user profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
madis committed Nov 18, 2024
1 parent ae1751e commit b4e8f40
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
20 changes: 12 additions & 8 deletions ui/src/ethlance/ui/component/carousel.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@


(defn c-feedback-slide
[{:keys [id rating author text image-url class]}]
[:div.feedback-slide
;; FIXME: use better unique key
{:key (str "feedback-" id "-" rating) :class class}
[:div.profile-image [c-profile-image {:src image-url}]]
[:div.rating [c-rating {:rating rating :color :white}]]
[:div.message text]
[:div.name author]])
[{:keys [id rating author text image-url class link-params]}]
(let [slide-content [:div.feedback-slide
;; FIXME: use better unique key
{:key (str "feedback-" id "-" rating) :class class}
[:div.profile-image [c-profile-image {:src image-url}]]
[:div.rating [c-rating {:rating rating :color :white}]]
[:div.message text]
[:div.name author]]]
(if link-params
[:a link-params slide-content]
slide-content))
)


(defn c-carousel
Expand Down
15 changes: 10 additions & 5 deletions ui/src/ethlance/ui/page/job_detail.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[district.ui.graphql.subs :as gql]
[ethlance.shared.utils :refer [ilike!= ilike=]]
[ethlance.ui.component.button :refer [c-button c-button-label]]
[ethlance.ui.component.carousel :refer [c-carousel-old c-feedback-slide]]
[ethlance.ui.component.carousel :refer [c-carousel c-feedback-slide]]
[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]]
Expand Down Expand Up @@ -93,8 +93,10 @@
[:items [:feedback/rating
:feedback/text
:feedback/date-created
[:feedback/from-user [:user/name
:user/profile-image]]]]]]]]]]
[:feedback/from-user
[:user/id
:user/name
:user/profile-image]]]]]]]]]]
result @(re/subscribe [::gql/query {:queries [feedback-query]}])
feedback-raw (get-in result [:job :job/employer :employer/feedback :items])

Expand All @@ -103,13 +105,16 @@
:rating (:feedback/rating feedback)
:text (:feedback/text feedback)
:author (-> feedback :feedback/from-user :user/name)
:image-url (-> feedback :feedback/from-user :user/profile-image)})
:image-url (-> feedback :feedback/from-user :user/profile-image)
:link-params (link-params
{:route :route.user/profile
:params {:address (get-in feedback [:feedback/from-user :user/id])}})})
feedback-raw)]
[:div.feedback-listing
[:div.label "Feedback for employer"]
(if (empty? feedback)
[:label "No feedback yet for this employer"]
(into [c-carousel-old {}] (map #(c-feedback-slide %) feedback)))]))
(into [c-carousel {}] (map #(c-feedback-slide %) feedback)))]))


(defn c-proposals-section
Expand Down
12 changes: 8 additions & 4 deletions ui/src/ethlance/ui/page/profile.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
{:rating (:feedback/rating item)
:text (:feedback/text item)
:image-url (-> item :feedback/from-user :user/profile-image)
:author (get-in item [:feedback/from-user :user/name])})
:author (get-in item [:feedback/from-user :user/name])
:link-params (navigation/link-params {:route :route.user/profile :params {:address (get-in item [:feedback/from-user :user/id])}})})


(defn c-missing-profile-notification
Expand Down Expand Up @@ -266,7 +267,8 @@
:feedback/text
:feedback/rating
[:feedback/from-user
[:user/name
[:user/id
:user/name
:user/profile-image]]]]]]]]
results (re/subscribe [::gql/query {:queries [query]}])
name (get-in @results [:candidate :user :user/name])
Expand Down Expand Up @@ -318,7 +320,8 @@
:feedback/text
:feedback/rating
[:feedback/from-user
[:user/name
[:user/id
:user/name
:user/profile-image]]]]]]]]
results (re/subscribe [::gql/query {:queries [query]}])
name (get-in @results [:employer :user :user/name])
Expand Down Expand Up @@ -429,7 +432,8 @@
:feedback/text
:feedback/rating
[:feedback/from-user
[:user/name
[:user/id
:user/name
:user/profile-image]]]]]]]]
results (re/subscribe [::gql/query {:queries [query]}])
name (get-in @results [:arbiter :user :user/name])
Expand Down

0 comments on commit b4e8f40

Please sign in to comment.