improve(api): expose more values for user configures

pull/6440/head
charlie 2022-08-22 10:18:51 +08:00 committed by Tienson Qin
parent 8125371c7a
commit 5815f37df1
3 changed files with 15 additions and 3 deletions

View File

@ -140,6 +140,8 @@ export interface AppUserConfigs {
currentGraph: string
showBracket: boolean
enabledFlashcards: boolean
enabledJournals: boolean
[key: string]: any
}

View File

@ -369,9 +369,11 @@
(get (sub-config) (get-current-repo))))))
(defn enable-journals?
[repo]
([]
(enable-journals? (get-current-repo)))
([repo]
(not (false? (:feature/enable-journals?
(get (sub-config) repo)))))
(get (sub-config) repo))))))
(defn enable-flashcards?
([]

View File

@ -102,8 +102,16 @@
:preferred-start-of-week (state/get-start-of-week)
:current-graph (state/get-current-repo)
:show-brackets (state/show-brackets?)
:enabled-journals (state/enable-journals?)
:enabled-flashcards (state/enable-flashcards?)
:me (state/get-me)}))))
(def ^:export get_current_graph_configs
(fn []
(some-> (get (:config @state/state) (state/get-current-repo))
(normalize-keyword-for-json)
(bean/->js))))
(def ^:export get_current_graph
(fn []
(when-let [repo (state/get-current-repo)]