|
7 | 7 | [clojure.string :as str] |
8 | 8 | [lobjur.state :as state] |
9 | 9 | [lobjur.widgets.comments :as comments] |
10 | | - [lobjur.widgets.stories-list-view :as stories-list-view :refer [home-stories]] |
| 10 | + [lobjur.widgets.stories-list-view :refer [home-stories stories-list-view]] |
11 | 11 | [lobjur.widgets.user :as user] |
12 | 12 | [lobjur.widgets.window :refer [window-content]] |
13 | 13 | [lobster.core :as lobster] |
|
25 | 25 | (-> s |
26 | 26 | (assoc :prev-state s) |
27 | 27 | (assoc :curr-view v)))) |
| 28 | +(defn push-titled-view [s view title] |
| 29 | + (-> s |
| 30 | + (push-view view) |
| 31 | + (assoc :header-start back-btn) |
| 32 | + (assoc :title-widget [Gtk/Label :label title]))) |
28 | 33 | (defn app-transducer [f] |
29 | 34 | (fn |
30 | 35 | ([s] s) |
|
37 | 42 | [Gtk/StackSwitcher |
38 | 43 | :stack (:home-stories @state/global-widgets)])) |
39 | 44 | :push-user |
40 | | - (-> state |
41 | | - (push-view (user/user-view payload)) |
42 | | - (assoc :header-start back-btn) |
43 | | - (assoc :title-widget [Gtk/Label :label payload])) |
| 45 | + (push-titled-view state (user/user-view payload) payload) |
44 | 46 | :push-user-stories |
45 | | - (-> state |
46 | | - (push-view |
47 | | - (stories-list-view/stories-list-view (partial lobster/user-stories-newest payload))) |
48 | | - (assoc :header-start back-btn) |
49 | | - (assoc :title-widget [Gtk/Label :label payload])) |
| 47 | + (push-titled-view state |
| 48 | + (stories-list-view (partial lobster/user-stories-newest payload)) |
| 49 | + payload) |
| 50 | + :push-domain-stories |
| 51 | + (push-titled-view state |
| 52 | + (stories-list-view (partial lobster/domain-stories payload)) |
| 53 | + payload) |
50 | 54 | :push-story |
51 | | - (-> state |
52 | | - (push-view (comments/comments-view payload)) |
53 | | - (assoc :title-widget [Gtk/Label :label "Comments"]) |
54 | | - (assoc :header-start back-btn)) |
| 55 | + (push-titled-view state (comments/comments-view payload) "Comments") |
55 | 56 | :push-tagged-stories |
56 | | - (-> state |
57 | | - (push-view (stories-list-view/stories-list-view (partial lobster/tagged payload))) |
58 | | - (assoc :title-widget [Gtk/Label :label payload]) |
59 | | - (assoc :header-start back-btn)) |
| 57 | + (push-titled-view state |
| 58 | + (stories-list-view (partial lobster/tagged payload)) |
| 59 | + payload) |
60 | 60 | :pop-main-stack |
61 | 61 | (do |
62 | 62 | (doto ^js (:main-stack @state/global-widgets) |
|
0 commit comments