Skip to content

Commit e69f242

Browse files
committed
enhance naming
1 parent 4737b73 commit e69f242

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/renderer/components.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@
6868
[icon (if active? active-icon inactive-icon)]])
6969

7070
(defn toggle-collapsed-button
71-
[el-k collapsed?]
71+
[k collapsed?]
7272
[toggle-icon-button {:active? collapsed?
7373
:active-icon "chevron-right"
7474
:active-text "expand"
7575
:class "small"
7676
:inactive-icon "chevron-down"
7777
:inactive-text "collapse"
7878
:action #(rf/dispatch (if collapsed?
79-
[::document.e/expand-el el-k]
80-
[::document.e/collapse-el el-k]))}])
79+
[::document.e/expand-el k]
80+
[::document.e/collapse-el k]))}])
8181

8282

8383
(defn radio-icon-button

src/renderer/document/events.cljs

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
new-db-store (pop db-store)
3232
context' (-> (assoc context db-store-key new-db-store)
3333
(assoc-coeffect :db original-db))
34-
db (get-effect context :db ::not-found)]
34+
db (get-effect context :db ::not-found)]
3535
(cond-> context'
3636
(not= db ::not-found)
3737
(assoc-effect :db (assoc-in original-db [:documents (:active-document original-db)] db))))))))
@@ -45,14 +45,14 @@
4545
(rf/reg-event-db
4646
::collapse-el
4747
active-document-path
48-
(fn [db [_ el-k]]
49-
(update db :collapsed-keys conj el-k)))
48+
(fn [db [_ k]]
49+
(update db :collapsed-keys conj k)))
5050

5151
(rf/reg-event-db
5252
::expand-el
5353
active-document-path
54-
(fn [db [_ el-k]]
55-
(update db :collapsed-keys disj el-k)))
54+
(fn [db [_ k]]
55+
(update db :collapsed-keys disj k)))
5656

5757
(rf/reg-event-db
5858
::toggle-filter
@@ -257,7 +257,7 @@
257257
(rf/reg-event-db
258258
::saved
259259
(fn [db [_ document]]
260-
;; Update only the path, the title and the saved position of the document.
260+
;; Update the path, the title and the saved position of the document.
261261
;; Any other changes that could happen while saving should be preserved.
262262
(let [updates (select-keys document [:path :title :save])]
263263
(cond-> db
@@ -278,5 +278,5 @@
278278

279279
(rf/reg-event-db
280280
::set-active
281-
(fn [db [_ document-id]]
282-
(h/set-active db document-id)))
281+
(fn [db [_ k]]
282+
(h/set-active db k)))

src/renderer/document/handlers.cljs

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
[renderer.utils.vec :as vec]))
55

66
(defn close
7-
[{:keys [active-document document-tabs] :as db} key]
8-
(let [index (.indexOf document-tabs key)
9-
active-document (if (= active-document key)
7+
[{:keys [active-document document-tabs] :as db} k]
8+
(let [index (.indexOf document-tabs k)
9+
active-document (if (= active-document k)
1010
(get document-tabs (if (zero? index)
1111
(inc index)
1212
(dec index)))
1313
active-document)]
1414
(-> db
15-
(update :document-tabs #(filterv (complement #{key}) %))
15+
(update :document-tabs #(filterv (complement #{k}) %))
1616
(assoc :active-document active-document)
17-
(update :documents dissoc key))))
17+
(update :documents dissoc k))))
1818

1919
(defn expand-el
20-
[{:keys [active-document] :as db} el-k]
21-
(update-in db [:documents active-document :collapsed-keys] disj el-k))
20+
[{:keys [active-document] :as db} k]
21+
(update-in db [:documents active-document :collapsed-keys] disj k))
2222

2323
(defn add-recent
2424
[db file-path]

0 commit comments

Comments
 (0)