Browse code

Add 'spells' command and wire output into the spell list view

Joseph Weston authored on 05/12/2021 05:39:13
Showing 2 changed files
... ...
@@ -24,6 +24,7 @@
24 24
   ; TODO: Replace with the 'match' macro
25 25
   (cond
26 26
    (= "Open Game License" cmdline) (db :license)
27
+   (= "spells" cmdline) (vals spells)
27 28
    (contains? spells cmd) (spells cmd)
28 29
    (contains? equipment cmd) (equipment cmd)
29 30
    :else {:err (str "Unknown command '" cmdline "'")})))
... ...
@@ -202,6 +202,7 @@
202 202
 
203 203
 (def is-license? :license-name)
204 204
 (def is-spell? #(some-> % :url (string/starts-with? "/api/spells")))
205
+(def is-spell-list? #(some-> % first is-spell?))
205 206
 (def is-equipment? #(some-> % :url (string/starts-with? "/api/equipment")))
206 207
 (def is-weapon? #(and (is-equipment? %) (-> % :equipment_category :index (= "weapon"))))
207 208
 (def is-error? #(contains? % :err))
... ...
@@ -211,6 +212,7 @@
211 212
     [:div.output
212 213
      (cond
213 214
       (is-license? x) (license-panel x)
215
+      (is-spell-list? x) (spell-list-panel x)
214 216
       (is-spell? x) (spell-panel x)
215 217
       (is-weapon? x) (weapon-panel x)
216 218
       (is-equipment? x) (equipment-panel x)