[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))
{:class (str (string/lower-case marker))})
(when bg-color
{:style {:background-color (if (some #{bg-color} ui/block-background-colors)
(str "var(--ls-highlight-color-" bg-color ")")
bg-color)
:color (when-not (some #{bg-color} ui/block-background-colors) "white")}
:class "px-1 with-bg-color"}))
(let [colors (map name ui/block-background-colors)
built-in-color? (some #{bg-color} colors)]
{:style {:background-color (if built-in-color?
(str "var(--ls-highlight-color-" bg-color ")")
bg-color)
:color (when-not built-in-color? "white")}
:class "px-1 with-bg-color"})))
;; children
(let [area? (= :area (keyword (:hl-type properties)))

View File

@ -42,7 +42,7 @@
[:div.input-wrap
[:input.cp__palette-input.w-full.h-full
{:type "text"
:placeholder (t :command-palette/prompt)
:placeholder (t ::prompt)
:auto-focus true
:value @input
: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
(for [color ui/block-background-colors]
[:a.shadow-sm
{:title (t (keyword "color" color))
{:title (t color)
:on-click (fn [_e]
(editor-handler/set-block-property! block-id "background-color" color))}
[:div.heading-bg {:style {:background-color (str "var(--color-" color "-500)")}}]])
(editor-handler/set-block-property! block-id "background-color" (name color)))}
[:div.heading-bg {:style {:background-color (str "var(--color-" (name color) "-500)")}}]])
[:a.shadow-sm
{:title (t :remove-background)
:on-click (fn [_e]

View File

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

View File

@ -185,7 +185,7 @@
result
{:on-chosen chosen-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
(let [page (or (:block/original-name page)
(:block/name page))

View File

@ -34,9 +34,9 @@
[:table.table-auto
[:thead
[:tr
[:th (t :file/name)]
[:th (t ::name)]
(when-not mobile?
[:th (t :file/last-modified-at)])
[:th (t ::last-modified-at)])
(when-not mobile?
[:th ""])]]
[:tbody
@ -52,7 +52,7 @@
(when-not mobile?
[:td [:span.text-gray-500.text-sm
(if (zero? modified-at)
(t :file/no-data)
(t ::no-data)
(date/get-date-time-string
(t/to-default-time-zone (tc/to-date-time modified-at))))]])
@ -105,7 +105,7 @@
[:h1.title
[:bdi (js/decodeURI path)]]
(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}
:href (rfe/href :page {:name original-name})
:on-click (fn [e]
@ -122,7 +122,7 @@
[:p.text-sm.ml-1.mb-4
(svg/warning {:style {:width "1em"
: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
;; image type
@ -144,10 +144,10 @@
;; wait for content load
(and format
(contains? (gp-config/text-formats) format))
(ui/loading "Loading ...")
(ui/loading)
:else
[:div (t :file/format-not-supported (name format))])]))
[:div (t ::format-not-supported (name format))])]))
(rum/defcs file
[state]

View File

@ -165,10 +165,10 @@
(when downloaded
[:div.cp__header-tips
[:p (t :updater/new-version-install)
[:p (t ::updater-new-version-install)
[:a.restart.ml-2
{: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
[{:keys [open-fn current-repo default-home new-block-mode]}]
@ -253,7 +253,7 @@
(ui/icon "folder-plus")
(when-not config/mobile?
[:span.ml-1 {:style {:margin-top (if electron-mac? 0 2)}}
(t :on-boarding/add-graph)])])
(t ::add-graph)])])
(when config/publishing?
[:a.text-sm.font-medium.button {:href (rfe/href :graph)}

View File

@ -13,36 +13,36 @@
[]
[:div.help.cp__sidebar-help-docs
(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}})]
list
[{:title "Usage"
[{:title (t ::usage-heading)
:children [[[:a
{:on-click (fn [] (state/sidebar-add-block! (state/get-current-repo) "shortcut-settings" :shortcut-settings))}
[: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}})]]]
[(t :help/docs) "https://docs.logseq.com/"]
[(t :help/start) "https://docs.logseq.com/#/page/tutorial"]
[(t ::docs) "https://docs.logseq.com/"]
[(t ::start) "https://docs.logseq.com/#/page/tutorial"]
["FAQ" "https://docs.logseq.com/#/page/faq"]]}
{:title "Community"
:children [[(t :help/awesome-logseq) "https://github.com/logseq/awesome-logseq"]
[(t :help/blog) "https://blog.logseq.com"]
{:title (t ::community-heading)
:children [[(t ::awesome-logseq) "https://github.com/logseq/awesome-logseq"]
[(t ::blog) "https://blog.logseq.com"]
[discourse-with-icon "https://discuss.logseq.com"]]}
{:title "Development"
:children [[(t :help/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 :help/feature) "https://discuss.logseq.com/c/feature-requests/"]
[(t :help/changelog) "https://docs.logseq.com/#/page/changelog"]]}
{:title (t ::development-heading)
:children [[(t ::roadmap) "https://trello.com/b/8txSM12G/roadmap"]
[(t ::bug) "https://github.com/logseq/logseq/issues/new?labels=from:in-app&template=bug_report.yaml"]
[(t ::feature) "https://discuss.logseq.com/c/feature-requests/"]
[(t ::changelog) "https://docs.logseq.com/#/page/changelog"]]}
{:title "About"
:children [[(t :help/about) "https://blog.logseq.com/about/"]]}
{:title (t ::about-heading)
:children [[(t ::about) "https://blog.logseq.com/about/"]]}
{:title "Terms"
:children [[(t :help/privacy) "https://blog.logseq.com/privacy-policy/"]
[(t :help/terms) "https://blog.logseq.com/terms/"]]}]]
{:title (t ::terms-heading)
:children [[(t ::privacy) "https://blog.logseq.com/privacy-policy/"]
[(t ::terms) "https://blog.logseq.com/terms/"]]}]]

View File

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

View File

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

View File

@ -23,8 +23,7 @@
[page-name]
(page-handler/delete! page-name
(fn []
(notification/show! (str "Page " page-name " was deleted successfully!")
:success)))
(notification/show! (t ::page-deleted-successfully) :success)))
(state/close-modal!)
(route-handler/redirect-to-home!))
@ -38,7 +37,7 @@
(ui/icon "alert-triangle")]]
[:div.mt-3.text-center.sm:mt-0.sm:ml-4.sm:text-left
[: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
[:span.flex.w-full.rounded-md.shadow-sm.sm:ml-3.sm:w-auto
@ -81,8 +80,8 @@
(when (and page (not block?))
(->>
[{:title (if favorited?
(t :page/unfavorite)
(t :page/add-to-favorites))
(t ::unfavorite)
(t ::add-to-favorites))
:options {:on-click
(fn []
(if favorited?
@ -90,7 +89,7 @@
(page-handler/favorite-page! page-original-name)))}}
(when (or (util/electron?) file-sync-graph-uuid)
{:title (t :page/version-history)
{:title (t ::version-history)
:options {:on-click
(fn []
(cond
@ -106,17 +105,17 @@
(when (or (util/electron?)
(mobile-util/native-platform?))
{:title (t :page/copy-page-url)
{:title (t ::copy-page-url)
:options {:on-click #(util/copy-to-clipboard!
(url-util/get-logseq-graph-page-url nil repo page-original-name))}})
(when-not contents?
{:title (t :page/delete)
{:title (t ::delete)
:options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
(when (and (not (mobile-util/native-platform?))
(state/get-current-page))
{:title (t :page/presentation-mode)
{:title (t ::presentation-mode)
:options {:on-click (fn []
(state/sidebar-add-block!
repo
@ -128,9 +127,9 @@
;; this one. However this component doesn't yet exist. PRs are welcome!
;; Details: https://github.com/logseq/logseq/pull/3003#issuecomment-952820676
(when file-path
[{:title (t :page/open-in-finder)
[{:title (t ::open-in-finder)
: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)}}])
(when (state/get-current-page)
@ -140,7 +139,7 @@
(export/export-blocks (:block/name page))))}})
(when (util/electron?)
{:title (t (if public? :page/make-private :page/make-public))
{:title (t (if public? :make-private ::make-public))
:options {:on-click
(fn []
(page-handler/update-public-attribute!
@ -150,7 +149,7 @@
(when (and (util/electron?) file-path
(not (file-sync-handler/synced-file-graph? repo)))
{:title (t :page/open-backup-directory)
{:title (t ::open-backup-directory)
:options {:on-click
(fn []
(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)]
: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}}]
(when (state/developer-mode?)
@ -907,10 +907,10 @@
< rum/reactive
[plugins]
[: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)
[:div
[:div.mb-2.text-xl (t :plugin.install-from-file/notice)]
[:div.mb-2.text-xl (t ::install-from-file.notice)]
;; lists
[:ul
(for [it (:install plugins)
@ -928,7 +928,7 @@
(plugin-config-handler/replace-plugins plugins)
(state/close-sub-modal! "ls-plugins-from-file-modal")))]]
;; 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!
[]

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
(ui/icon "filter" {:size 20})]
[: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
"Click to include and shift-click to exclude. Click again to remove."]]]
(t ::filter-include-exclude)]]]
(when (seq filters)
[:div.cp__filters.mb-4.ml-2
(when (seq includes)
[: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)])
(when (seq excludes)
[: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)])])
[:div.cp__filters-input-panel.flex
(ui/icon "search")
[:input.cp__filters-input.w-full
{:placeholder (t :linked-references/filter-search)
{:placeholder (t ::filter-search)
:auto-focus true
:on-change (fn [e]
(reset! filter-search (util/evalue e)))}]]
@ -140,7 +140,7 @@
" Linked Reference"
(when (> total 1) "s"))]
[:a.filter.fade-link
{:title "Filter"
{:title (t ::filter)
:on-mouse-over (fn [_e]
(when @*collapsed? ; collapsed
;; expand
@ -282,10 +282,7 @@
[:div.content.flex-1
(ui/foldable
[:h2.font-medium
(if @n-ref
(str @n-ref " Unlinked Reference" (when (> @n-ref 1)
"s"))
"Unlinked References")]
(t ::unlinked-references @n-ref)]
(fn [] (unlinked-references-aux page-name n-ref))
{:default-collapsed? true
:title-trigger? true})]]))))

View File

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

View File

@ -282,12 +282,12 @@
[: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")
: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))]
:file
(search-result-item {:name "file"
:title (t :search-item/file)}
:title (t ::item-file)}
(highlight-exact-query data search-q))
:block
@ -300,7 +300,7 @@
content' (if block (:block/content block) content)]
[:span {:data-block-ref uuid}
(search-result-item {:name "block"
:title (t :search-item/block)
:title (t ::item-block)
:extension? true}
(cond
@ -321,7 +321,7 @@
format (db/get-page-format page)]
[:span {:data-block-ref uuid}
(search-result-item {:name "page"
:title (t :search-item/page)
:title (t ::item-page)
:extension? true}
(if page
(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
:more? true})
(search-handler/clear-search!)))}
(t :more)]])]))
(t ::more)]])]))
(rum/defc recent-search-and-pages
[in-page-search?]
@ -573,8 +573,8 @@
search-result (state/sub :search/more-result)]
[:div#search.flex-1.flex
[:div.inner
[:h1.title (t :search/result-for) [:i search-q]]
[:p.font-medium.tx-sm (str (count (:blocks search-result)) " " (t :search/items))]
[:h1.title (t ::result-for) [:i search-q]]
[: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
(when-not (string/blank? search-q)
(search-auto-complete search-result search-q true))]]]))

View File

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

View File

@ -280,7 +280,7 @@
:-for "preferred_language"
: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
[:li {:on-click (partial state/use-theme-mode! "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"]]
[:li {:on-click (partial state/use-theme-mode! "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"
:action pick-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])
theme (state/sub :ui/theme)
dark? (= "dark" theme)
system-theme? (state/sub :ui/system-theme?)
switch-theme (if dark? "light" "dark")]
system-theme? (state/sub :ui/system-theme?)]
[:div.panel-wrap.is-general
(version-row t version)
(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 current-repo (edit-config-edn))
(when current-repo (edit-custom-css))

View File

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

View File

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

View File

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

View File

@ -314,16 +314,16 @@
[:div.cp__whiteboard-welcome
[: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
(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
(ui/button (t :on-boarding/welcome-whiteboard-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-skip) :on-click close-fn :background "gray" :class "opacity-60")
(ui/button (t ::welcome--modal-start)
:on-click (fn []
(config-handler/set-config! :feature/enable-whiteboards? true)
(quick-tour/ready

View File

@ -21,7 +21,7 @@
(rum/defc add-local-directory
[]
[: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?))]
(if (mobile-util/native-platform?)
[:div.text-sm
@ -39,13 +39,13 @@
(when nfs-supported?
{:on-click #(page-handler/ls-dir-files! shortcut/refresh!)})
[:div
[:h1.title (t :on-boarding/open-local-dir)]
[:p (t :on-boarding/new-graph-desc-1)]
[:p (t :on-boarding/new-graph-desc-2)]
[:h1.title (t ::open-local-dir)]
[:p (t ::new-graph-desc-1)]
[:p (t ::new-graph-desc-2)]
[:ul
[:li (t :on-boarding/new-graph-desc-3)]
[:li (t :on-boarding/new-graph-desc-4)]
[:li (t :on-boarding/new-graph-desc-5)]]
[:li (t ::new-graph-desc-3)]
[:li (t ::new-graph-desc-4)]
[:li (t ::new-graph-desc-5)]]
(when-not nfs-supported?
(ui/admonition :warning (native-fs-api-alert)))]]]))])
@ -94,4 +94,4 @@
(not config/publishing?))
(ui/admonition
: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.
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/local 800 ::draw-width)
(rum/local true ::zen-mode?)
@ -83,17 +88,13 @@
(when data
[:div.overflow-hidden {:on-mouse-down (fn [e] (util/stop e))}
[:div.my-1 {:style {:font-size 10}}
[:a.mr-2 {:on-click ui-handler/toggle-wide-mode!}
(util/format "Wide Mode (%s)" (if wide-mode? "ON" "OFF"))]
[:a.mr-2 {:on-click #(swap! *zen-mode? not)}
(util/format "Zen Mode (%s)" (if @*zen-mode? "ON" "OFF"))]
[: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"))]
(toggle-mode-button (t ::wide) wide-mode? ui-handler/toggle-wide-mode!)
(toggle-mode-button (t ::zen) @*zen-mode? #(swap! *zen-mode? not))
(toggle-mode-button (t ::view) @*view-mode? #(swap! *view-mode? not))
(toggle-mode-button (t ::grid) @*grid-mode? #(swap! *grid-mode? not))
[:a.mr-2 {:on-click #(when-let [block (db/pull [:block/uuid block-uuid])]
(editor-handler/edit-block! block :max block-uuid))}
"Edit Block"]]
(t ::edit-block)]]
[:div.draw-wrap
{:on-mouse-down (fn [e]
(util/stop e)
@ -148,8 +149,7 @@
(when (:file option)
(cond
db-restoring?
[:div.ls-center
(ui/loading (t :loading))]
[:div.ls-center (ui/loading)]
(false? loading?)
(draw-inner data option)

View File

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

View File

@ -200,11 +200,11 @@
[: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)])

View File

@ -77,21 +77,21 @@
(when (= theme it) (svg/check))])
["light", "warm", "dark"])]
[: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)]
[: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)]
[:div.extensions__pdf-settings-item.toggle-input
[: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)]
(state/set-modal! (make-docinfo-in-modal ret)))}
[:span.flex.items-center.justify-between.w-full
(t :pdf/doc-metadata)
(t ::doc-metadata)
(svg/icon-info)]]]]]))
(rum/defc docinfo-display
@ -363,7 +363,7 @@
[:strong "Page " page]]
[:button
{:title (t :pdf/linked-ref)
{:title (t ::linked-ref)
:on-click goto-ref!}
(ui/icon "external-link")]]

View File

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

View File

@ -38,7 +38,7 @@
:file/path file-path}]))
: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
{:content error
:status :error

View File

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

View File

@ -39,38 +39,38 @@
[:div.ls-center
[:div.icon-box.p-1.rounded.mb-3 (ui/icon "bug" {:style {:font-size ui/icon-size}})]
[:div.text-xl.font-bold
(t :page/something-went-wrong)]
[:div.mt-2.mb-2 (t :page/logseq-is-having-a-problem)]
(t ::something-went-wrong)]
[:div.mt-2.mb-2 (t ::logseq-is-having-a-problem)]
[:div
;; 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-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 (ui/icon "command") (ui/icon "letter-r")]]
[:div.flex.flex-row.justify-between.align-items.mb-2.items-center.py-4
[: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
(ui/button (t :page/try)
(ui/button (t ::try)
:small? true
:on-click (fn []
(search-handler/rebuild-indices! true)))]]
[:div.flex.flex-row.justify-between.align-items.mb-2.items-center.separator-top.py-4
[: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.text-xs.toned-down "Quit the app and then reopen it."]]
[:div (ui/icon "command" {:class "rounded-md p-1 mr-2 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-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.text-xs.toned-down "This does delete minor preferences like dark/light theme preference."]]
[:div
(ui/button (t :page/try)
(ui/button (t ::try)
:small? true
:on-click (fn []
(.clear js/localStorage)

View File

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