Add help text

This commit is contained in:
Tienson Qin
2020-07-24 10:58:36 +08:00
parent ac7f62cd00
commit 325d850818
3 changed files with 48 additions and 30 deletions

View File

@@ -676,7 +676,7 @@
tags))))
(defn build-heading-part
[{:keys [slide?] :as config} {:heading/keys [uuid title tags marker level priority anchor meta format content pre-heading?]
[{:keys [slide?] :as config} {:heading/keys [uuid title tags marker level priority anchor meta format content pre-heading? dummy?]
:as t}]
(let [config (assoc config :heading t)
slide? (boolean (:slide? config))
@@ -706,7 +706,9 @@
(when-not slide? marker-switch)
marker-cp
priority]
(map-inline config title)
(if dummy?
[[:span.opacity-50 "Click here to start writing"]]
(map-inline config title))
[tags])))))))
(defn dnd-same-heading?

View File

@@ -7,7 +7,8 @@
[clojure.string :as string]
[frontend.ui :as ui]
[frontend.db :as db]
[frontend.version :as version]))
[frontend.version :as version]
[frontend.components.svg :as svg]))
(rum/defcs choose-preferred-format
[]
@@ -53,7 +54,18 @@
:on-click
(fn []
(when-not (string/blank? access-token)
(handler/set-github-token! @access-token))))]]]]])))
(handler/set-github-token! @access-token))))]
[:hr]
[:div.flex.flex-row.admonitionblock.align-items {:class "tip"}
[:div.pr-4.admonition-icon.flex.flex-col.justify-center
{:title "Tip"}
(svg/tip)]
[:div.ml-4.text-lg
[:a {:href "https://logseq.com/blog/faq"
:target "_blank"}
"How to create a Github personal access token?"]]]]]]])))
(rum/defc sync-status < rum/reactive
[]

View File

@@ -480,10 +480,11 @@
(when-let [hash (gobj/get commit "oid")]
(set-latest-commit! repo-url hash)))))
;; TODO: update latest commit
(defn push
[repo-url]
(when (and
([repo-url]
(push repo-url "Logseq auto save"))
([repo-url commit-message]
(when (and
(db/get-key-value repo-url :git/write-permission?)
(not (state/get-edit-input-id))
(= :should-push (db/get-key-value repo-url :git/status)))
@@ -491,29 +492,32 @@
(p/let [changed-files (git/get-status-matrix repo-url)]
(when (seq (flatten (vals changed-files)))
;; (prn {:changed-files changed-files})
(p/let [_commit-result (git/commit repo-url "Logseq auto save")]
(set-git-status! repo-url :pushing)
(let [token (get-github-token)]
(util/p-handle
(git/push repo-url token)
(fn []
(set-git-status! repo-url nil)
(set-git-error! repo-url nil)
(set-latest-commit-if-exists! repo-url))
(fn [error]
(prn "Failed to push, error: " error)
(set-git-status! repo-url :push-failed)
(set-git-error! repo-url error)
(show-notification!
[:p.content
"Failed to push, please "
[:span.text-gray-700.font-bold
"resolve any diffs first."]]
:error)
(p/let [result (git/fetch repo-url (get-github-token))
{:keys [fetchHead]} (bean/->clj result)
_ (set-latest-commit! repo-url fetchHead)]
(redirect! {:to :diff}))))))))))
(let [commit-message (if (string/blank? commit-message)
"Logseq auto save"
commit-message)]
(p/let [_commit-result (git/commit repo-url commit-message)]
(set-git-status! repo-url :pushing)
(let [token (get-github-token)]
(util/p-handle
(git/push repo-url token)
(fn []
(set-git-status! repo-url nil)
(set-git-error! repo-url nil)
(set-latest-commit-if-exists! repo-url))
(fn [error]
(println "Failed to push, error: " error)
(set-git-status! repo-url :push-failed)
(set-git-error! repo-url error)
(show-notification!
[:p.content
"Failed to push, please "
[:span.text-gray-700.font-bold
"resolve any diffs first."]]
:error)
(p/let [result (git/fetch repo-url (get-github-token))
{:keys [fetchHead]} (bean/->clj result)
_ (set-latest-commit! repo-url fetchHead)]
(redirect! {:to :diff}))))))))))))
(defn commit-and-force-push!
[commit-message pushing?]