Skip to content

Commit

Permalink
enhance: display a warning button for the demo graph
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Aug 25, 2021
1 parent 6e3d09d commit 3c4ad52
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/main/frontend/components/header.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@
repos (->> (state/sub [:me :repos])
(remove #(= (:url %) config/local-repo)))
electron-mac? (and util/mac? (util/electron?))
electron-not-mac? (and (util/electron?) (not electron-mac?))]
electron-not-mac? (and (util/electron?) (not electron-mac?))
show-open-folder? (and (nfs/supported?) (empty? repos)
(not config/publishing?))]
(rum/with-context [[t] i18n/*tongue-context*]
[:div.cp__header#head
{:class (when electron-mac? "electron-mac")
Expand Down Expand Up @@ -210,8 +212,14 @@
[:div.repos
(repo/repos-dropdown nil)]

(when (and (nfs/supported?) (empty? repos)
(not config/publishing?))
(when show-open-folder?
(ui/tippy {:html [:div.font-medium "Feel free to edit anything, no change will be saved at this moment. If you do want to persist your work, click the right button to open a local directory or connect Logseq to Github."]
:interactive true
:delay [1000, 100]
:position "down"}
[:a.button (svg/warning)]))

(when show-open-folder?
[:a.text-sm.font-medium.button
{:on-click #(page-handler/ls-dir-files! shortcut/refresh!)}
[:div.flex.flex-row.text-center.open-button__inner.items-center
Expand Down
5 changes: 5 additions & 0 deletions src/main/frontend/components/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
a.button {
margin: 0 4px;
}

svg.warning {
transform: scale(0.6);
color: red;
}
}

.is-electron.is-mac .cp__header {
Expand Down
1 change: 0 additions & 1 deletion templates/tutorial-en.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## Hi, welcome to Logseq!
- Logseq is a _privacy-first_, _open-source_ platform for _knowledge_ management and collaboration.
- This is a 3 minute tutorial on how to use Logseq. Let's get started!
- [:div.warning-text "Feel free to edit anything, no change will be saved at this moment. If you do want to persist your work, click the top-right corner of the screen to either open a local directory or connect Logseq to Github."]
- Here are some tips might be useful.
#+BEGIN_TIP
Click to edit any block.
Expand Down

0 comments on commit 3c4ad52

Please sign in to comment.