|
21 | 21 | {} $ :background-color |#f0f0f0 |
22 | 22 | list-> |
23 | 23 | {} $ :style $ {} (:width |100%) (:height |100%) |
24 | | - map-indexed notes $ fn (idx raw) |
25 | | - let |
26 | | - note $ decode-map-as raw Note |
27 | | - [] (:id note) (comp-note note) |
| 24 | + map-indexed notes $ fn (idx note) |
| 25 | + [] (:id note) (comp-note note) |
28 | 26 | button $ {} (:inner-text "|+ Note") (:style ui/button) |
29 | 27 | :style $ {} (:position :absolute) (:left 16) (:bottom 16) |
30 | 28 | :on-click $ fn (e d!) |
31 | 29 | d! $ schema/Action :add-note 40 $ + 40 |
32 | 30 | * 24 $ count notes |
33 | 31 | :examples $ [] |
34 | | - :schema $ quote $ Fn (List Dynamic) (-> respo.schema/Component) |
| 32 | + :schema $ quote $ Fn (List Note) (-> respo.schema/Component) |
35 | 33 | 'comp-note $ %{} 'CodeEntry (:doc |) |
36 | 34 | :code $ quote $ defcomp comp-note (note) |
37 | 35 | div |
|
58 | 56 | '*notes $ %{} 'CodeEntry (:doc |) |
59 | 57 | :code $ quote $ defref *notes ([]) |
60 | 58 | :examples $ [] |
61 | | - :schema $ quote $ Ref (List Dynamic) |
| 59 | + :schema $ quote $ Ref (List Note) |
62 | 60 | 'dispatch! $ %{} 'CodeEntry (:doc |) |
63 | 61 | :code $ quote $ defn dispatch! (action) |
64 | 62 | match action |
65 | 63 | (:add-note x y) |
66 | | - reset! *notes $ conj @*notes $ {} |
67 | | - :id $ str |note- $ count @*notes |
68 | | - :x x |
69 | | - :y y |
70 | | - :text | |
| 64 | + reset! *notes $ conj @*notes $ Note :id |
| 65 | + str |note- $ count @*notes |
| 66 | + , :x x :y y :text | |
71 | 67 | (:update-note id text) |
72 | 68 | reset! *notes $ map-indexed @*notes $ fn (idx raw) |
73 | 69 | if |
74 | | - = id $ .unwrap-or (get raw :id) | |
75 | | - assoc raw :text text |
| 70 | + = id $ :id raw |
| 71 | + &struct:assoc raw :text text |
76 | 72 | , raw |
77 | 73 | , &unit |
78 | 74 | :examples $ [] |
|
108 | 104 | :require |
109 | 105 | respo.core :refer $ render-with! |
110 | 106 | respo.ffi.browser :refer $ query-selector |
111 | | - app.comp.container :refer $ comp-container |
| 107 | + app.comp.container :refer $ comp-container Note |
112 | 108 | app.schema :as schema |
113 | 109 | |./calcit.build-errors :default build-errors |
114 | 110 | 'app.schema $ %{} 'FileEntry |
|
0 commit comments