|
|
@@ -58,11 +58,6 @@
|
|
|
{:title (t :graph)
|
|
|
:options {:href (rfe/href :graph)}
|
|
|
:icon svg/graph-sm})
|
|
|
- (when (and logged? current-repo)
|
|
|
- {:title (t :publishing)
|
|
|
- :options {:on-click (fn []
|
|
|
- (export/export-repo-as-html! current-repo))}
|
|
|
- :icon nil})
|
|
|
(when logged?
|
|
|
{:title (t :all-repos)
|
|
|
:options {:href (rfe/href :repos)}
|
|
|
@@ -79,12 +74,20 @@
|
|
|
{:title (t :all-journals)
|
|
|
:options {:href (rfe/href :all-journals)}
|
|
|
:icon svg/calendar-sm})
|
|
|
- {:title (t :excalidraw-title)
|
|
|
- :options {:href (rfe/href :draw)}
|
|
|
- :icon (svg/excalidraw-logo)}
|
|
|
{:title (t :settings)
|
|
|
:options {:href (rfe/href :settings)}
|
|
|
:icon svg/settings-sm}
|
|
|
+ (when-let [project (and current-repo (state/get-current-project))]
|
|
|
+ (let [link (str config/website "/" project)]
|
|
|
+ {:title (str (t :go-to) "/" project)
|
|
|
+ :options {:href link
|
|
|
+ :target "_blank"}
|
|
|
+ :icon svg/external-link}))
|
|
|
+ (when (and logged? current-repo)
|
|
|
+ {:title (t :export)
|
|
|
+ :options {:on-click (fn []
|
|
|
+ (export/export-repo-as-html! current-repo))}
|
|
|
+ :icon nil})
|
|
|
(when current-repo
|
|
|
{:title (t :import)
|
|
|
:options {:href (rfe/href :import)}
|
|
|
@@ -110,61 +113,54 @@
|
|
|
|
|
|
(rum/defc header
|
|
|
[{:keys [open-fn current-repo white? logged? page? route-match me default-home new-block-mode]}]
|
|
|
- (rum/with-context [[t] i18n/*tongue-context*]
|
|
|
- [:div.cp__header#head
|
|
|
- (left-menu-button {:on-click (fn []
|
|
|
- (open-fn)
|
|
|
- (state/set-left-sidebar-open! true))})
|
|
|
-
|
|
|
- (logo {:white? white?})
|
|
|
-
|
|
|
- (if current-repo
|
|
|
- (search/search)
|
|
|
- [:div.flex-1])
|
|
|
-
|
|
|
- (new-block-mode)
|
|
|
-
|
|
|
- [:a.text-sm.font-medium.login.opacity-70.hover:opacity-100.mr-4
|
|
|
- {:on-click (fn []
|
|
|
- (nfs/ls-dir-files))}
|
|
|
- "Open a directory"]
|
|
|
-
|
|
|
- (when (and (not logged?)
|
|
|
- (not config/publishing?))
|
|
|
- [:a.text-sm.font-medium.login.opacity-70.hover:opacity-100
|
|
|
- {:href "/login/github"
|
|
|
- :on-click (fn []
|
|
|
- (storage/remove :git/current-repo))}
|
|
|
- (t :login-github)])
|
|
|
-
|
|
|
- (repo/sync-status)
|
|
|
-
|
|
|
- [:div.repos.hidden.md:block
|
|
|
- (repo/repos-dropdown true)]
|
|
|
-
|
|
|
- (when-let [project (and current-repo (state/get-current-project))]
|
|
|
- [:a.opacity-70.hover:opacity-100.ml-4
|
|
|
- {:title (str (t :go-to) "/" project)
|
|
|
- :href (str config/website "/" project)
|
|
|
- :target "_blank"}
|
|
|
- svg/external-link])
|
|
|
-
|
|
|
- (when (and page? current-repo (not config/mobile?))
|
|
|
- (let [page (get-in route-match [:path-params :name])
|
|
|
- page (string/lower-case (util/url-decode page))
|
|
|
- page (db/entity [:page/name page])]
|
|
|
- (page/presentation current-repo page (:journal? page))))
|
|
|
-
|
|
|
- (if config/publishing?
|
|
|
- [:a.text-sm.font-medium.ml-3 {:href (rfe/href :graph)}
|
|
|
- (t :graph)]
|
|
|
-
|
|
|
- (dropdown-menu {:me me
|
|
|
- :t t
|
|
|
- :current-repo current-repo
|
|
|
- :default-home default-home}))
|
|
|
-
|
|
|
- [:a#download-as-html.hidden]
|
|
|
- [:a#download-as-zip.hidden]
|
|
|
-
|
|
|
- (right-menu-button)]))
|
|
|
+ (let [local-repo? (= current-repo config/local-repo)]
|
|
|
+ (rum/with-context [[t] i18n/*tongue-context*]
|
|
|
+ [:div.cp__header#head
|
|
|
+ (left-menu-button {:on-click (fn []
|
|
|
+ (open-fn)
|
|
|
+ (state/set-left-sidebar-open! true))})
|
|
|
+
|
|
|
+ (logo {:white? white?})
|
|
|
+
|
|
|
+ (if current-repo
|
|
|
+ (search/search)
|
|
|
+ [:div.flex-1])
|
|
|
+
|
|
|
+ (new-block-mode)
|
|
|
+
|
|
|
+ (when (and (not logged?)
|
|
|
+ (not config/publishing?))
|
|
|
+ [:a.text-sm.font-medium.login.opacity-70.hover:opacity-100
|
|
|
+ {:href "/login/github"
|
|
|
+ :on-click (fn []
|
|
|
+ (storage/remove :git/current-repo))}
|
|
|
+ (t :login-github)])
|
|
|
+
|
|
|
+ (repo/sync-status)
|
|
|
+
|
|
|
+ [:div.repos.hidden.md:block
|
|
|
+ (repo/repos-dropdown true)]
|
|
|
+
|
|
|
+ [:a.text-sm.font-medium.opacity-70.hover:opacity-100.ml-3
|
|
|
+ {:on-click (fn []
|
|
|
+ (nfs/ls-dir-files))
|
|
|
+ :title (t :open-a-directory)}
|
|
|
+ [:div.flex.flex-row.text-center
|
|
|
+ [:span.inline-block svg/folder-add]
|
|
|
+ (when-not config/mobile?
|
|
|
+ [:span.ml-1 {:style {:margin-top 2}}
|
|
|
+ (t :open)])]]
|
|
|
+
|
|
|
+ (if config/publishing?
|
|
|
+ [:a.text-sm.font-medium.ml-3 {:href (rfe/href :graph)}
|
|
|
+ (t :graph)]
|
|
|
+
|
|
|
+ (dropdown-menu {:me me
|
|
|
+ :t t
|
|
|
+ :current-repo current-repo
|
|
|
+ :default-home default-home}))
|
|
|
+
|
|
|
+ [:a#download-as-html.hidden]
|
|
|
+ [:a#download-as-zip.hidden]
|
|
|
+
|
|
|
+ (right-menu-button)])))
|