From bd3754376612e597efeb95fe3f714c2babd73755 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 19:06:29 -0700 Subject: [PATCH 01/11] add credit cost to decklist line items --- .gitignore | 1 + src/cljs/nr/deckbuilder.cljs | 15 +++++++++++++-- src/css/deckbuilder.styl | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 572a1c40a2..a9b0c53e0b 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ data/cards-pt.edn data/cards-ru.edn data/cards-zh-hans.edn data/cards-zh-hant.edn +/netrunner.iml diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index 81569e9b71..fbb5baab90 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -15,7 +15,7 @@ [nr.utils :refer [alliance-dots banned-span cond-button deck-points-card-span dots-html format->slug format-date-time influence-dot influence-dots mdy-formatter non-game-toast num->percent - restricted-span rotated-span set-scroll-top slug->format store-scroll-top]] + restricted-span rotated-span set-scroll-top slug->format store-scroll-top render-message]] [nr.ws :as ws] [reagent-modals.modals :as reagent-modals] [reagent.core :as r] @@ -387,6 +387,15 @@ (set-deck-on-state s deck) (put! select-channel (:deck @s))))))) +(defn card-cost-html + [card] + (when (:cost card) + [:div.card-cost + (render-message (str (:cost card) "[credit]")) + ] + ) + ) + (defn card-influence-html "Returns hiccup-ready vector with dots for influence as well as rotated / restricted / banned symbols" [format card qty in-faction allied?] @@ -667,7 +676,8 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} title] - [card-influence-html format card modqty infaction allied]]) + (card-cost-html card) + (card-influence-html format card modqty infaction allied)]) card)]) (defn line-qty-span @@ -697,6 +707,7 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} name] + (card-cost-html card) (card-influence-html format card modqty infaction allied)]) card)]) diff --git a/src/css/deckbuilder.styl b/src/css/deckbuilder.styl index db824c8b4a..3d920ad66d 100644 --- a/src/css/deckbuilder.styl +++ b/src/css/deckbuilder.styl @@ -127,6 +127,14 @@ line-height: 20px white-space:pre + .card-cost + display: inline-flex + margin-left: .1rem + + .credit + margin-left: .1rem + + button.small margin: 3px 6px 3px 0 From 017a654cd398c053d6fb5f715929344de2b83e43 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 19:07:56 -0700 Subject: [PATCH 02/11] format --- src/cljs/nr/deckbuilder.cljs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index fbb5baab90..4accb9ac5a 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -391,10 +391,8 @@ [card] (when (:cost card) [:div.card-cost - (render-message (str (:cost card) "[credit]")) - ] - ) - ) + (render-message (str (:cost card) "[credit]"))] + )) (defn card-influence-html "Returns hiccup-ready vector with dots for influence as well as rotated / restricted / banned symbols" From c0b4463e1cd50f04c25b982d460b3d54eef99ba3 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 19:11:58 -0700 Subject: [PATCH 03/11] cleanup code --- src/cljs/nr/deckbuilder.cljs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index 4accb9ac5a..475e95c7fd 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -390,9 +390,7 @@ (defn card-cost-html [card] (when (:cost card) - [:div.card-cost - (render-message (str (:cost card) "[credit]"))] - )) + [:div.card-cost (render-message (str (:cost card) "[credit]"))])) (defn card-influence-html "Returns hiccup-ready vector with dots for influence as well as rotated / restricted / banned symbols" From a3278d457173d1d488c98428bdd1058cf838a88a Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 20:22:55 -0700 Subject: [PATCH 04/11] nudge css --- src/css/deckbuilder.styl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css/deckbuilder.styl b/src/css/deckbuilder.styl index 3d920ad66d..2ea22d37e7 100644 --- a/src/css/deckbuilder.styl +++ b/src/css/deckbuilder.styl @@ -129,7 +129,7 @@ .card-cost display: inline-flex - margin-left: .1rem + margin-left: .2rem .credit margin-left: .1rem From 59dccaa0d9e5359696e070f4718bfd4d0f8849ae Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 20:24:16 -0700 Subject: [PATCH 05/11] change gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a9b0c53e0b..c570c37b08 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ pom.xml .nrepl-history .rebel_readline_history .idea +*.iml .eastwood .cache @@ -68,4 +69,3 @@ data/cards-pt.edn data/cards-ru.edn data/cards-zh-hans.edn data/cards-zh-hant.edn -/netrunner.iml From be4672da4eb8b997d771e0b5c07193262dc43f74 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Thu, 17 Oct 2024 20:25:29 -0700 Subject: [PATCH 06/11] too much whitespace --- src/css/deckbuilder.styl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/css/deckbuilder.styl b/src/css/deckbuilder.styl index 2ea22d37e7..4b7cecfd9a 100644 --- a/src/css/deckbuilder.styl +++ b/src/css/deckbuilder.styl @@ -134,7 +134,6 @@ .credit margin-left: .1rem - button.small margin: 3px 6px 3px 0 From efe2abae3328f98fefefd613be392b10754a6ffa Mon Sep 17 00:00:00 2001 From: Shiloh Date: Fri, 18 Oct 2024 22:58:50 -0700 Subject: [PATCH 07/11] implements card costs --- src/cljs/nr/deckbuilder.cljs | 40 +++++++++++++++++++++++++++++------- src/css/deckbuilder.styl | 36 ++++++++++++++++++++++++++------ 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index 475e95c7fd..d06a7694dc 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -388,9 +388,18 @@ (put! select-channel (:deck @s))))))) (defn card-cost-html - [card] - (when (:cost card) - [:div.card-cost (render-message (str (:cost card) "[credit]"))])) + [s card] + (let [show-credit-cost (:show-credit-cost @s) + show-mu-cost (:show-mu-cost @s) + is-edit (:edit @s)] + (when (or show-credit-cost show-mu-cost) + [:div.card-cost-wrapper + [:span.card-cost {:class (when is-edit "edit")} + (when show-mu-cost + (when-let [mu (:memoryunits card)] [:div.cost-item (render-message (str mu "[mu] "))])) + (when show-credit-cost + (when-let [cost (:cost card)] [:div.cost-item (render-message (str cost "[credit]"))]))] + ]))) (defn card-influence-html "Returns hiccup-ready vector with dots for influence as well as rotated / restricted / banned symbols" @@ -672,7 +681,6 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} title] - (card-cost-html card) (card-influence-html format card modqty infaction allied)]) card)]) @@ -703,7 +711,6 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} name] - (card-cost-html card) (card-influence-html format card modqty infaction allied)]) card)]) @@ -807,7 +814,8 @@ :card (:card line)}) :type "button"} "+"] [line-name-span deck line]] - [line-span deck line])]))]))]) + [line-span deck line] + )(card-cost-html s (:card line))]))]))]) (defn decklist-notes [deck] @@ -857,6 +865,21 @@ ;; (tr [:deck-builder.create-game "Create Game"])]) ]) +(defn view-toggles + [s deck] + [:div.decklist-view-options + [:h4 "View Options"] + (when (= (:side (:identity deck)) "Runner") + [:div + [:input {:type "checkbox" :checked (:show-mu-cost @s) + :on-change #(swap! s assoc :show-mu-cost (.. % -target -checked))}] + [:span "Show Memory Cost"]]) + [:div + [:input {:type "checkbox" :checked (:show-credit-cost @s) + :on-change #(swap! s assoc :show-credit-cost (.. % -target -checked))}] + [:span "Show Credit Cost"]] + ]) + (defn selected-panel [s] [:div.decklist @@ -870,6 +893,7 @@ :else [view-buttons s deck]) [:h3 (:name deck)] [decklist-header deck cards] + (view-toggles s deck) [decklist-contents s deck cards] (when-not (:edit @s) [decklist-notes deck])]))]) @@ -1057,7 +1081,9 @@ :deck nil :side-filter all-sides-filter :faction-filter all-factions-filter - :format-filter all-formats-filter}) + :format-filter all-formats-filter + :show-credit-cost false + :show-mu-cost false}) decks (r/cursor app-state [:decks]) user (r/cursor app-state [:user]) decks-loaded (r/cursor app-state [:decks-loaded]) diff --git a/src/css/deckbuilder.styl b/src/css/deckbuilder.styl index 4b7cecfd9a..43ee58b252 100644 --- a/src/css/deckbuilder.styl +++ b/src/css/deckbuilder.styl @@ -121,18 +121,42 @@ margin-top: 10px columns(2, 5px) + .line:hover + background: rgba(19 26 35 .46) + .line position: relative overflow: visible line-height: 20px white-space:pre + columns(2, 1rem) + + .card-cost-wrapper + display: flex; + position:relative; + overflow: visible; + width: auto; + justify-content flex-end; + + .card-cost + line-height: .75rem; + margin-top: .25rem; + margin-right: 2rem; + display: inline-flex; + position: absolute; + justify-content: left; + + .edit + line-height: .75rem; + margin-top: .35rem; + margin-right: .5rem; + .cost-item + display: inline-flex + margin-inline: .1rem; + + .credit + margin-left: .1rem - .card-cost - display: inline-flex - margin-left: .2rem - - .credit - margin-left: .1rem button.small margin: 3px 6px 3px 0 From 26b847453c5d50cd9d9b4fe38cd693be9c093aa8 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Fri, 18 Oct 2024 23:06:44 -0700 Subject: [PATCH 08/11] adjust view options vertical appearance --- src/css/deckbuilder.styl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/css/deckbuilder.styl b/src/css/deckbuilder.styl index 43ee58b252..48cabef4c0 100644 --- a/src/css/deckbuilder.styl +++ b/src/css/deckbuilder.styl @@ -99,6 +99,9 @@ overflow: auto -webkit-overflow-scrolling: touch + .decklist-view-options + margin-top: 1rem; + .button-bar padding-bottom: 8px @@ -151,7 +154,7 @@ margin-top: .35rem; margin-right: .5rem; .cost-item - display: inline-flex + display: inline-flex; margin-inline: .1rem; .credit From dbe951f919f52cda2946d5ec997e72ee5ca5c945 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Sat, 19 Oct 2024 19:30:15 -0700 Subject: [PATCH 09/11] formatting and brackets --- src/cljs/nr/deckbuilder.cljs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index d06a7694dc..1140e338fe 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -398,8 +398,7 @@ (when show-mu-cost (when-let [mu (:memoryunits card)] [:div.cost-item (render-message (str mu "[mu] "))])) (when show-credit-cost - (when-let [cost (:cost card)] [:div.cost-item (render-message (str cost "[credit]"))]))] - ]))) + (when-let [cost (:cost card)] [:div.cost-item (render-message (str cost "[credit]"))]))]]))) (defn card-influence-html "Returns hiccup-ready vector with dots for influence as well as rotated / restricted / banned symbols" @@ -681,7 +680,7 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} title] - (card-influence-html format card modqty infaction allied)]) + [card-influence-html format card modqty infaction allied]]) card)]) (defn line-qty-span @@ -711,7 +710,7 @@ (not valid) " invalid")) :on-mouse-enter #(when (:setname card) (put! zoom-channel line)) :on-mouse-leave #(put! zoom-channel false)} name] - (card-influence-html format card modqty infaction allied)]) + [card-influence-html format card modqty infaction allied]]) card)]) (defn- build-deck-points-tooltip [deck] @@ -814,8 +813,8 @@ :card (:card line)}) :type "button"} "+"] [line-name-span deck line]] - [line-span deck line] - )(card-cost-html s (:card line))]))]))]) + [line-span deck line]) + [card-cost-html s (:card line)]]))]))]) (defn decklist-notes [deck] @@ -893,7 +892,7 @@ :else [view-buttons s deck]) [:h3 (:name deck)] [decklist-header deck cards] - (view-toggles s deck) + [view-toggles s deck] [decklist-contents s deck cards] (when-not (:edit @s) [decklist-notes deck])]))]) From dc412f109ac41caf68f9f03548e3a96fa00a69b3 Mon Sep 17 00:00:00 2001 From: Shiloh Date: Sat, 19 Oct 2024 19:52:19 -0700 Subject: [PATCH 10/11] ignore gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index c570c37b08..572a1c40a2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ pom.xml .nrepl-history .rebel_readline_history .idea -*.iml .eastwood .cache From 9136104cc89a807a971fa2bc703cd0dc6376144c Mon Sep 17 00:00:00 2001 From: Shiloh Date: Sat, 19 Oct 2024 19:55:03 -0700 Subject: [PATCH 11/11] trailing brackets --- src/cljs/nr/deckbuilder.cljs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cljs/nr/deckbuilder.cljs b/src/cljs/nr/deckbuilder.cljs index 1140e338fe..f8ef057169 100644 --- a/src/cljs/nr/deckbuilder.cljs +++ b/src/cljs/nr/deckbuilder.cljs @@ -876,8 +876,7 @@ [:div [:input {:type "checkbox" :checked (:show-credit-cost @s) :on-change #(swap! s assoc :show-credit-cost (.. % -target -checked))}] - [:span "Show Credit Cost"]] - ]) + [:span "Show Credit Cost"]]]) (defn selected-panel [s]