From 5dc7f029a68d90908f69031f00122bf67de01dec Mon Sep 17 00:00:00 2001 From: codeGlaze Date: Mon, 11 Mar 2024 12:12:27 -0400 Subject: [PATCH 1/2] Fixes #602 - minor - SVG icon swap minor + adds svg icons for rod-of-asclepius + changes CON icon to RoA + added some basic documentation to relevant functions --- resources/public/image/black/rod-of-asclepius.svg | 1 + resources/public/image/rod-of-asclepius.svg | 1 + src/cljc/orcpub/dnd/e5/template.cljc | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 resources/public/image/black/rod-of-asclepius.svg create mode 100644 resources/public/image/rod-of-asclepius.svg diff --git a/resources/public/image/black/rod-of-asclepius.svg b/resources/public/image/black/rod-of-asclepius.svg new file mode 100644 index 000000000..e88075973 --- /dev/null +++ b/resources/public/image/black/rod-of-asclepius.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/public/image/rod-of-asclepius.svg b/resources/public/image/rod-of-asclepius.svg new file mode 100644 index 000000000..6c7a8d300 --- /dev/null +++ b/resources/public/image/rod-of-asclepius.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/cljc/orcpub/dnd/e5/template.cljc b/src/cljc/orcpub/dnd/e5/template.cljc index de8c957cb..a6f6493fb 100644 --- a/src/cljc/orcpub/dnd/e5/template.cljc +++ b/src/cljc/orcpub/dnd/e5/template.cljc @@ -49,14 +49,22 @@ (assoc a k other-v other-k v)))))) (def ability-icons + "Icons / names are provided by https://game-icons.net/" {::char5e/str "strong" - ::char5e/con "caduceus" + ::char5e/con "rod-of-asclepius" ::char5e/dex "body-balance" ::char5e/int "read" ::char5e/wis "meditation" ::char5e/cha "aura"}) -(defn ability-icon [k size theme] +;; REVIEW: use generic function for all icons instead? +(defn ability-icon + "Takes [k size theme] to generate css class name based on the size and theme. + `k` is the icon name/key in image set, + `size` sets both h and w, + `theme` sets light/dark color and opacity. + Only used for `ability-icons` -- see body of function below." + [k size theme] (let [light-theme? (= "light-theme" theme)] [:img {:class-name (str "h-" size " w-" size (if light-theme? " opacity-7")) :src (str (if light-theme? "/image/black/" "/image/") (ability-icons k) ".svg")}])) From c86e07c66d0fc71b37da27950105500c298eb7b7 Mon Sep 17 00:00:00 2001 From: codeGlaze Date: Mon, 11 Mar 2024 20:27:33 -0400 Subject: [PATCH 2/2] Fixes 548 - value not setting on load * Added dispatch to set default value * Changed range from 1:5 to 0:5 --- src/cljs/orcpub/dnd/e5/views.cljs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cljs/orcpub/dnd/e5/views.cljs b/src/cljs/orcpub/dnd/e5/views.cljs index 97002e815..a413ca5ed 100644 --- a/src/cljs/orcpub/dnd/e5/views.cljs +++ b/src/cljs/orcpub/dnd/e5/views.cljs @@ -4258,24 +4258,25 @@ option set-path-prop-event toggle-path-prop-event] + (dispatch [set-path-prop-event [:profs proficiency-choice-key :choose] (get-in option [:profs proficiency-choice-key :choose] 0)]) ;; set the default value [:div.m-b-20 - [:div.f-s-24.f-w-b.m-b-20 title] - [:div.m-b-10 + [:div.f-s-24.f-w-b.m-b-20 title] + [:div.m-b-10 [labeled-dropdown - "Choose" - {:items (map + "Choose" + {:items (map value-to-item - (range 1 6)) + (range 0 6)) :value (get-in option [:profs proficiency-choice-key :choose] 1) :on-change #(dispatch [set-path-prop-event [:profs proficiency-choice-key :choose] (js/parseInt %)])}]] - [:div.f-s-18.f-w-b.m-b-20 "Options"] - [:div.flex.flex-wrap + [:div.f-s-18.f-w-b.m-b-20 "Options"] + [:div.flex.flex-wrap (doall - (map + (map (fn [{:keys [name key]}] ^{:key key} [:span.m-r-20.m-b-10 - [comps/labeled-checkbox + [comps/labeled-checkbox name (get-in option [:profs proficiency-choice-key :options key]) false