Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #548 - fix subclass prof dropdowns #606

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/public/image/black/rod-of-asclepius.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/public/image/rod-of-asclepius.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions src/cljc/orcpub/dnd/e5/template.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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")}]))
Expand Down
19 changes: 10 additions & 9 deletions src/cljs/orcpub/dnd/e5/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading