[wip] chore: use fully namespaced keys

pull/8722/head
Konstantinos Kaloutas 2023-02-28 19:47:08 +02:00
parent 2cace8894c
commit 744543426f
32 changed files with 2561 additions and 2488 deletions

View File

@ -1920,11 +1920,13 @@
(not= "nil" marker)) (not= "nil" marker))
{:class (str (string/lower-case marker))}) {:class (str (string/lower-case marker))})
(when bg-color (when bg-color
{:style {:background-color (if (some #{bg-color} ui/block-background-colors) (let [colors (map name ui/block-background-colors)
(str "var(--ls-highlight-color-" bg-color ")") built-in-color? (some #{bg-color} colors)]
bg-color) {:style {:background-color (if built-in-color?
:color (when-not (some #{bg-color} ui/block-background-colors) "white")} (str "var(--ls-highlight-color-" bg-color ")")
:class "px-1 with-bg-color"})) bg-color)
:color (when-not built-in-color? "white")}
:class "px-1 with-bg-color"})))
;; children ;; children
(let [area? (= :area (keyword (:hl-type properties))) (let [area? (= :area (keyword (:hl-type properties)))

View File

@ -42,7 +42,7 @@
[:div.input-wrap [:div.input-wrap
[:input.cp__palette-input.w-full.h-full [:input.cp__palette-input.w-full.h-full
{:type "text" {:type "text"
:placeholder (t :command-palette/prompt) :placeholder (t ::prompt)
:auto-focus true :auto-focus true
:value @input :value @input
:on-change (fn [e] (reset! input (util/evalue e)))}]] :on-change (fn [e] (reset! input (util/evalue e)))}]]

View File

@ -142,10 +142,10 @@
[:div.flex.flex-row.justify-between.flex-1.mx-2.mt-2 [:div.flex.flex-row.justify-between.flex-1.mx-2.mt-2
(for [color ui/block-background-colors] (for [color ui/block-background-colors]
[:a.shadow-sm [:a.shadow-sm
{:title (t (keyword "color" color)) {:title (t color)
:on-click (fn [_e] :on-click (fn [_e]
(editor-handler/set-block-property! block-id "background-color" color))} (editor-handler/set-block-property! block-id "background-color" (name color)))}
[:div.heading-bg {:style {:background-color (str "var(--color-" color "-500)")}}]]) [:div.heading-bg {:style {:background-color (str "var(--color-" (name color) "-500)")}}]])
[:a.shadow-sm [:a.shadow-sm
{:title (t :remove-background) {:title (t :remove-background)
:on-click (fn [_e] :on-click (fn [_e]

View File

@ -25,7 +25,7 @@
(ask-for-re-index multiple-windows?))) (ask-for-re-index multiple-windows?)))
([multiple-windows?] ([multiple-windows?]
(state/pub-event! [:graph/ask-for-re-index (atom multiple-windows?) (state/pub-event! [:graph/ask-for-re-index (atom multiple-windows?)
(ui/admonition :tip [:p (t :file-rn/re-index)])]))) (ui/admonition :tip [:p (t ::re-index)])])))
(defn- <close-modal-on-done (defn- <close-modal-on-done
"Ask users to re-index when the modal is exited" "Ask users to re-index when the modal is exited"
@ -53,23 +53,23 @@
(rum/defc legacy-warning (rum/defc legacy-warning
[repo *target-format *dir-format *solid-format] [repo *target-format *dir-format *solid-format]
[:div ;; Normal UX stage 1: show the admonition & button for users using legacy format [:div ;; Normal UX stage 1: show the admonition & button for users using legacy format
(ui/admonition :warning [:p (t :file-rn/format-deprecated)]) (ui/admonition :warning [:p (t ::format-deprecated)])
[:p (t :file-rn/instruct-1)] [:p (t ::instruct-1)]
[:p (t :file-rn/instruct-2) [:p (t ::instruct-2)
(ui/button (t :file-rn/confirm-proceed) ;; the button is for triple-lowbar only (ui/button (t ::confirm-proceed) ;; the button is for triple-lowbar only
:class "text-md p-2 mr-1" :class "text-md p-2 mr-1"
:on-click #(do (reset! *target-format :triple-lowbar) :on-click #(do (reset! *target-format :triple-lowbar)
(reset! *dir-format (state/get-filename-format repo)) ;; assure it's uptodate (reset! *dir-format (state/get-filename-format repo)) ;; assure it's uptodate
(write-filename-format! repo :triple-lowbar) (write-filename-format! repo :triple-lowbar)
(reset! *solid-format :triple-lowbar)))] (reset! *solid-format :triple-lowbar)))]
[:p (t :file-rn/instruct-3)]]) [:p (t ::instruct-3)]])
(rum/defc filename-format-select (rum/defc filename-format-select
"A dropdown menu for selecting the target filename format" "A dropdown menu for selecting the target filename format"
[*target-format disabled?] [*target-format disabled?]
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start [:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
[:label.block.text-sm.font-medium.leading-5 [:label.block.text-sm.font-medium.leading-5
(t :file-rn/select-format) (t ::select-format)
[:select.form-select.is-small {:disabled disabled? [:select.form-select.is-small {:disabled disabled?
:value (name @*target-format) :value (name @*target-format)
:on-change (fn [e] :on-change (fn [e]
@ -112,7 +112,7 @@
(when (state/developer-mode?) (when (state/developer-mode?)
[:div [:div
(filename-format-select *target-format @*switch-disabled?) (filename-format-select *target-format @*switch-disabled?)
(ui/button (t :file-rn/select-confirm-proceed) ;; the button is for persisting selected format (ui/button (t ::select-confirm-proceed) ;; the button is for persisting selected format
:disabled (not need-persist?) :disabled (not need-persist?)
:class "text-sm p-1 mr-1" :class "text-sm p-1 mr-1"
:on-click #(do (reset! *dir-format (state/get-filename-format repo)) ;; assure it's uptodate :on-click #(do (reset! *dir-format (state/get-filename-format repo)) ;; assure it's uptodate
@ -122,10 +122,10 @@
[:hr]]) [:hr]])
[:h1.title (t :settings-page/filename-format)] [:h1.title (t :settings-page/filename-format)]
[:div.rounded-md.opacity-70 [:div.rounded-md.opacity-70
[:p (t :file-rn/filename-desc-1)] [:p (t ::filename-desc-1)]
[:p (t :file-rn/filename-desc-2)] [:p (t ::filename-desc-2)]
[:p (t :file-rn/filename-desc-3)] [:p (t ::filename-desc-3)]
[:p (t :file-rn/filename-desc-4)]] [:p (t ::filename-desc-4)]]
(when (= @*solid-format :legacy) (when (= @*solid-format :legacy)
(legacy-warning repo *target-format *dir-format *solid-format)) (legacy-warning repo *target-format *dir-format *solid-format))
[:div.cp__settings-files-breaking-changed {:disabled need-persist?} [:hr] [:div.cp__settings-files-breaking-changed {:disabled need-persist?} [:hr]
@ -145,18 +145,18 @@
[:div ;; Normal UX stage 2: close stage 1 UI, show the action description as admolition [:div ;; Normal UX stage 2: close stage 1 UI, show the action description as admolition
(if (and (= @*solid-format :triple-lowbar) (if (and (= @*solid-format :triple-lowbar)
(= @*dir-format :legacy)) (= @*dir-format :legacy))
(ui/admonition :tip [:p (t :file-rn/need-action)]) (ui/admonition :tip [:p (t ::need-action)])
[:p (t :file-rn/need-action)]) [:p (t ::need-action)])
[:p [:p
(ui/button (ui/button
(str (t :file-rn/all-action) " (" (count rename-items) ")") (str (t ::all-action) " (" (count rename-items) ")")
:on-click <rename-all :on-click <rename-all
:class "text-md p-2 mr-1") :class "text-md p-2 mr-1")
(t :file-rn/or-select-actions) (t ::or-select-actions)
[:a {:on-click <close-modal-on-done} [:a {:on-click <close-modal-on-done}
(t :file-rn/close-panel)] (t ::close-panel)]
(t :file-rn/or-select-actions-2)] (t ::or-select-actions-2)]
[:p (t :file-rn/legend)] [:p (t ::legend "🟢" "🟡" "🔴")]
[:table.table-auto [:table.table-auto
[:tbody [:tbody
(for [{:keys [page file status target old-title changed-title]} rename-items] (for [{:keys [page file status target old-title changed-title]} rename-items]
@ -166,15 +166,15 @@
rm-item-fn #(swap! *pages dissoc path) rm-item-fn #(swap! *pages dissoc path)
rename-fn #(page-handler/rename-file! file target rm-item-fn) rename-fn #(page-handler/rename-file! file target rm-item-fn)
rename-but [:a {:on-click rename-fn rename-but [:a {:on-click rename-fn
:title (t :file-rn/apply-rename)} :title (t ::apply-rename)}
[:span (t :file-rn/rename src-file-name tgt-file-name)]]] [:span (t ::rename src-file-name tgt-file-name)]]]
[:tr {:key (:block/name page)} [:tr {:key (:block/name page)}
[:td [:div [:p "📄 " old-title]] [:td [:div [:p "📄 " old-title]]
(case status (case status
:breaking ;; if properety title override the title, it't not breaking change :breaking ;; if properety title override the title, it't not breaking change
[:div [:p "🟡 " (t :file-rn/suggest-rename) rename-but] [:div [:p "🟡 " (t ::suggest-rename) rename-but]
[:p (t :file-rn/otherwise-breaking) " \"" changed-title \"]] [:p (t ::otherwise-breaking) " \"" changed-title \"]]
:unreachable :unreachable
[:div [:p "🔴 " (t :file-rn/unreachable-title changed-title)]] [:div [:p "🔴 " (t ::unreachable-title changed-title)]]
[:div [:p "🟢 " (t :file-rn/optional-rename) rename-but]])]]))]]] [:div [:p "🟢 " (t ::optional-rename) rename-but]])]]))]]]
[:div "🎉 " (t :file-rn/no-action)]))]])) [:div "🎉 " (t ::no-action)]))]]))

View File

@ -185,7 +185,7 @@
result result
{:on-chosen chosen-handler {:on-chosen chosen-handler
:on-enter non-exist-block-handler :on-enter non-exist-block-handler
:empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (t :editor/block-search)] :empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (t ::block-search)]
:item-render (fn [{:block/keys [page uuid]}] ;; content returned from search engine is normalized :item-render (fn [{:block/keys [page uuid]}] ;; content returned from search engine is normalized
(let [page (or (:block/original-name page) (let [page (or (:block/original-name page)
(:block/name page)) (:block/name page))

View File

@ -34,9 +34,9 @@
[:table.table-auto [:table.table-auto
[:thead [:thead
[:tr [:tr
[:th (t :file/name)] [:th (t ::name)]
(when-not mobile? (when-not mobile?
[:th (t :file/last-modified-at)]) [:th (t ::last-modified-at)])
(when-not mobile? (when-not mobile?
[:th ""])]] [:th ""])]]
[:tbody [:tbody
@ -52,7 +52,7 @@
(when-not mobile? (when-not mobile?
[:td [:span.text-gray-500.text-sm [:td [:span.text-gray-500.text-sm
(if (zero? modified-at) (if (zero? modified-at)
(t :file/no-data) (t ::no-data)
(date/get-date-time-string (date/get-date-time-string
(t/to-default-time-zone (tc/to-date-time modified-at))))]]) (t/to-default-time-zone (tc/to-date-time modified-at))))]])
@ -105,7 +105,7 @@
[:h1.title [:h1.title
[:bdi (js/decodeURI path)]] [:bdi (js/decodeURI path)]]
(when original-name (when original-name
[:div.text-sm.mb-4.ml-1 "Page: " [:div.text-sm.mb-4.ml-1 (t ::page)
[:a.bg-base-2.p-1.ml-1 {:style {:border-radius 4} [:a.bg-base-2.p-1.ml-1 {:style {:border-radius 4}
:href (rfe/href :page {:name original-name}) :href (rfe/href :page {:name original-name})
:on-click (fn [e] :on-click (fn [e]
@ -122,7 +122,7 @@
[:p.text-sm.ml-1.mb-4 [:p.text-sm.ml-1.mb-4
(svg/warning {:style {:width "1em" (svg/warning {:style {:width "1em"
:display "inline-block"}}) :display "inline-block"}})
[:span.ml-1 "Please don't remove the page's title property (you can still modify it)."]]) [:span.ml-1 (t ::title-property-warning)]])
(cond (cond
;; image type ;; image type
@ -144,10 +144,10 @@
;; wait for content load ;; wait for content load
(and format (and format
(contains? (gp-config/text-formats) format)) (contains? (gp-config/text-formats) format))
(ui/loading "Loading ...") (ui/loading)
:else :else
[:div (t :file/format-not-supported (name format))])])) [:div (t ::format-not-supported (name format))])]))
(rum/defcs file (rum/defcs file
[state] [state]

View File

@ -165,10 +165,10 @@
(when downloaded (when downloaded
[:div.cp__header-tips [:div.cp__header-tips
[:p (t :updater/new-version-install) [:p (t ::updater-new-version-install)
[:a.restart.ml-2 [:a.restart.ml-2
{:on-click #(handler/quit-and-install-new-version!)} {:on-click #(handler/quit-and-install-new-version!)}
(svg/reload 16) [:strong (t :updater/quit-and-install)]]]]))) (svg/reload 16) [:strong (t ::updater-quit-and-install)]]]])))
(rum/defc ^:large-vars/cleanup-todo header < rum/reactive (rum/defc ^:large-vars/cleanup-todo header < rum/reactive
[{:keys [open-fn current-repo default-home new-block-mode]}] [{:keys [open-fn current-repo default-home new-block-mode]}]
@ -253,7 +253,7 @@
(ui/icon "folder-plus") (ui/icon "folder-plus")
(when-not config/mobile? (when-not config/mobile?
[:span.ml-1 {:style {:margin-top (if electron-mac? 0 2)}} [:span.ml-1 {:style {:margin-top (if electron-mac? 0 2)}}
(t :on-boarding/add-graph)])]) (t ::add-graph)])])
(when config/publishing? (when config/publishing?
[:a.text-sm.font-medium.button {:href (rfe/href :graph)} [:a.text-sm.font-medium.button {:href (rfe/href :graph)}

View File

@ -13,36 +13,36 @@
[] []
[:div.help.cp__sidebar-help-docs [:div.help.cp__sidebar-help-docs
(let [discourse-with-icon [:div.flex-row.inline-flex.items-center (let [discourse-with-icon [:div.flex-row.inline-flex.items-center
[:span.mr-1 (t :help/forum-community)] [:span.mr-1 (t ::forum-community)]
(ui/icon "message-circle" {:style {:font-size 20}})] (ui/icon "message-circle" {:style {:font-size 20}})]
list list
[{:title "Usage" [{:title (t ::usage-heading)
:children [[[:a :children [[[:a
{:on-click (fn [] (state/sidebar-add-block! (state/get-current-repo) "shortcut-settings" :shortcut-settings))} {:on-click (fn [] (state/sidebar-add-block! (state/get-current-repo) "shortcut-settings" :shortcut-settings))}
[:div.flex-row.inline-flex.items-center [:div.flex-row.inline-flex.items-center
[:span.mr-1 (t :help/shortcuts)] [:span.mr-1 (t ::shortcuts)]
(ui/icon "command" {:style {:font-size 20}})]]] (ui/icon "command" {:style {:font-size 20}})]]]
[(t :help/docs) "https://docs.logseq.com/"] [(t ::docs) "https://docs.logseq.com/"]
[(t :help/start) "https://docs.logseq.com/#/page/tutorial"] [(t ::start) "https://docs.logseq.com/#/page/tutorial"]
["FAQ" "https://docs.logseq.com/#/page/faq"]]} ["FAQ" "https://docs.logseq.com/#/page/faq"]]}
{:title "Community" {:title (t ::community-heading)
:children [[(t :help/awesome-logseq) "https://github.com/logseq/awesome-logseq"] :children [[(t ::awesome-logseq) "https://github.com/logseq/awesome-logseq"]
[(t :help/blog) "https://blog.logseq.com"] [(t ::blog) "https://blog.logseq.com"]
[discourse-with-icon "https://discuss.logseq.com"]]} [discourse-with-icon "https://discuss.logseq.com"]]}
{:title "Development" {:title (t ::development-heading)
:children [[(t :help/roadmap) "https://trello.com/b/8txSM12G/roadmap"] :children [[(t ::roadmap) "https://trello.com/b/8txSM12G/roadmap"]
[(t :help/bug) "https://github.com/logseq/logseq/issues/new?labels=from:in-app&template=bug_report.yaml"] [(t ::bug) "https://github.com/logseq/logseq/issues/new?labels=from:in-app&template=bug_report.yaml"]
[(t :help/feature) "https://discuss.logseq.com/c/feature-requests/"] [(t ::feature) "https://discuss.logseq.com/c/feature-requests/"]
[(t :help/changelog) "https://docs.logseq.com/#/page/changelog"]]} [(t ::changelog) "https://docs.logseq.com/#/page/changelog"]]}
{:title "About" {:title (t ::about-heading)
:children [[(t :help/about) "https://blog.logseq.com/about/"]]} :children [[(t ::about) "https://blog.logseq.com/about/"]]}
{:title "Terms" {:title (t ::terms-heading)
:children [[(t :help/privacy) "https://blog.logseq.com/privacy-policy/"] :children [[(t ::privacy) "https://blog.logseq.com/privacy-policy/"]
[(t :help/terms) "https://blog.logseq.com/terms/"]]}]] [(t ::terms) "https://blog.logseq.com/terms/"]]}]]

View File

@ -155,8 +155,8 @@
(defn- create-steps-whiteboard! [^js jsTour] (defn- create-steps-whiteboard! [^js jsTour]
[;; step 1 [;; step 1
{:id "whiteboard-home" {:id "whiteboard-home"
:text (h/render-html [:section [:h2 (t :on-boarding/tour-whiteboard-home "🖼")] :text (h/render-html [:section [:h2 (t ::whiteboard-home "🖼")]
[:p (t :on-boarding/tour-whiteboard-home-description)]]) [:p (t ::whiteboard-home-description)]])
:attachTo {:element ".nav-header .whiteboard" :on "right"} :attachTo {:element ".nav-header .whiteboard" :on "right"}
:beforeShowPromise (fn [] :beforeShowPromise (fn []
(when-not (state/sub :ui/left-sidebar-open?) (when-not (state/sub :ui/left-sidebar-open?)
@ -172,8 +172,8 @@
;; step 2 ;; step 2
{:id "whiteboard-new" {:id "whiteboard-new"
:text (h/render-html [:section [:h2 (t :on-boarding/tour-whiteboard-new "🆕️")] :text (h/render-html [:section [:h2 (t ::whiteboard-new "🆕️")]
[:p (t :on-boarding/tour-whiteboard-new-description)]]) [:p (t ::whiteboard-new-description)]])
:beforeShowPromise (fn [] :beforeShowPromise (fn []
(route-handler/redirect-to-whiteboard-dashboard!) (route-handler/redirect-to-whiteboard-dashboard!)
(wait-target ".dashboard-create-card" 500)) (wait-target ".dashboard-create-card" 500))

View File

@ -186,7 +186,7 @@
(for [query queries] (for [query queries]
(rum/with-key (rum/with-key
(ui/catch-error (ui/catch-error
(ui/component-error "Failed default query:" {:content (pr-str query)}) (ui/component-error (t ::failed-default-query) {:content (pr-str query)})
(component-block/custom-query {:attr {:class "mt-10"} (component-block/custom-query {:attr {:class "mt-10"}
:editor-box editor/box :editor-box editor/box
:page page} query)) :page page} query))
@ -199,7 +199,7 @@
[:div.references.page-tags.mt-6.flex-1.flex-row [:div.references.page-tags.mt-6.flex-1.flex-row
[:div.content [:div.content
(ui/foldable (ui/foldable
[:h2.font-bold.opacity-50 (util/format "Pages tagged with \"%s\"" tag)] [:h2.font-bold.opacity-50 (t ::tagged-with tag)]
[:ul.mt-2 [:ul.mt-2
(for [[original-name name] (sort-by last pages)] (for [[original-name name] (sort-by last pages)]
[:li {:key (str "tagged-page-" name)} [:li {:key (str "tagged-page-" name)}
@ -218,8 +218,8 @@
(let [new-page-name (string/trim @*title-value)] (let [new-page-name (string/trim @*title-value)]
(ui/make-confirm-modal (ui/make-confirm-modal
{:title (if (collide?) {:title (if (collide?)
(str "Page “" @*title-value "” already exists, merge to it?") (t ::mege-existsing-page @*title-value)
(str "Do you really want to change the page name to “" new-page-name "”?")) (t ::merge-confirmation new-page-name))
:on-confirm (fn [_e {:keys [close-fn]}] :on-confirm (fn [_e {:keys [close-fn]}]
(close-fn) (close-fn)
(page-handler/rename! (or title page-name) @*title-value) (page-handler/rename! (or title page-name) @*title-value)
@ -233,7 +233,7 @@
(reset! *title-value old-name) (reset! *title-value old-name)
(gobj/set (rum/deref input-ref) "value" old-name) (gobj/set (rum/deref input-ref) "value" old-name)
(reset! *edit? false) (reset! *edit? false)
(when-not untitled? (notification/show! "Illegal page name, can not rename!" :warning))) (when-not untitled? (notification/show! (t ::illigal-page-name) :warning)))
blur-fn (fn [e] blur-fn (fn [e]
(when (gp-util/wrapped-by-quotes? @*title-value) (when (gp-util/wrapped-by-quotes? @*title-value)
(swap! *title-value gp-util/unquote-string) (swap! *title-value gp-util/unquote-string)
@ -246,10 +246,10 @@
(rollback-fn) (rollback-fn)
(and (collide?) whiteboard-page?) (and (collide?) whiteboard-page?)
(notification/show! (str "Page “" @*title-value "” already exists!") :error) (notification/show! (t ::page-already-exists @*title-value) :error)
(and (date/valid-journal-title? @*title-value) whiteboard-page?) (and (date/valid-journal-title? @*title-value) whiteboard-page?)
(notification/show! (str "Whiteboard page cannot be renamed with journal titles!") :error) (notification/show! (t ::whiteboard-to-journal-title-error) :error)
untitled? untitled?
(page-handler/rename! (or title page-name) @*title-value) (page-handler/rename! (or title page-name) @*title-value)
@ -537,7 +537,7 @@
[:div.shadow-xl.rounded-sm [:div.shadow-xl.rounded-sm
[:ul [:ul
(graph-filter-section (graph-filter-section
[:span.font-medium "Nodes"] [:span.font-medium (t ::graph-nodes)]
(fn [open?] (fn [open?]
(filter-expand-area (filter-expand-area
open? open?
@ -575,7 +575,7 @@
(set-setting! :journal? value))) (set-setting! :journal? value)))
true)]] true)]]
[:div.flex.items-center.justify-between.mb-2 [:div.flex.items-center.justify-between.mb-2
[:span "Orphan pages"] [:span (t ::graph-filter-orphan-pages)]
[:div.mt-1 [:div.mt-1
(ui/toggle orphan-pages? (ui/toggle orphan-pages?
(fn [] (fn []
@ -584,7 +584,7 @@
(set-setting! :orphan-pages? value))) (set-setting! :orphan-pages? value)))
true)]] true)]]
[:div.flex.items-center.justify-between.mb-2 [:div.flex.items-center.justify-between.mb-2
[:span "Built-in pages"] [:span (t ::graph-filter-built-in-pages)]
[:div.mt-1 [:div.mt-1
(ui/toggle builtin-pages? (ui/toggle builtin-pages?
(fn [] (fn []
@ -593,7 +593,7 @@
(set-setting! :builtin-pages? value))) (set-setting! :builtin-pages? value)))
true)]] true)]]
[:div.flex.items-center.justify-between.mb-2 [:div.flex.items-center.justify-between.mb-2
[:span "Excluded pages"] [:span (t ::graph-filter-excluded-pages)]
[:div.mt-1 [:div.mt-1
(ui/toggle excluded-pages? (ui/toggle excluded-pages?
(fn [] (fn []
@ -616,10 +616,10 @@
(reset! *focus-nodes []) (reset! *focus-nodes [])
(reset! *n-hops nil) (reset! *n-hops nil)
(state/clear-search-filters!))} (state/clear-search-filters!))}
"Reset Graph"]]])) (t ::graph-reset)]]]))
{}) {})
(graph-filter-section (graph-filter-section
[:span.font-medium "Search"] [:span.font-medium (t ::graph-search)]
(fn [open?] (fn [open?]
(filter-expand-area (filter-expand-area
open? open?
@ -633,9 +633,9 @@
svg/close]]) svg/close]])
[:a.opacity-70.opacity-100 {:on-click state/clear-search-filters!} [:a.opacity-70.opacity-100 {:on-click state/clear-search-filters!}
"Clear All"]] (t ::graph-filter-clear-all)]]
[:a.opacity-70.opacity-100 {:on-click #(route-handler/go-to-search! :graph)} [:a.opacity-70.opacity-100 {:on-click #(route-handler/go-to-search! :graph)}
"Click to search"])])) (t ::graph-click-to-search)])]))
{:search-filters search-graph-filters})]]]])) {:search-filters search-graph-filters})]]]]))
(defonce last-node-position (atom nil)) (defonce last-node-position (atom nil))
@ -715,7 +715,7 @@
(let [ show-journals-in-page-graph? (rum/react *show-journals-in-page-graph?) ] (let [ show-journals-in-page-graph? (rum/react *show-journals-in-page-graph?) ]
[:div.sidebar-item.flex-col [:div.sidebar-item.flex-col
[:div.flex.items-center.justify-between.mb-0 [:div.flex.items-center.justify-between.mb-0
[:span (t :right-side-bar/show-journals)] [:span (t ::show-journals)]
[:div.mt-1 [:div.mt-1
(ui/toggle show-journals-in-page-graph? ;my-val; (ui/toggle show-journals-in-page-graph? ;my-val;
(fn [] (fn []
@ -798,17 +798,17 @@
[:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left [:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left
[:h3#modal-headline.text-lg.leading-6.font-medium [:h3#modal-headline.text-lg.leading-6.font-medium
(if orphaned-pages? (if orphaned-pages?
(str (t :remove-orphaned-pages) "?") (t ::remove-orphaned-pages-confirmation)
(t :page/delete-confirmation))]]] (t ::delete-confirmation))]]]
[:table.table-auto.cp__all_pages_table.mt-4 [:table.table-auto.cp__all_pages_table.mt-4
[:thead [:thead
[:tr.opacity-70 [:tr.opacity-70
[:th [:span "#"]] [:th [:span "#"]]
[:th [:span (t :block/name)]] [:th [:span (t ::block-name)]]
[:th [:span (t :page/backlinks)]] [:th [:span (t ::backlinks)]]
(when-not orphaned-pages? [:th [:span (t :page/created-at)]]) (when-not orphaned-pages? [:th [:span (t ::created-at)]])
(when-not orphaned-pages? [:th [:span (t :page/updated-at)]])]] (when-not orphaned-pages? [:th [:span (t ::updated-at)]])]]
[:tbody [:tbody
(for [[n {:block/keys [name created-at updated-at backlinks] :as page}] (medley/indexed pages)] (for [[n {:block/keys [name created-at updated-at backlinks] :as page}] (medley/indexed pages)]
@ -817,8 +817,8 @@
[:td.name [:a {:href (rfe/href :page {:name (:block/name page)})} [:td.name [:a {:href (rfe/href :page {:name (:block/name page)})}
(component-block/page-cp {} page)]] (component-block/page-cp {} page)]]
[:td.backlinks [:span (or backlinks "0")]] [:td.backlinks [:span (or backlinks "0")]]
(when-not orphaned-pages? [:td.created-at [:span (if created-at (date/int->local-time-2 created-at) "Unknown")]]) (when-not orphaned-pages? [:td.created-at [:span (if created-at (date/int->local-time-2 created-at) (t ::unknown-date))]])
(when-not orphaned-pages? [:td.updated-at [:span (if updated-at (date/int->local-time-2 updated-at) "Unknown")]])])]] (when-not orphaned-pages? [:td.updated-at [:span (if updated-at (date/int->local-time-2 updated-at) (t ::unknown-date))]])])]]
[:div.pt-6.flex.justify-end [:div.pt-6.flex.justify-end
@ -834,7 +834,7 @@
(close-fn) (close-fn)
(doseq [page-name (map :block/name pages)] (doseq [page-name (map :block/name pages)]
(page-handler/delete! page-name #())) (page-handler/delete! page-name #()))
(notification/show! (str (t :tips/all-done) "!") :success) (notification/show! (t ::all-done) :success)
(js/setTimeout #(refresh-fn) 200)))]])) (js/setTimeout #(refresh-fn) 200)))]]))
(rum/defc pagination (rum/defc pagination
@ -857,12 +857,12 @@
{:on-click #(on-change 1)} {:on-click #(on-change 1)}
(ui/icon "chevrons-left")] (ui/icon "chevrons-left")]
[:a.fade-link.flex.items-center {:on-click #(on-change prev-page)} [:a.fade-link.flex.items-center {:on-click #(on-change prev-page)}
(ui/icon "caret-left") (t :paginates/prev)]]) (ui/icon "caret-left") (t ::pagination-prev)]])
[:div.px-2 [:div.px-2
[:span (str current "/" total-pages)]] [:span (str current "/" total-pages)]]
(when has-next? (when has-next?
[[:a.fade-link.flex.items-center {:on-click #(on-change next-page)} [[:a.fade-link.flex.items-center {:on-click #(on-change next-page)}
(t :paginates/next) (ui/icon "caret-right")] (t ::pagination-next) (ui/icon "caret-right")]
[:a.fade-link.flex [:a.fade-link.flex
{:on-click #(on-change total-pages)} {:on-click #(on-change total-pages)}
(ui/icon "chevrons-right")]])])) (ui/icon "chevrons-right")]])]))
@ -929,7 +929,7 @@
[:div.flex-1.cp__all_pages [:div.flex-1.cp__all_pages
[:h1.title (t :all-pages)] [:h1.title (t :all-pages)]
[:div.text-sm.ml-1.opacity-70.mb-4 (t :paginates/pages total-items)] [:div.text-sm.ml-1.opacity-70.mb-4 (t ::pagination-pages total-items)]
(when current-repo (when current-repo
@ -1001,7 +1001,7 @@
[(ui/button (ui/icon "search") [(ui/button (ui/icon "search")
:on-click search-fn :on-click search-fn
:small? true) :small? true)
[:input.form-input {:placeholder (t :search/page-names) [:input.form-input {:placeholder (t ::search-page-names)
:on-key-up (fn [^js e] :on-key-up (fn [^js e]
(let [^js target (.-target e)] (let [^js target (.-target e)]
(if (string/blank? (.-value target)) (if (string/blank? (.-value target))
@ -1019,7 +1019,7 @@
[:div.r.flex.items-center.justify-between [:div.r.flex.items-center.justify-between
[:div [:div
(ui/tippy (ui/tippy
{:html [:small (str (t :page/show-whiteboards) " ?")] {:html [:small (t ::show-whiteboards)]
:arrow true} :arrow true}
[:a.button.whiteboard [:a.button.whiteboard
{:class (util/classnames [{:active (boolean @*whiteboard?)}]) {:class (util/classnames [{:active (boolean @*whiteboard?)}])
@ -1027,7 +1027,7 @@
(ui/icon "whiteboard" {:extension? true :style {:fontSize ui/icon-size}})])] (ui/icon "whiteboard" {:extension? true :style {:fontSize ui/icon-size}})])]
[:div [:div
(ui/tippy (ui/tippy
{:html [:small (str (t :page/show-journals) " ?")] {:html [:small (t ::show-journals)]
:arrow true} :arrow true}
[:a.button.journal [:a.button.journal
{:class (util/classnames [{:active (boolean @*journal?)}]) {:class (util/classnames [{:active (boolean @*journal?)}])
@ -1045,7 +1045,7 @@
[:a.button.fade-link [:a.button.fade-link
{:on-click toggle-fn} {:on-click toggle-fn}
(ui/icon "dots" {:size ui/icon-size})]) (ui/icon "dots" {:size ui/icon-size})])
[{:title (t :remove-orphaned-pages) [{:title (t ::remove-orphaned-pages)
:options {:on-click (fn [] :options {:on-click (fn []
(let [orphaned-pages (model/get-orphaned-pages {}) (let [orphaned-pages (model/get-orphaned-pages {})
orphaned-pages? (seq orphaned-pages)] orphaned-pages? (seq orphaned-pages)]
@ -1056,7 +1056,7 @@
#(do #(do
(reset! *checks nil) (reset! *checks nil)
(refresh-pages)))) (refresh-pages))))
(notification/show! "Congratulations, no orphaned pages in your graph!" :success))))} (notification/show! (t ::no-orphaned-pages) :success))))}
:icon (ui/icon "file-x")} :icon (ui/icon "file-x")}
{:title (t :all-files) {:title (t :all-files)
:options {:href (rfe/href :all-files)} :options {:href (rfe/href :all-files)}
@ -1076,11 +1076,11 @@
(swap! *checks assoc idx (or indeterminate? (not all?)))))) (swap! *checks assoc idx (or indeterminate? (not all?))))))
:indeterminate (when (= -1 @*indeterminate) "indeterminate")})] :indeterminate (when (= -1 @*indeterminate) "indeterminate")})]
[:th.icon ""] [:th.icon ""]
(sortable-title (t :block/name) :block/name *sort-by-item *desc?) (sortable-title (t ::block-name) :block/name *sort-by-item *desc?)
(when-not mobile? (when-not mobile?
[(sortable-title (t :page/backlinks) :block/backlinks *sort-by-item *desc?) [(sortable-title (t ::backlinks) :block/backlinks *sort-by-item *desc?)
(sortable-title (t :page/created-at) :block/created-at *sort-by-item *desc?) (sortable-title (t ::created-at) :block/created-at *sort-by-item *desc?)
(sortable-title (t :page/updated-at) :block/updated-at *sort-by-item *desc?)])]] (sortable-title (t ::updated-at) :block/updated-at *sort-by-item *desc?)])]]
[:tbody [:tbody
(for [{:block/keys [idx name created-at updated-at backlinks] :as page} @*results] (for [{:block/keys [idx name created-at updated-at backlinks] :as page} @*results]
@ -1109,10 +1109,10 @@
[[:td.backlinks [:span backlinks]] [[:td.backlinks [:span backlinks]]
[:td.created-at [:span (if created-at [:td.created-at [:span (if created-at
(date/int->local-time-2 created-at) (date/int->local-time-2 created-at)
"Unknown")]] (t ::unknown-date))]]
[:td.updated-at [:span (if updated-at [:td.updated-at [:span (if updated-at
(date/int->local-time-2 updated-at) (date/int->local-time-2 updated-at)
"Unknown")]]])]))]] (t ::unknown-date))]]])]))]]
[:div.flex.justify-end.py-4 [:div.flex.justify-end.py-4
(pagination :current @*current-page (pagination :current @*current-page

View File

@ -23,8 +23,7 @@
[page-name] [page-name]
(page-handler/delete! page-name (page-handler/delete! page-name
(fn [] (fn []
(notification/show! (str "Page " page-name " was deleted successfully!") (notification/show! (t ::page-deleted-successfully) :success)))
:success)))
(state/close-modal!) (state/close-modal!)
(route-handler/redirect-to-home!)) (route-handler/redirect-to-home!))
@ -38,7 +37,7 @@
(ui/icon "alert-triangle")]] (ui/icon "alert-triangle")]]
[:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left [:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left
[:h3#modal-headline.text-lg.leading-6.font-medium [:h3#modal-headline.text-lg.leading-6.font-medium
(t :page/delete-confirmation)]]] (t ::delete-confirmation)]]]
[:div.mt-5.sm:mt-4.sm:flex.sm:flex-row-reverse [:div.mt-5.sm:mt-4.sm:flex.sm:flex-row-reverse
[:span.flex.w-full.rounded-md.shadow-sm.sm:ml-3.sm:w-auto [:span.flex.w-full.rounded-md.shadow-sm.sm:ml-3.sm:w-auto
@ -81,8 +80,8 @@
(when (and page (not block?)) (when (and page (not block?))
(->> (->>
[{:title (if favorited? [{:title (if favorited?
(t :page/unfavorite) (t ::unfavorite)
(t :page/add-to-favorites)) (t ::add-to-favorites))
:options {:on-click :options {:on-click
(fn [] (fn []
(if favorited? (if favorited?
@ -90,7 +89,7 @@
(page-handler/favorite-page! page-original-name)))}} (page-handler/favorite-page! page-original-name)))}}
(when (or (util/electron?) file-sync-graph-uuid) (when (or (util/electron?) file-sync-graph-uuid)
{:title (t :page/version-history) {:title (t ::version-history)
:options {:on-click :options {:on-click
(fn [] (fn []
(cond (cond
@ -106,17 +105,17 @@
(when (or (util/electron?) (when (or (util/electron?)
(mobile-util/native-platform?)) (mobile-util/native-platform?))
{:title (t :page/copy-page-url) {:title (t ::copy-page-url)
:options {:on-click #(util/copy-to-clipboard! :options {:on-click #(util/copy-to-clipboard!
(url-util/get-logseq-graph-page-url nil repo page-original-name))}}) (url-util/get-logseq-graph-page-url nil repo page-original-name))}})
(when-not contents? (when-not contents?
{:title (t :page/delete) {:title (t ::delete)
:options {:on-click #(state/set-modal! (delete-page-dialog page-name))}}) :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
(when (and (not (mobile-util/native-platform?)) (when (and (not (mobile-util/native-platform?))
(state/get-current-page)) (state/get-current-page))
{:title (t :page/presentation-mode) {:title (t ::presentation-mode)
:options {:on-click (fn [] :options {:on-click (fn []
(state/sidebar-add-block! (state/sidebar-add-block!
repo repo
@ -128,9 +127,9 @@
;; this one. However this component doesn't yet exist. PRs are welcome! ;; this one. However this component doesn't yet exist. PRs are welcome!
;; Details: https://github.com/logseq/logseq/pull/3003#issuecomment-952820676 ;; Details: https://github.com/logseq/logseq/pull/3003#issuecomment-952820676
(when file-path (when file-path
[{:title (t :page/open-in-finder) [{:title (t ::open-in-finder)
:options {:on-click #(js/window.apis.showItemInFolder file-path)}} :options {:on-click #(js/window.apis.showItemInFolder file-path)}}
{:title (t :page/open-with-default-app) {:title (t ::open-with-default-app)
:options {:on-click #(js/window.apis.openPath file-path)}}]) :options {:on-click #(js/window.apis.openPath file-path)}}])
(when (state/get-current-page) (when (state/get-current-page)
@ -140,7 +139,7 @@
(export/export-blocks (:block/name page))))}}) (export/export-blocks (:block/name page))))}})
(when (util/electron?) (when (util/electron?)
{:title (t (if public? :page/make-private :page/make-public)) {:title (t (if public? :make-private ::make-public))
:options {:on-click :options {:on-click
(fn [] (fn []
(page-handler/update-public-attribute! (page-handler/update-public-attribute!
@ -150,7 +149,7 @@
(when (and (util/electron?) file-path (when (and (util/electron?) file-path
(not (file-sync-handler/synced-file-graph? repo))) (not (file-sync-handler/synced-file-graph? repo)))
{:title (t :page/open-backup-directory) {:title (t ::open-backup-directory)
:options {:on-click :options {:on-click
(fn [] (fn []
(ipc/ipc "openFileBackupDir" (config/get-local-dir repo) file-path))}}) (ipc/ipc "openFileBackupDir" (config/get-local-dir repo) file-path))}})

View File

@ -568,7 +568,7 @@
[{:title [:span.flex.items-center (ui/icon "world") (t :settings-page/network-proxy)] [{:title [:span.flex.items-center (ui/icon "world") (t :settings-page/network-proxy)]
:options {:on-click #(state/pub-event! [:go/proxy-settings agent-opts])}}] :options {:on-click #(state/pub-event! [:go/proxy-settings agent-opts])}}]
[{:title [:span.flex.items-center (ui/icon "arrow-down-circle") (t :plugin.install-from-file/menu-title)] [{:title [:span.flex.items-center (ui/icon "arrow-down-circle") (t ::install-from-file.menu-title)]
:options {:on-click plugin-config-handler/open-replace-plugins-modal}}] :options {:on-click plugin-config-handler/open-replace-plugins-modal}}]
(when (state/developer-mode?) (when (state/developer-mode?)
@ -907,10 +907,10 @@
< rum/reactive < rum/reactive
[plugins] [plugins]
[:div.cp__plugins-fom-file [:div.cp__plugins-fom-file
[:h1.mb-4.text-2xl.p-1 (t :plugin.install-from-file/title)] [:h1.mb-4.text-2xl.p-1 (t ::install-from-file.title)]
(if (seq plugins) (if (seq plugins)
[:div [:div
[:div.mb-2.text-xl (t :plugin.install-from-file/notice)] [:div.mb-2.text-xl (t ::install-from-file.notice)]
;; lists ;; lists
[:ul [:ul
(for [it (:install plugins) (for [it (:install plugins)
@ -928,7 +928,7 @@
(plugin-config-handler/replace-plugins plugins) (plugin-config-handler/replace-plugins plugins)
(state/close-sub-modal! "ls-plugins-from-file-modal")))]] (state/close-sub-modal! "ls-plugins-from-file-modal")))]]
;; all done ;; all done
[:div.py-4 [:strong.text-xl (str "\uD83C\uDF89 " (t :plugin.install-from-file/success))]])]) [:div.py-4 [:strong.text-xl (str "\uD83C\uDF89 " (t ::install-from-file.success))]])])
(defn open-select-theme! (defn open-select-theme!
[] []

View File

@ -62,23 +62,23 @@
[:div.mx-auto.flex-shrink-0.flex.items-center.justify-center.h-12.w-12.rounded-full.bg-gray-200.text-gray-500.sm:mx-0.sm:h-10.sm:w-10 [:div.mx-auto.flex-shrink-0.flex.items-center.justify-center.h-12.w-12.rounded-full.bg-gray-200.text-gray-500.sm:mx-0.sm:h-10.sm:w-10
(ui/icon "filter" {:size 20})] (ui/icon "filter" {:size 20})]
[:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left.pb-2 [:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left.pb-2
[:h3#modal-headline.text-lg.leading-6.font-medium "Filter"] [:h3#modal-headline.text-lg.leading-6.font-medium (t ::filter)]
[:span.text-xs [:span.text-xs
"Click to include and shift-click to exclude. Click again to remove."]]] (t ::filter-include-exclude)]]]
(when (seq filters) (when (seq filters)
[:div.cp__filters.mb-4.ml-2 [:div.cp__filters.mb-4.ml-2
(when (seq includes) (when (seq includes)
[:div.flex.flex-row.flex-wrap.center-items [:div.flex.flex-row.flex-wrap.center-items
[:div.mr-1.font-medium.py-1 "Includes: "] [:div.mr-1.font-medium.py-1 (t ::includes)]
(filtered-refs page-name filters filters-atom includes)]) (filtered-refs page-name filters filters-atom includes)])
(when (seq excludes) (when (seq excludes)
[:div.flex.flex-row.flex-wrap [:div.flex.flex-row.flex-wrap
[:div.mr-1.font-medium.py-1 "Excludes: " ] [:div.mr-1.font-medium.py-1 (t ::excludes)]
(filtered-refs page-name filters filters-atom excludes)])]) (filtered-refs page-name filters filters-atom excludes)])])
[:div.cp__filters-input-panel.flex [:div.cp__filters-input-panel.flex
(ui/icon "search") (ui/icon "search")
[:input.cp__filters-input.w-full [:input.cp__filters-input.w-full
{:placeholder (t :linked-references/filter-search) {:placeholder (t ::filter-search)
:auto-focus true :auto-focus true
:on-change (fn [e] :on-change (fn [e]
(reset! filter-search (util/evalue e)))}]] (reset! filter-search (util/evalue e)))}]]
@ -140,7 +140,7 @@
" Linked Reference" " Linked Reference"
(when (> total 1) "s"))] (when (> total 1) "s"))]
[:a.filter.fade-link [:a.filter.fade-link
{:title "Filter" {:title (t ::filter)
:on-mouse-over (fn [_e] :on-mouse-over (fn [_e]
(when @*collapsed? ; collapsed (when @*collapsed? ; collapsed
;; expand ;; expand
@ -282,10 +282,7 @@
[:div.content.flex-1 [:div.content.flex-1
(ui/foldable (ui/foldable
[:h2.font-medium [:h2.font-medium
(if @n-ref (t ::unlinked-references @n-ref)]
(str @n-ref " Unlinked Reference" (when (> @n-ref 1)
"s"))
"Unlinked References")]
(fn [] (unlinked-references-aux page-name n-ref)) (fn [] (unlinked-references-aux page-name n-ref))
{:default-collapsed? true {:default-collapsed? true
:title-trigger? true})]])))) :title-trigger? true})]]))))

View File

@ -70,21 +70,21 @@
[repo idx db-id block-type] [repo idx db-id block-type]
(case block-type (case block-type
:contents :contents
[(t :right-side-bar/contents) [(t ::contents)
(contents)] (contents)]
:help :help
[(t :right-side-bar/help) (onboarding/help)] [(t ::help) (onboarding/help)]
:page-graph :page-graph
[(str (t :right-side-bar/page-graph)) [(str (t ::page-graph))
(page/page-graph)] (page/page-graph)]
:block-ref :block-ref
#_:clj-kondo/ignore #_:clj-kondo/ignore
(let [lookup (if (integer? db-id) db-id [:block/uuid db-id])] (let [lookup (if (integer? db-id) db-id [:block/uuid db-id])]
(when-let [block (db/entity repo lookup)] (when-let [block (db/entity repo lookup)]
[(t :right-side-bar/block-ref) [(t ::block-ref)
(block-with-breadcrumb repo block idx [repo db-id block-type] true)])) (block-with-breadcrumb repo block idx [repo db-id block-type] true)]))
:block :block
@ -117,7 +117,7 @@
(slide/slide page-name)]]) (slide/slide page-name)]])
:shortcut-settings :shortcut-settings
[(t :help/shortcuts) (shortcut-settings)] [(t ::shortcuts) (shortcut-settings)]
["" [:span]])) ["" [:span]]))
@ -236,7 +236,7 @@
[:.resizer {:ref el-ref [:.resizer {:ref el-ref
:role "separator" :role "separator"
:aria-orientation "vertical" :aria-orientation "vertical"
:aria-label (t :right-side-bar/separator) :aria-label (t ::resize-handler)
:aria-valuemin (* min-ratio 100) :aria-valuemin (* min-ratio 100)
:aria-valuemax (* max-ratio 100) :aria-valuemax (* max-ratio 100)
:tabIndex "0" :tabIndex "0"
@ -257,7 +257,7 @@
[:div.text-sm [:div.text-sm
[:button.button.cp__right-sidebar-settings-btn {:on-click (fn [_e] [:button.button.cp__right-sidebar-settings-btn {:on-click (fn [_e]
(state/sidebar-add-block! repo "contents" :contents))} (state/sidebar-add-block! repo "contents" :contents))}
(t :right-side-bar/contents)]] (t ::contents)]]
[:div.text-sm [:div.text-sm
[:button.button.cp__right-sidebar-settings-btn {:on-click (fn [] [:button.button.cp__right-sidebar-settings-btn {:on-click (fn []
@ -266,12 +266,12 @@
repo repo
page page
:page-graph)))} :page-graph)))}
(t :right-side-bar/page-graph)]] (t ::page-graph)]]
[:div.text-sm [:div.text-sm
[:button.button.cp__right-sidebar-settings-btn {:on-click (fn [_e] [:button.button.cp__right-sidebar-settings-btn {:on-click (fn [_e]
(state/sidebar-add-block! repo "help" :help))} (state/sidebar-add-block! repo "help" :help))}
(t :right-side-bar/help)]]] (t ::help)]]]
(toggle)] (toggle)]

View File

@ -282,12 +282,12 @@
[:span.mr-2.text-sm.font-medium.mb-2 (str "Alias -> " target-original-name)])) [:span.mr-2.text-sm.font-medium.mb-2 (str "Alias -> " target-original-name)]))
(search-result-item {:name (if (model/whiteboard-page? data) "whiteboard" "page") (search-result-item {:name (if (model/whiteboard-page? data) "whiteboard" "page")
:extension? true :extension? true
:title (t (if (model/whiteboard-page? data) :search-item/whiteboard :search-item/page))} :title (t (if (model/whiteboard-page? data)::item-whiteboard ::item-page))}
(highlight-exact-query data search-q))] (highlight-exact-query data search-q))]
:file :file
(search-result-item {:name "file" (search-result-item {:name "file"
:title (t :search-item/file)} :title (t ::item-file)}
(highlight-exact-query data search-q)) (highlight-exact-query data search-q))
:block :block
@ -300,7 +300,7 @@
content' (if block (:block/content block) content)] content' (if block (:block/content block) content)]
[:span {:data-block-ref uuid} [:span {:data-block-ref uuid}
(search-result-item {:name "block" (search-result-item {:name "block"
:title (t :search-item/block) :title (t ::item-block)
:extension? true} :extension? true}
(cond (cond
@ -321,7 +321,7 @@
format (db/get-page-format page)] format (db/get-page-format page)]
[:span {:data-block-ref uuid} [:span {:data-block-ref uuid}
(search-result-item {:name "page" (search-result-item {:name "page"
:title (t :search-item/page) :title (t ::item-page)
:extension? true} :extension? true}
(if page (if page
(page-content-search-result-item repo uuid format snippet search-q search-mode) (page-content-search-result-item repo uuid format snippet search-q search-mode)
@ -389,7 +389,7 @@
(search-handler/search (state/get-current-repo) search-q {:limit 1000 (search-handler/search (state/get-current-repo) search-q {:limit 1000
:more? true}) :more? true})
(search-handler/clear-search!)))} (search-handler/clear-search!)))}
(t :more)]])])) (t ::more)]])]))
(rum/defc recent-search-and-pages (rum/defc recent-search-and-pages
[in-page-search?] [in-page-search?]
@ -573,8 +573,8 @@
search-result (state/sub :search/more-result)] search-result (state/sub :search/more-result)]
[:div#search.flex-1.flex [:div#search.flex-1.flex
[:div.inner [:div.inner
[:h1.title (t :search/result-for) [:i search-q]] [:h1.title (t ::result-for) [:i search-q]]
[:p.font-medium.tx-sm (str (count (:blocks search-result)) " " (t :search/items))] [:p.font-medium.tx-sm (str (count (:blocks search-result)) " " (t ::items))]
[:div#search-wrapper.relative.w-full.text-gray-400.focus-within:text-gray-600 [:div#search-wrapper.relative.w-full.text-gray-400.focus-within:text-gray-600
(when-not (string/blank? search-q) (when-not (string/blank? search-q)
(search-auto-complete search-result search-q true))]]])) (search-auto-complete search-result search-q true))]]]))

View File

@ -41,7 +41,7 @@
extract-fn host-opts on-input input-opts extract-fn host-opts on-input input-opts
item-cp transform-fn tap-*input-val] item-cp transform-fn tap-*input-val]
:or {limit 100 :or {limit 100
prompt-key :select/default-prompt prompt-key ::default-prompt
empty-placeholder (fn [_t] [:div]) empty-placeholder (fn [_t] [:div])
close-modal? true close-modal? true
extract-fn :value}}] extract-fn :value}}]
@ -86,7 +86,7 @@
* :empty-placeholder (optional) - fn that returns hiccup html to render if no * :empty-placeholder (optional) - fn that returns hiccup html to render if no
matched graphs found. matched graphs found.
* :prompt-key (optional) - dictionary keyword that prompts when components is * :prompt-key (optional) - dictionary keyword that prompts when components is
first open. Defaults to :select/default-prompt." first open. Defaults to ::default-prompt."
[] []
{:graph-open {:graph-open
{:items-fn (fn [] {:items-fn (fn []
@ -104,13 +104,13 @@
(db/get-repo-path url))) (db/get-repo-path url)))
:id (config/get-repo-dir url) :id (config/get-repo-dir url)
:graph url})))) :graph url}))))
:prompt-key :select.graph/prompt :prompt-key ::graph-prompt
:on-chosen #(state/pub-event! [:graph/switch (:graph %)]) :on-chosen #(state/pub-event! [:graph/switch (:graph %)])
:empty-placeholder (fn [t] :empty-placeholder (fn [t]
[:div.px-4.py-2 [:div.px-4.py-2
[:div.mb-2 (t :select.graph/empty-placeholder-description)] [:div.mb-2 (t ::graph-empty-placeholder-description)]
(ui/button (ui/button
(t :select.graph/add-graph) (t ::graph-add)
:href (rfe/href :repo-add) :href (rfe/href :repo-add)
:on-click state/close-modal!)])} :on-click state/close-modal!)])}
:graph-remove :graph-remove

View File

@ -280,7 +280,7 @@
:-for "preferred_language" :-for "preferred_language"
:action action}))) :action action})))
(defn theme-modes-row [t switch-theme system-theme? dark?] (defn theme-modes-row [t system-theme? dark?]
(let [pick-theme [:ul.theme-modes-options (let [pick-theme [:ul.theme-modes-options
[:li {:on-click (partial state/use-theme-mode! "light") [:li {:on-click (partial state/use-theme-mode! "light")
:class (classnames [{:active (and (not system-theme?) (not dark?))}])} [:i.mode-light] [:strong "light"]] :class (classnames [{:active (and (not system-theme?) (not dark?))}])} [:i.mode-light] [:strong "light"]]
@ -288,7 +288,7 @@
:class (classnames [{:active (and (not system-theme?) dark?)}])} [:i.mode-dark] [:strong "dark"]] :class (classnames [{:active (and (not system-theme?) dark?)}])} [:i.mode-dark] [:strong "dark"]]
[:li {:on-click (partial state/use-theme-mode! "system") [:li {:on-click (partial state/use-theme-mode! "system")
:class (classnames [{:active system-theme?}])} [:i.mode-system] [:strong "system"]]]] :class (classnames [{:active system-theme?}])} [:i.mode-system] [:strong "system"]]]]
(row-with-button-action {:left-label (t :right-side-bar/switch-theme (string/capitalize switch-theme)) (row-with-button-action {:left-label (t ::theme-mode)
:-for "toggle_theme" :-for "toggle_theme"
:action pick-theme :action pick-theme
:desc (ui/render-keyboard-shortcut (shortcut-helper/gen-shortcut-seq :ui/toggle-theme))}))) :desc (ui/render-keyboard-shortcut (shortcut-helper/gen-shortcut-seq :ui/toggle-theme))})))
@ -593,12 +593,11 @@
(let [preferred-language (state/sub [:preferred-language]) (let [preferred-language (state/sub [:preferred-language])
theme (state/sub :ui/theme) theme (state/sub :ui/theme)
dark? (= "dark" theme) dark? (= "dark" theme)
system-theme? (state/sub :ui/system-theme?) system-theme? (state/sub :ui/system-theme?)]
switch-theme (if dark? "light" "dark")]
[:div.panel-wrap.is-general [:div.panel-wrap.is-general
(version-row t version) (version-row t version)
(language-row t preferred-language) (language-row t preferred-language)
(theme-modes-row t switch-theme system-theme? dark?) (theme-modes-row t system-theme? dark?)
(when (config/global-config-enabled?) (edit-global-config-edn)) (when (config/global-config-enabled?) (edit-global-config-edn))
(when current-repo (edit-config-edn)) (when current-repo (edit-config-edn))
(when current-repo (edit-custom-css)) (when current-repo (edit-custom-css))

View File

@ -88,26 +88,26 @@
[:table [:table
[:thead [:thead
[:tr [:tr
[:th.text-left [:b (t :help/shortcuts-triggers)]] [:th.text-left [:b (t ::triggers)]]
[:th.text-right [:b (t :help/shortcut)]]]] [:th.text-right [:b (t ::shortcut)]]]]
[:tbody [:tbody
[:tr [:tr
[:td.text-left (t :help/slash-autocomplete)] [:td.text-left (t ::slash-autocomplete)]
[:td.text-right [:code "/"]]] [:td.text-right [:code "/"]]]
[:tr [:tr
[:td.text-left (t :help/block-content-autocomplete)] [:td.text-left (t ::block-content-autocomplete)]
[:td.text-right [:code "<"]]] [:td.text-right [:code "<"]]]
[:tr [:tr
[:td.text-left (t :help/reference-autocomplete)] [:td.text-left (t ::reference-autocomplete)]
[:td.text-right [:code page-ref/left-and-right-brackets]]] [:td.text-right [:code page-ref/left-and-right-brackets]]]
[:tr [:tr
[:td.text-left (t :help/block-reference)] [:td.text-left (t ::block-reference)]
[:td.text-right [:code block-ref/left-and-right-parens]]] [:td.text-right [:code block-ref/left-and-right-parens]]]
[:tr [:tr
[:td.text-left (t :help/open-link-in-sidebar)] [:td.text-left (t ::open-link-in-sidebar)]
[:td.text-right (ui/render-keyboard-shortcut ["shift" "click"])]] [:td.text-right (ui/render-keyboard-shortcut ["shift" "click"])]]
[:tr [:tr
[:td.text-left (t :help/context-menu)] [:td.text-left (t ::context-menu)]
[:td.text-right (ui/render-keyboard-shortcut ["right" "click"])]]]]) [:td.text-right (ui/render-keyboard-shortcut ["right" "click"])]]]])
(defn markdown-and-orgmode-syntax [] (defn markdown-and-orgmode-syntax []
@ -116,40 +116,40 @@
preferred-format (state/get-preferred-format) ; markdown/org preferred-format (state/get-preferred-format) ; markdown/org
title (case preferred-format title (case preferred-format
:markdown (t :help/markdown-syntax) :markdown (t ::markdown-syntax)
:org (t :help/org-mode-syntax)) :org (t ::org-mode-syntax))
learn-more (case preferred-format learn-more (case preferred-format
:markdown "https://www.markdownguide.org/basic-syntax" :markdown "https://www.markdownguide.org/basic-syntax"
:org "https://orgmode.org/worg/dev/org-syntax.html") :org "https://orgmode.org/worg/dev/org-syntax.html")
raw (case preferred-format raw (case preferred-format
:markdown {:bold (str "**" (t :bold) "**") :markdown {:bold (str "**" (t ::bold) "**")
:italics (str "_" (t :italics) "_") :italics (str "_" (t ::italics) "_")
:link "[Link](https://www.example.com)" :link (str "[" (t ::link) "](https://www.example.com)")
:del (str "~~" (t :strikethrough) "~~") :del (str "~~" (t ::strikethrough) "~~")
:mark (str "^^" (t :highlight) "^^") :mark (str "^^" (t ::highlight) "^^")
:latex "$$E = mc^2$$" :latex "$$E = mc^2$$"
:code (str "`" (t :code) "`") :code (str "`" (t ::code) "`")
:pre "```clojure\n (println \"Hello world!\")\n```" :pre "```clojure\n (println \"Hello world!\")\n```"
:img "![image](https://asset.logseq.com/static/img/logo.png)"} :img "![image](https://asset.logseq.com/static/img/logo.png)"}
:org {:bold (str "*" (t :bold) "*") :org {:bold (str "*" (t ::bold) "*")
:italics (str "/" (t :italics) "/") :italics (str "/" (t ::italics) "/")
:del (str "+" (t :strikethrough) "+") :del (str "+" (t ::strikethrough) "+")
:pre [:pre "#+BEGIN_SRC clojure\n (println \"Hello world!\")\n#+END_SRC"] :pre [:pre "#+BEGIN_SRC clojure\n (println \"Hello world!\")\n#+END_SRC"]
:link "[[https://www.example.com][Link]]" :link (str "[[https://www.example.com][" (t ::link) "]]")
:mark (str "^^" (t :highlight) "^^") :mark (str "^^" (t ::highlight) "^^")
:latex "$$E = mc^2$$" :latex "$$E = mc^2$$"
:code "~Code~" :code "~Code~"
:img "[[https://asset.logseq.com/static/img/logo.png][image]]"}) :img "[[https://asset.logseq.com/static/img/logo.png][image]]"})
rendered {:italics [:i (t :italics)] rendered {:italics [:i (t ::italics)]
:bold [:b (t :bold)] :bold [:b (t ::bold)]
:link [:a {:href "https://www.example.com"} "Link"] :link [:a {:href "https://www.example.com"} (t ::link)]
:del [:del (t :strikethrough)] :del [:del (t ::strikethrough)]
:mark [:mark (t :highlight)] :mark [:mark (t ::highlight)]
:latex (latex/latex "help-latex" "E = mc^2" true false) :latex (latex/latex "help-latex" "E = mc^2" true false)
:code [:code (t :code)] :code [:code (t ::code)]
:pre (highlight/highlight "help-highlight" {:data-lang "clojure"} "(println \"Hello world!\")") :pre (highlight/highlight "help-highlight" {:data-lang "clojure"} "(println \"Hello world!\")")
:img [:img {:style {:float "right" :width 32 :height 32} :img [:img {:style {:float "right" :width 32 :height 32}
:src "https://asset.logseq.com/static/img/logo.png" :src "https://asset.logseq.com/static/img/logo.png"
@ -159,7 +159,7 @@
[:thead [:thead
[:tr [:tr
[:th.text-left [:b title]] [:th.text-left [:b title]]
[:th.text-right [:a {:href learn-more} "Learn more →"]]]] [:th.text-right [:a {:href learn-more} (t ::learn-more)]]]]
[:tbody [:tbody
(map (fn [name] (map (fn [name]
[:tr [:tr
@ -171,7 +171,7 @@
[{:keys [show-title?] [{:keys [show-title?]
:or {show-title? true}}] :or {show-title? true}}]
[:div [:div
(when show-title? [:h1.title (t :help/shortcut-page-title)]) (when show-title? [:h1.title (t ::shortcut-page-title)])
(trigger-table) (trigger-table)
(markdown-and-orgmode-syntax) (markdown-and-orgmode-syntax)
(shortcut-table :shortcut.category/basics true) (shortcut-table :shortcut.category/basics true)

View File

@ -136,7 +136,7 @@
(nav-content-item (nav-content-item
[:a.flex.items-center.text-sm.font-medium.rounded-md.wrap-th [:a.flex.items-center.text-sm.font-medium.rounded-md.wrap-th
(ui/icon "star" {:size 16}) (ui/icon "star" {:size 16})
[:span.flex-1.ml-2 (string/upper-case (t :left-side-bar/nav-favorites))]] [:span.flex-1.ml-2 (string/upper-case (t ::nav-favorites))]]
{:class "favorites" {:class "favorites"
:edit-fn :edit-fn
@ -161,7 +161,7 @@
[:a.flex.items-center.text-sm.font-medium.rounded-md.wrap-th [:a.flex.items-center.text-sm.font-medium.rounded-md.wrap-th
(ui/icon "history" {:size 16}) (ui/icon "history" {:size 16})
[:span.flex-1.ml-2 [:span.flex-1.ml-2
(string/upper-case (t :left-side-bar/nav-recent-pages))]] (string/upper-case (t ::nav-recent-pages))]]
{:class "recent"} {:class "recent"}
@ -195,7 +195,7 @@
(srs/update-cards-due-count!) (srs/update-cards-due-count!)
(state/pub-event! [:modal/show-cards]))} (state/pub-event! [:modal/show-cards]))}
(ui/icon "infinity") (ui/icon "infinity")
[:span.flex-1 (t :right-side-bar/flashcards)] [:span.flex-1 (t ::flashcards)]
(when (and num (not (zero? num))) (when (and num (not (zero? num)))
[:span.ml-3.inline-block.py-0.5.px-3.text-xs.font-medium.rounded-full.fade-in num])])) [:span.ml-3.inline-block.py-0.5.px-3.text-xs.font-medium.rounded-full.fade-in num])]))
@ -240,9 +240,9 @@
{:on-click toggle-fn} {:on-click toggle-fn}
[:<> [:<>
(ui/icon "plus" {:font? "true"}) (ui/icon "plus" {:font? "true"})
[:span.mx-1 (t :left-side-bar/create)]]]) [:span.mx-1 (t ::create)]]])
(->> (->>
[{:title (t :left-side-bar/new-page) [{:title (t ::new-page)
:class "new-page-link" :class "new-page-link"
:shortcut (ui/keyboard-shortcut-from-config :go/search) :shortcut (ui/keyboard-shortcut-from-config :go/search)
:options {:on-click #(do (close-sidebar-on-mobile!) :options {:on-click #(do (close-sidebar-on-mobile!)
@ -250,7 +250,7 @@
:icon (ui/type-icon {:name "new-page" :icon (ui/type-icon {:name "new-page"
:class "highlight" :class "highlight"
:extension? true})} :extension? true})}
{:title (t :left-side-bar/new-whiteboard) {:title (t ::new-whiteboard)
:class "new-whiteboard-link" :class "new-whiteboard-link"
:shortcut (ui/keyboard-shortcut-from-config :editor/new-whiteboard) :shortcut (ui/keyboard-shortcut-from-config :editor/new-whiteboard)
:options {:on-click #(do (close-sidebar-on-mobile!) :options {:on-click #(do (close-sidebar-on-mobile!)
@ -359,7 +359,7 @@
{:class "journals-nav" {:class "journals-nav"
:active (and (not srs-open?) :active (and (not srs-open?)
(or (= route-name :all-journals) (= route-name :home))) (or (= route-name :all-journals) (= route-name :home)))
:title (t :left-side-bar/journals) :title (t ::journals)
:on-click-handler (fn [e] :on-click-handler (fn [e]
(if (gobj/get e "shiftKey") (if (gobj/get e "shiftKey")
(route-handler/sidebar-journals!) (route-handler/sidebar-journals!)
@ -369,7 +369,7 @@
(when enable-whiteboards? (when enable-whiteboards?
(sidebar-item (sidebar-item
{:class "whiteboard" {:class "whiteboard"
:title (t :right-side-bar/whiteboards) :title (t ::whiteboards)
:href (rfe/href :whiteboards) :href (rfe/href :whiteboards)
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name)) :active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
:icon "whiteboard" :icon "whiteboard"
@ -381,14 +381,14 @@
(sidebar-item (sidebar-item
{:class "graph-view-nav" {:class "graph-view-nav"
:title (t :right-side-bar/graph-view) :title (t ::graph-view)
:href (rfe/href :graph) :href (rfe/href :graph)
:active (and (not srs-open?) (= route-name :graph)) :active (and (not srs-open?) (= route-name :graph))
:icon "hierarchy"}) :icon "hierarchy"})
(sidebar-item (sidebar-item
{:class "all-pages-nav" {:class "all-pages-nav"
:title (t :right-side-bar/all-pages) :title (t ::all-pages)
:href (rfe/href :all-pages) :href (rfe/href :all-pages)
:active (and (not srs-open?) (= route-name :all-pages)) :active (and (not srs-open?) (= route-name :all-pages))
:icon "files"})]] :icon "files"})]]
@ -410,7 +410,7 @@
(state/toggle-left-sidebar!)) (state/toggle-left-sidebar!))
(state/pub-event! [:go/search]))} (state/pub-event! [:go/search]))}
(ui/icon "circle-plus" {:style {:font-size 20}}) (ui/icon "circle-plus" {:style {:font-size 20}})
[:span.flex-1 (t :right-side-bar/new-page)]]))]]] [:span.flex-1 (t ::new-page)]]))]]]
[:span.shade-mask [:span.shade-mask
(cond-> {:on-click close-fn} (cond-> {:on-click close-fn}
(number? offset-ratio) (number? offset-ratio)
@ -538,7 +538,7 @@
db-restoring? db-restoring?
[:div.mt-20 [:div.mt-20
[:div.ls-center [:div.ls-center
(ui/loading (t :loading))]] (ui/loading)]]
:else :else
[:div [:div
@ -771,7 +771,7 @@
:on-key-up (fn [e] :on-key-up (fn [e]
(when (= (.-key e) "Enter") (when (= (.-key e) "Enter")
(ui/focus-element (ui/main-node))))} (ui/focus-element (ui/main-node))))}
(t :accessibility/skip-to-main-content)] (t ::skip-to-main-content)]
[:div.#app-container [:div.#app-container
[:div#left-container [:div#left-container
{:class (if (state/sub :ui/sidebar-open?) "overflow-hidden" "w-full")} {:class (if (state/sub :ui/sidebar-open?) "overflow-hidden" "w-full")}

View File

@ -61,7 +61,7 @@
(rum/use-effect! (rum/use-effect!
#(let [db-restored? (false? db-restoring?)] #(let [db-restored? (false? db-restoring?)]
(if db-restoring? (if db-restoring?
(util/set-title! (t :loading)) (util/set-title! (t ::loading))
(when (or nfs-granted? db-restored?) (when (or nfs-granted? db-restored?)
(route-handler/update-page-title! route)))) (route-handler/update-page-title! route))))
[nfs-granted? db-restoring? route]) [nfs-granted? db-restoring? route])

View File

@ -314,16 +314,16 @@
[:div.cp__whiteboard-welcome [:div.cp__whiteboard-welcome
[:span.head-bg [:span.head-bg
[:strong (t :on-boarding/closed-feature (name (:whiteboard user-handler/feature-matrix)))]] [:strong (t ::closed-feature (name (:whiteboard user-handler/feature-matrix)))]]
[:h1.text-2xl.font-bold.flex-col.sm:flex-row [:h1.text-2xl.font-bold.flex-col.sm:flex-row
(t :on-boarding/welcome-whiteboard-modal-title)] (t ::welcome-modal-title)]
[:p (t :on-boarding/welcome-whiteboard-modal-description)] [:p (t ::welcome-modal-description)]
[:div.pt-6.flex.justify-center.space-x-2.sm:justify-end [:div.pt-6.flex.justify-center.space-x-2.sm:justify-end
(ui/button (t :on-boarding/welcome-whiteboard-modal-skip) :on-click close-fn :background "gray" :class "opacity-60") (ui/button (t ::welcome-modal-skip) :on-click close-fn :background "gray" :class "opacity-60")
(ui/button (t :on-boarding/welcome-whiteboard-modal-start) (ui/button (t ::welcome--modal-start)
:on-click (fn [] :on-click (fn []
(config-handler/set-config! :feature/enable-whiteboards? true) (config-handler/set-config! :feature/enable-whiteboards? true)
(quick-tour/ready (quick-tour/ready

View File

@ -21,7 +21,7 @@
(rum/defc add-local-directory (rum/defc add-local-directory
[] []
[:div.flex.flex-col [:div.flex.flex-col
[:h1.title (t :on-boarding/add-graph)] [:h1.title (t ::add-graph)]
(let [nfs-supported? (or (nfs/supported?) (mobile-util/native-platform?))] (let [nfs-supported? (or (nfs/supported?) (mobile-util/native-platform?))]
(if (mobile-util/native-platform?) (if (mobile-util/native-platform?)
[:div.text-sm [:div.text-sm
@ -39,13 +39,13 @@
(when nfs-supported? (when nfs-supported?
{:on-click #(page-handler/ls-dir-files! shortcut/refresh!)}) {:on-click #(page-handler/ls-dir-files! shortcut/refresh!)})
[:div [:div
[:h1.title (t :on-boarding/open-local-dir)] [:h1.title (t ::open-local-dir)]
[:p (t :on-boarding/new-graph-desc-1)] [:p (t ::new-graph-desc-1)]
[:p (t :on-boarding/new-graph-desc-2)] [:p (t ::new-graph-desc-2)]
[:ul [:ul
[:li (t :on-boarding/new-graph-desc-3)] [:li (t ::new-graph-desc-3)]
[:li (t :on-boarding/new-graph-desc-4)] [:li (t ::new-graph-desc-4)]
[:li (t :on-boarding/new-graph-desc-5)]] [:li (t ::new-graph-desc-5)]]
(when-not nfs-supported? (when-not nfs-supported?
(ui/admonition :warning (native-fs-api-alert)))]]]))]) (ui/admonition :warning (native-fs-api-alert)))]]]))])
@ -94,4 +94,4 @@
(not config/publishing?)) (not config/publishing?))
(ui/admonition (ui/admonition
:warning :warning
[:p (t :on-boarding/demo-graph)]))) [:p (t ::demo-graph)])))

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,11 @@
;; so, in order to not watch out for it every time we bump a new version we better migrate to constants as soon as they appear in a prod build. ;; so, in order to not watch out for it every time we bump a new version we better migrate to constants as soon as they appear in a prod build.
ui-theme) ui-theme)
(rum/defc toggle-mode-button
[label on? toggle-fns]
[:a.mr-2 {:on-click toggle-fns}
(t ::mode label) " ("[:span.uppercase (if on? (t ::on) (t ::off))]")" ])
(rum/defcs draw-inner < rum/reactive (rum/defcs draw-inner < rum/reactive
(rum/local 800 ::draw-width) (rum/local 800 ::draw-width)
(rum/local true ::zen-mode?) (rum/local true ::zen-mode?)
@ -83,17 +88,13 @@
(when data (when data
[:div.overflow-hidden {:on-mouse-down (fn [e] (util/stop e))} [:div.overflow-hidden {:on-mouse-down (fn [e] (util/stop e))}
[:div.my-1 {:style {:font-size 10}} [:div.my-1 {:style {:font-size 10}}
[:a.mr-2 {:on-click ui-handler/toggle-wide-mode!} (toggle-mode-button (t ::wide) wide-mode? ui-handler/toggle-wide-mode!)
(util/format "Wide Mode (%s)" (if wide-mode? "ON" "OFF"))] (toggle-mode-button (t ::zen) @*zen-mode? #(swap! *zen-mode? not))
[:a.mr-2 {:on-click #(swap! *zen-mode? not)} (toggle-mode-button (t ::view) @*view-mode? #(swap! *view-mode? not))
(util/format "Zen Mode (%s)" (if @*zen-mode? "ON" "OFF"))] (toggle-mode-button (t ::grid) @*grid-mode? #(swap! *grid-mode? not))
[:a.mr-2 {:on-click #(swap! *view-mode? not)}
(util/format "View Mode (%s)" (if @*view-mode? "ON" "OFF"))]
[:a.mr-2 {:on-click #(swap! *grid-mode? not)}
(util/format "Grid Mode (%s)" (if @*grid-mode? "ON" "OFF"))]
[:a.mr-2 {:on-click #(when-let [block (db/pull [:block/uuid block-uuid])] [:a.mr-2 {:on-click #(when-let [block (db/pull [:block/uuid block-uuid])]
(editor-handler/edit-block! block :max block-uuid))} (editor-handler/edit-block! block :max block-uuid))}
"Edit Block"]] (t ::edit-block)]]
[:div.draw-wrap [:div.draw-wrap
{:on-mouse-down (fn [e] {:on-mouse-down (fn [e]
(util/stop e) (util/stop e)
@ -148,8 +149,7 @@
(when (:file option) (when (:file option)
(cond (cond
db-restoring? db-restoring?
[:div.ls-center [:div.ls-center (ui/loading)]
(ui/loading (t :loading))]
(false? loading?) (false? loading?)
(draw-inner data option) (draw-inner data option)

View File

@ -6,8 +6,7 @@
[frontend.util :as util] [frontend.util :as util]
[frontend.handler.plugin :refer [hook-extensions-enhancer-by-type] :as plugin-handler] [frontend.handler.plugin :refer [hook-extensions-enhancer-by-type] :as plugin-handler]
[promesa.core :as p] [promesa.core :as p]
[goog.dom :as gdom] [goog.dom :as gdom]))
[frontend.context.i18n :refer [t]]))
;; TODO: extracted to a rum mixin ;; TODO: extracted to a rum mixin
(defn loaded? [] (defn loaded? []
@ -62,7 +61,7 @@
[id s block? _display?] [id s block? _display?]
(let [loading? (rum/react *loading?)] (let [loading? (rum/react *loading?)]
(if loading? (if loading?
(ui/loading (t :loading)) (ui/loading)
(let [element (if block? (let [element (if block?
:div.latex :div.latex
:span.latex-inline)] :span.latex-inline)]

View File

@ -200,11 +200,11 @@
[:a {:key it :data-color it :data-action it} it])] [:a {:key it :data-color it :data-action it} it])]
(and id [:li.item {:data-action "ref"} (t :pdf/copy-ref)]) (and id [:li.item {:data-action "ref"} (t ::copy-ref)])
(and (not area?) [:li.item {:data-action "copy"} (t :pdf/copy-text)]) (and (not area?) [:li.item {:data-action "copy"} (t ::copy-text)])
(and id [:li.item {:data-action "link"} (t :pdf/linked-ref)]) (and id [:li.item {:data-action "link"} (t ::linked-ref)])
(and id [:li.item {:data-action "del"} (t :delete)]) (and id [:li.item {:data-action "del"} (t :delete)])

View File

@ -77,21 +77,21 @@
(when (= theme it) (svg/check))]) (when (= theme it) (svg/check))])
["light", "warm", "dark"])] ["light", "warm", "dark"])]
[:div.extensions__pdf-settings-item.toggle-input [:div.extensions__pdf-settings-item.toggle-input
[:label (t :pdf/toggle-dashed)] [:label (t ::toggle-dashed)]
(ui/toggle area-dashed? #(set-area-dashed? (not area-dashed?)) true)] (ui/toggle area-dashed? #(set-area-dashed? (not area-dashed?)) true)]
[:div.extensions__pdf-settings-item.toggle-input.is-between [:div.extensions__pdf-settings-item.toggle-input.is-between
[:label (t :pdf/hl-block-colored)] [:label (t ::hl-block-colored)]
(ui/toggle hl-block-colored? #(set-hl-block-colored? (not hl-block-colored?)) true)] (ui/toggle hl-block-colored? #(set-hl-block-colored? (not hl-block-colored?)) true)]
[:div.extensions__pdf-settings-item.toggle-input [:div.extensions__pdf-settings-item.toggle-input
[:a.is-info.w-full.text-gray-500 [:a.is-info.w-full.text-gray-500
{:title (t :pdf/doc-metadata) {:title (t ::doc-metadata)
:on-click #(p/let [ret (pdf-utils/get-meta-data$ viewer)] :on-click #(p/let [ret (pdf-utils/get-meta-data$ viewer)]
(state/set-modal! (make-docinfo-in-modal ret)))} (state/set-modal! (make-docinfo-in-modal ret)))}
[:span.flex.items-center.justify-between.w-full [:span.flex.items-center.justify-between.w-full
(t :pdf/doc-metadata) (t ::doc-metadata)
(svg/icon-info)]]]]])) (svg/icon-info)]]]]]))
(rum/defc docinfo-display (rum/defc docinfo-display
@ -363,7 +363,7 @@
[:strong "Page " page]] [:strong "Page " page]]
[:button [:button
{:title (t :pdf/linked-ref) {:title (t ::linked-ref)
:on-click goto-ref!} :on-click goto-ref!}
(ui/icon "external-link")]] (ui/icon "external-link")]]

View File

@ -3123,7 +3123,7 @@
true true
:else :else
(do (notification/show! (t :file-sync/other-user-graph) :warning false) (do (notification/show! (t ::other-user-graph) :warning false)
false))) false)))
(defn <check-remote-graph-exists (defn <check-remote-graph-exists
@ -3143,7 +3143,7 @@
(#(contains? % local-graph-uuid)))))] (#(contains? % local-graph-uuid)))))]
(when-not result (when-not result
(notification/show! (t :file-sync/graph-deleted) :warning false)) (notification/show! (t ::graph-deleted) :warning false))
result))) result)))
(defn sync-off? (defn sync-off?

View File

@ -38,7 +38,7 @@
:file/path file-path}])) :file/path file-path}]))
:else :else
(let [error (t :file/validate-existing-file-error current-file file-path)] (let [error (t ::validate-existing-file-error current-file file-path)]
(state/pub-event! [:notification/show (state/pub-event! [:notification/show
{:content error {:content error
:status :error :status :error

View File

@ -346,10 +346,10 @@
(state/set-current-repo! repo) (state/set-current-repo! repo)
(db/start-db-conn! repo) (db/start-db-conn! repo)
(when-not config/publishing? (when-not config/publishing?
(let [dummy-notes (t :tutorial/dummy-notes)] (let [dummy-notes (t ::dummy-notes)]
(create-dummy-notes-page repo dummy-notes))) (create-dummy-notes-page repo dummy-notes)))
(when-not config/publishing? (when-not config/publishing?
(let [tutorial (t :tutorial/text) (let [tutorial (t ::tutorial)
tutorial (string/replace-first tutorial "$today" (date/today))] tutorial (string/replace-first tutorial "$today" (date/today))]
(create-today-journal-if-not-exists repo {:content tutorial}))) (create-today-journal-if-not-exists repo {:content tutorial})))
(repo-config-handler/create-config-file-if-not-exists repo) (repo-config-handler/create-config-file-if-not-exists repo)

View File

@ -39,38 +39,38 @@
[:div.ls-center [:div.ls-center
[:div.icon-box.p-1.rounded.mb-3 (ui/icon "bug" {:style {:font-size ui/icon-size}})] [:div.icon-box.p-1.rounded.mb-3 (ui/icon "bug" {:style {:font-size ui/icon-size}})]
[:div.text-xl.font-bold [:div.text-xl.font-bold
(t :page/something-went-wrong)] (t ::something-went-wrong)]
[:div.mt-2.mb-2 (t :page/logseq-is-having-a-problem)] [:div.mt-2.mb-2 (t ::logseq-is-having-a-problem)]
[:div [:div
;; TODO: Enable once multi-window case doesn't result in possible data loss ;; TODO: Enable once multi-window case doesn't result in possible data loss
#_[:div.flex.flex-row.justify-between.align-items.mb-2 #_[:div.flex.flex-row.justify-between.align-items.mb-2
[:div.flex.flex-col.items-start [:div.flex.flex-col.items-start
[:div.text-2xs.uppercase (t :page/step "1")] [:div.text-2xs.uppercase (t ::step "1")]
[:div [:span.font-bold "Reload"] " the app"]] [:div [:span.font-bold "Reload"] " the app"]]
[:div (ui/icon "command") (ui/icon "letter-r")]] [:div (ui/icon "command") (ui/icon "letter-r")]]
[:div.flex.flex-row.justify-between.align-items.mb-2.items-center.py-4 [:div.flex.flex-row.justify-between.align-items.mb-2.items-center.py-4
[:div.flex.flex-col.items-start [:div.flex.flex-col.items-start
[:div.text-2xs.font-bold.uppercase.toned-down (t :page/step "1")] [:div.text-2xs.font-bold.uppercase.toned-down (t ::step "1")]
[:div [:span.highlighted.font-bold "Rebuild"] [:span.toned-down " search index"]]] [:div [:span.highlighted.font-bold "Rebuild"] [:span.toned-down " search index"]]]
[:div [:div
(ui/button (t :page/try) (ui/button (t ::try)
:small? true :small? true
:on-click (fn [] :on-click (fn []
(search-handler/rebuild-indices! true)))]] (search-handler/rebuild-indices! true)))]]
[:div.flex.flex-row.justify-between.align-items.mb-2.items-center.separator-top.py-4 [:div.flex.flex-row.justify-between.align-items.mb-2.items-center.separator-top.py-4
[:div.flex.flex-col.items-start [:div.flex.flex-col.items-start
[:div.text-2xs.font-bold.uppercase.toned-down (t :page/step "2")] [:div.text-2xs.font-bold.uppercase.toned-down (t ::step "2")]
[:div [:span.highlighted.font-bold "Relaunch"][:span.toned-down " the app"]] [:div [:span.highlighted.font-bold "Relaunch"][:span.toned-down " the app"]]
[:div.text-xs.toned-down "Quit the app and then reopen it."]] [:div.text-xs.toned-down "Quit the app and then reopen it."]]
[:div (ui/icon "command" {:class "rounded-md p-1 mr-2 bg-quaternary"}) [:div (ui/icon "command" {:class "rounded-md p-1 mr-2 bg-quaternary"})
(ui/icon "letter-q" {:class "rounded-md p-1 bg-quaternary"})]] (ui/icon "letter-q" {:class "rounded-md p-1 bg-quaternary"})]]
[:div.flex.flex-row.justify-between.align-items.mb-4.items-center.separator-top.py-4 [:div.flex.flex-row.justify-between.align-items.mb-4.items-center.separator-top.py-4
[:div.flex.flex-col.items-start [:div.flex.flex-col.items-start
[:div.text-2xs.font-bold.uppercase.toned-down (t :page/step "3")] [:div.text-2xs.font-bold.uppercase.toned-down (t ::step "3")]
[:div [:span.highlighted.font-bold "Clear"] [:span.toned-down " local storage"]] [:div [:span.highlighted.font-bold "Clear"] [:span.toned-down " local storage"]]
[:div.text-xs.toned-down "This does delete minor preferences like dark/light theme preference."]] [:div.text-xs.toned-down "This does delete minor preferences like dark/light theme preference."]]
[:div [:div
(ui/button (t :page/try) (ui/button (t ::try)
:small? true :small? true
:on-click (fn [] :on-click (fn []
(.clear js/localStorage) (.clear js/localStorage)

View File

@ -56,13 +56,13 @@
(defonce icon-size (if (mobile-util/native-platform?) 26 20)) (defonce icon-size (if (mobile-util/native-platform?) 26 20))
(def block-background-colors (def block-background-colors
["yellow" [::yellow
"red" ::red
"pink" ::pink
"green" ::green
"blue" ::blue
"purple" ::purple
"gray"]) ::gray])
(rum/defc ls-textarea (rum/defc ls-textarea
< rum/reactive < rum/reactive
@ -262,7 +262,7 @@
[] []
[:div.ui__notifications-content [:div.ui__notifications-content
[:div.pointer-events-auto [:div.pointer-events-auto
(button (t :notification/clear-all) (button (t ::notification-clear-all)
:intent "logseq" :intent "logseq"
:on-click (fn [] :on-click (fn []
(notification/clear-all!)))]]) (notification/clear-all!)))]])
@ -469,7 +469,7 @@
[:a.fade-link.text-link.font-bold [:a.fade-link.text-link.font-bold
{:on-click on-load {:on-click on-load
:class more-class} :class more-class}
(or more (t :page/earlier))]])]) (or more (t ::earlier))]])])
(rum/defcs auto-complete < (rum/defcs auto-complete <
(rum/local 0 ::current-idx) (rum/local 0 ::current-idx)
@ -691,6 +691,7 @@
(modal-panel show? modal-panel-content state close-fn false close-btn?)))])))) (modal-panel show? modal-panel-content state close-fn false close-btn?)))]))))
(defn loading (defn loading
([] (loading (t ::loading)))
([content] (loading content nil)) ([content] (loading content nil))
([content opts] ([content opts]
[:div.flex.flex-row.items-center.inline [:div.flex.flex-row.items-center.inline