... | ... |
@@ -18,12 +18,6 @@ |
18 | 18 |
:on-change update-cmdline |
19 | 19 |
:type "text"}]])) |
20 | 20 |
|
21 |
-(defn history [] |
|
22 |
- (let [history (re-frame/subscribe [::subs/cmd-history])] |
|
23 |
- (into |
|
24 |
- [:ul {:class (styles/history-style)}] |
|
25 |
- (map #(vector :li %) @history)))) |
|
26 |
- |
|
27 | 21 |
(defn title [] |
28 | 22 |
(let [name (re-frame/subscribe [::subs/name])] |
29 | 23 |
[:h1 "Welcome to " @name])) |
... | ... |
@@ -39,7 +33,9 @@ |
39 | 33 |
"th")] |
40 | 34 |
(str n suffix))) |
41 | 35 |
|
42 |
-(def join-lines (partial string/join \newline)) |
|
36 |
+(defn- join-lines |
|
37 |
+ [coll] |
|
38 |
+ (string/join \newline coll)) |
|
43 | 39 |
|
44 | 40 |
(defn- comma-separated |
45 | 41 |
[coll] |
... | ... |
@@ -49,33 +45,41 @@ |
49 | 45 |
[s] |
50 | 46 |
(when s (str "(" s ")"))) |
51 | 47 |
|
52 |
-(defn spell-panel [spell-id] |
|
53 |
- (let [spell (re-frame/subscribe [::subs/spell spell-id])] |
|
48 |
+(defn spell-panel [spell] |
|
54 | 49 |
[:article {:class (styles/spell-panel)} |
55 |
- [:h1 (:name @spell)] |
|
50 |
+ [:h1 (:name spell)] |
|
56 | 51 |
[:div |
57 | 52 |
[:span.level |
58 |
- (-> @spell :level ordinal) |
|
53 |
+ (-> spell :level ordinal) |
|
59 | 54 |
" level"] |
60 | 55 |
[:span.school |
61 | 56 |
"school of " |
62 |
- (-> @spell (get-in [:school :name]))]] |
|
57 |
+ (-> spell (get-in [:school :name]))]] |
|
63 | 58 |
[:ul {:class (styles/property-list)} |
64 | 59 |
; Refactor these so that we get the "name" from the keyword by replacing |
65 | 60 |
; '-' and '_' and capitalizing |
66 | 61 |
[:li [:span "Casting Time"] |
67 |
- [:span (-> @spell :casting_time)]] |
|
62 |
+ [:span (-> spell :casting_time)]] |
|
68 | 63 |
[:li [:span "Range"] |
69 |
- [:span (-> @spell :range)]] |
|
64 |
+ [:span (-> spell :range)]] |
|
70 | 65 |
[:li [:span "Components"] |
71 |
- [:span (comma-separated (-> @spell :components))] |
|
72 |
- [:span (parenthesize (-> @spell :material))]] |
|
66 |
+ [:span (comma-separated (-> spell :components))] |
|
67 |
+ [:span (parenthesize (-> spell :material))]] |
|
73 | 68 |
[:li [:span "Duration"] |
74 |
- [:span (-> @spell :duration)]]] |
|
75 |
- [:section.description (-> @spell :desc join-lines)] |
|
69 |
+ [:span (-> spell :duration)]]] |
|
70 |
+ [:section.description (-> spell :desc join-lines)] |
|
76 | 71 |
[:section.higher-level |
77 | 72 |
[:span "At higher levels"] |
78 |
- [:span (-> @spell :higher_level join-lines)]]])) |
|
73 |
+ [:span (-> spell :higher_level join-lines)]]]) |
|
74 |
+ |
|
75 |
+(defn history [] |
|
76 |
+ (let [history (re-frame/subscribe [::subs/cmd-history])] |
|
77 |
+ (into |
|
78 |
+ [:ul {:class (styles/history-style)}] |
|
79 |
+ (map #(vector :li |
|
80 |
+ [:div.input (:input %)] |
|
81 |
+ [:div.output (-> % :output spell-panel)]) |
|
82 |
+ @history)))) |
|
79 | 83 |
|
80 | 84 |
(defn main-panel [] |
81 | 85 |
[:div {:class (styles/screen)} |