Skip to content

Instantly share code, notes, and snippets.

@BrianLitwin
Created September 12, 2019 20:58
Show Gist options
  • Save BrianLitwin/6df2e320078be039ed23a96a9ee01a3b to your computer and use it in GitHub Desktop.
Save BrianLitwin/6df2e320078be039ed23a96a9ee01a3b to your computer and use it in GitHub Desktop.
(bem/defbem blend-card [{:keys [sleeves latest_customer journey_count] :as blend}]
(let [models (map #(->> % :strategy_id get-strat-model) sleeves)
pie-options
(make-pie-options
{:sleeves models :percents (map #(:percent %) sleeves)})]
[:*
[:*body {:on-click #(rf/dispatch [:account/select-blend blend blend])}
[blend-header blend]
[:*body-cols
[:*pie-area [Highcharts {:element {:class "blend-card__pie"} :options pie-options}]]
[:*producer-list
(doall (for [model (take 3 models)]
[:*producer-list-item
[:*circle {:style {:background (-> model :producer :color)}}]
(-> model :producer :name)]))
[:*producer-list-item {:on-click (do #(.stopPropagation %) #(rf/dispatch [:account/view-mix-explorer]) )}
(if (< 3 (count models))
[:*more-details--no-underline "+ " [:span*more-details (str (- (count models) 3)) " more sleeves"]]
[:*more-details "More details"])]]]
[:*footer
[:span*-footer "Used "]
[:span*footer--bold journey_count]
[:span*footer (str " time" (when (> journey_count 1) "s") ". Last used for " latest_customer ".")]]
]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment