Skip to content

Commit

Permalink
Merge pull request mtgred#7406 from Wikignometry/color-code
Browse files Browse the repository at this point in the history
Color-code stats page wins/losses
  • Loading branch information
NoahTheDuke authored Jun 28, 2024
2 parents 6f42137 + 3b89b45 commit c4fdb63
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cljs/nr/stats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@
[state {:keys [title corp runner turn winner replay-shared has-replay start-date] :as game} log-scroll-top]
(let [corp-id (get @all-cards (:identity corp))
runner-id (get @all-cards (:identity runner))
turn-count (if turn turn 0)]
[:div.gameline {:style {:min-height "auto"}}
turn-count (if turn turn 0)
user (:user @app-state)
user-win (if (= (str winner) "corp")
(if (= (:username user) (get-in corp [:player :username])) " (You)" "")
(if (= (:username user) (get-in runner [:player :username])) " (You)" ""))]
[:div.gameline {:style {:min-height "auto"
:border-color (when winner (if (= user-win " (You)") "#6AB56A" "#Ea7d7f"))}}
[:button.float-right
{:on-click #(do
(fetch-log state game)
Expand All @@ -185,7 +190,7 @@
(faction-icon-memo (:faction runner-id) (:title runner-id)) " " (:title runner-id)]]

(when winner
[:h4 (tr [:stats.winner "Winner"]) ": " (tr-side winner)])]))
[:h4 (tr [:stats.winner "Winner"]) ": " (tr-side winner) (str user-win)])]))

(defn history [_state list-scroll-top _log-scroll-top]
(r/create-class
Expand Down

0 comments on commit c4fdb63

Please sign in to comment.