fix: frontend lints and remove dead code

This commit is contained in:
Gabriel Horner
2024-04-22 11:10:16 -04:00
parent 1b66755876
commit 0bee9b12c0
5 changed files with 5 additions and 48 deletions

View File

@@ -84,3 +84,5 @@ frontend.worker.rtc.op-mem-layer/_sync-loop
frontend.db-worker/init
;; WIP fn, remove when it's ready
frontend.worker.rtc.asset-sync/<loop-for-assets-sync
;; Future use?
frontend.worker.rtc.hash/hash-blocks

View File

@@ -954,7 +954,7 @@
(otree/-save new-right-node txs-state conn repo date-formatter {}))))
@txs-state))
(defn- ^:large-vars/cleanup-todo delete-blocks
(defn ^:large-vars/cleanup-todo delete-blocks
"Delete blocks from the tree.
`blocks` need to be sorted by left&parent(from top to bottom)"
[repo conn date-formatter blocks delete-opts]

View File

@@ -1,6 +1,5 @@
(ns ^:no-doc frontend.handler.ui
(:require [cljs-time.core :refer [days plus weeks]]
[clojure.string :as string]
(:require [clojure.string :as string]
[dommy.core :as dom]
[electron.ipc :as ipc]
[frontend.config :as config]
@@ -238,19 +237,6 @@
@current-idx))
(on-chosen-open-link (nth matched @current-idx) false))))))
(defn- non-edit-input?
[]
(when-let [elem js/document.activeElement]
(and (util/input? elem)
(when-let [id (gobj/get elem "id")]
(not (string/starts-with? id "edit-block-"))))))
(defn- input-or-select?
[]
(when-let [elem js/document.activeElement]
(or (non-edit-input?)
(util/select? elem))))
(defn toggle-cards!
[]
(if (and (= :srs (:modal/id @state/state)) (:modal/show? @state/state))

View File

@@ -591,12 +591,6 @@
#{"INPUT" "TEXTAREA"}
(gobj/get node "tagName")))))
#?(:cljs
(defn select?
[node]
(when node
(= "SELECT" (gobj/get node "tagName")))))
#?(:cljs
(defn details-or-summary?
[node]
@@ -762,30 +756,6 @@
end (get-selection-end input)]
(safe-set-range-text! input text start end "end"))))
;; copied from re_com
#?(:cljs
(defn deref-or-value
"Takes a value or an atom
If it's a value, returns it
If it's a Reagent object that supports IDeref, returns the value inside it by derefing
"
[val-or-atom]
(if (satisfies? IDeref val-or-atom)
@val-or-atom
val-or-atom)))
;; copied from re_com
#?(:cljs
(defn now->utc
"Return a goog.date.UtcDateTime based on local date/time."
[]
(let [local-date-time (js/goog.date.DateTime.)]
(js/goog.date.UtcDateTime.
(.getYear local-date-time)
(.getMonth local-date-time)
(.getDate local-date-time)
0 0 0 0))))
(defn safe-subvec [xs start end]
(if (or (neg? start)
(> start end)

View File

@@ -1,8 +1,7 @@
(ns frontend.util-test
(:require [cljs.test :refer [deftest is testing]]
[frontend.util :as util]
[frontend.config :as config]
[frontend.modules.shortcut.data-helper :as shortcut-data-helper]))
[frontend.config :as config]))
(deftest test-find-first
(testing "find-first"