Browse code

Add license notice to all spell/item panels

Joseph Weston authored on 05/12/2021 01:25:33
Showing 2 changed files
... ...
@@ -96,12 +96,18 @@
96 96
 
97 97
 (def kind-style [:span.kind {:font-style :italic}])
98 98
 (def description-style [:section.description {:font-style :italic}])
99
+(def license-notice-style
100
+    [:section.license-notice
101
+     {:margin-top :0.2rem
102
+      :font-style :italic
103
+      :font-size :0.8rem}])
99 104
 
100 105
 (defclass spell-panel []
101 106
     {}
102 107
     title-style
103 108
     kind-style
104 109
     description-style
110
+    license-notice-style
105 111
     [:section.higher-level {:margin-top :0.5rem}
106 112
      [s/first-child {:font-weight :bold}
107 113
       (content-after ": ")]])
... ...
@@ -110,13 +116,15 @@
110 116
     {}
111 117
     title-style
112 118
     kind-style
113
-    description-style)
119
+    description-style
120
+    license-notice-style)
114 121
 
115 122
 (defclass weapon-panel []
116 123
     {}
117 124
     title-style
118 125
     kind-style
119
-    [:section.description {:font-style :italic}])
126
+    description-style
127
+    license-notice-style)
120 128
 
121 129
 (defclass license-panel []
122 130
     {}
... ...
@@ -81,6 +81,12 @@
81 81
      (into [:ol.clauses] (->> license :clauses (map #(vector :li %))))
82 82
      [:div.copyright-notice (->> license :copyright-notice (map #(vector :p %)))]])
83 83
 
84
+(defn- license-notice
85
+    [x]
86
+    (let [l (x :license-notice)]
87
+      (spaced
88
+       (x :name) "is" (l :content-kind) "subject to the" (l :license-name))))
89
+
84 90
 (defn spell-panel [spell]
85 91
       [:article {:class (styles/spell-panel)}
86 92
        [:h1 (spell :name)]
... ...
@@ -116,7 +122,9 @@
116 122
         (when at-higher-levels
117 123
            [:section.higher-level
118 124
              [:span "At higher levels"]
119
-             [:span at-higher-levels]]))])
125
+             [:span at-higher-levels]]))
126
+       (when (spell :license-notice)
127
+           [:section.license-notice (license-notice spell)])])
120 128
 
121 129
 (defn equipment-panel [item]
122 130
     [:article {:class (styles/equipment-panel)}
... ...
@@ -140,7 +148,9 @@
140 148
          (cost item)
141 149
          (some->> item :quantity (str "for ") parenthesize)))
142 150
      (when (item :desc)
143
-         [:section.description (->> item :desc (map #(vector :p %)))])])
151
+         [:section.description (->> item :desc (map #(vector :p %)))])
152
+     (when (item :license-notice)
153
+         [:section.license-notice (license-notice item)])])
144 154
 
145 155
 (defn weapon-panel [weapon]
146 156
  (let [weapon-kind (-> weapon :weapon_range string/lower-case)
... ...
@@ -166,7 +176,9 @@
166 176
      :Weight
167 177
        (-> weapon :weight pounds)
168 178
      :Cost
169
-       (cost weapon))]))
179
+       (cost weapon))
180
+    (when (weapon :license-notice)
181
+        [:section.license-notice (license-notice weapon)])]))
170 182
 
171 183
 (defn error-message
172 184
     [{e :err}]