mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 09:56:31 +00:00
Feat: the new handbooks (#8524)
* feat(ui): WIP handbooks pane * feat(ui): WIP handbooks pane * feat(ui): WIP handbooks pane * feat(ui): WIP handbooks popup * feat(ui): WIP dragable & resizable for handbooks popup * feat(ui): WIP pane navigations for handbooks popup * feat(ui): WIP pane navigations for handbooks popup * feat(ui): WIP handbooks markdown body * feat(ui): WIP handbooks nodes for dashboard render * feat(ui): WIP watch mode for development * improve(ui): typos * feat(ui): WIP enhance watch mode * feat(ui): WIP support topic conent link local assets * feat(ui): WIP support slide gallery for demo images & videos. * fix(ui): parse value about draging position offset * improve(ui): background color transition of handbook item card * improve(ui): resizable of handbooks popup * feat(handbooks): search topics * improve(handbooks): search results within topics group * improve(ui): better interaction for handbooks searchbar * fix(handbooks): conflictive up/down for searchbar interaction * improve(ux): better interaction for handbooks searchbar * feat(ux): support youtube video for topic demos media * fix(ui): container size of youtube video demos * improve(handbooks): support local video for topic demos * improve(ui): polish markdown body style for handbooks topic details * chore: remove debugs * chore: remove debugs * improve(ui): polish active style for topic item card * improve(ui): polish style of demos item * improve(ui): help buttons still be visible when right sidebar opened * improve(handbooks): support sub chapters for topic detail * improve(handbooks): support sub chapters for topic detail * improve(handbooks): support chapters searching for topics list * fix: lint * improve(ui): position of demo slides bullets * fix(ui): index of chapter select * improve(handbooks): typo * fix(dev): lint * fix(dev): lint * fix(pdf): remove prefix(`@`) checking for links of org mode page * feat(ui): WIP handbooks pane * feat(ui): WIP handbooks pane * feat(ui): WIP handbooks pane * feat(ui): WIP handbooks popup * feat(ui): WIP dragable & resizable for handbooks popup * feat(ui): WIP pane navigations for handbooks popup * feat(ui): WIP pane navigations for handbooks popup * feat(ui): WIP handbooks markdown body * feat(ui): WIP handbooks nodes for dashboard render * feat(ui): WIP watch mode for development * improve(ui): typos * feat(ui): WIP enhance watch mode * feat(ui): WIP support topic conent link local assets * feat(ui): WIP support slide gallery for demo images & videos. * fix(ui): parse value about draging position offset * improve(ui): background color transition of handbook item card * improve(ui): resizable of handbooks popup * feat(handbooks): search topics * improve(handbooks): search results within topics group * improve(ui): better interaction for handbooks searchbar * fix(handbooks): conflictive up/down for searchbar interaction * improve(ux): better interaction for handbooks searchbar * feat(ux): support youtube video for topic demos media * fix(ui): container size of youtube video demos * improve(handbooks): support local video for topic demos * improve(ui): polish markdown body style for handbooks topic details * chore: remove debugs * chore: remove debugs * improve(ui): polish active style for topic item card * improve(ui): polish style of demos item * improve(ui): help buttons still be visible when right sidebar opened * improve(handbooks): support sub chapters for topic detail * improve(handbooks): support sub chapters for topic detail * improve(handbooks): support chapters searching for topics list * fix: lint * improve(ui): position of demo slides bullets * fix(ui): index of chapter select * improve(handbooks): typo * fix(dev): lint * fix(dev): lint * improve(handbook): i18n * fix(lint): unused translations * fix: accessibility issues and translations * fix(handbook): chapters navigation * enhance(handbook): ux of the chapters select * enhance(handbook): support link other page with markdown link syntax * improve(ui): polish ui details of handbook topics card * fix(handbook): parse key from href with a specific extension * enhance(handbook): logic of chapters navigation * enhance(handbook): ui of chapters navigation * fix: lint * improve(ui): display nowrap for code text * fix(handbook): remove unnecessary source map * fix(ui): missing component key of handbook chapter select * enhance(handbook): WIP support panes navigation for the external links * enhance(handbook): support panes navigation for the external links * improve(ui): footer links of the handbook home pane * improve(ui): footer links of the handbook home pane * improve(ui): polish topics card * improve(handbook): add shortcuts category card for home pane * improve(ui): WIP the new help menu * improve(ui): the new help menu * fix: incorrect help link * improve(ux): close help menu when click outside * fix: lint * fix(lint): remove unused translation * fix(ui): the link of changelog * fix(ui): the cover thumb container size of the topic card * fix(ui): handbook popup overlay index * enhance(ux): preivew images with lightbox modal for the handbook content * enhance(ux): bottom border for the handbook content header when then content body scrolled * fix: missing i18n * improve(handbook): polish ui details * fix: lint * enhance(handbook): polish details * fix(ui): incorrect safety init * fix(ui): missing key for the help menu items * enhance(ui): disable resize for the handbook popup container * chore: build libs core * fix(ui): incorrect shortcuts label * enhance(handbook): cache discord online number * enhance(handbook): fix heading level sizes * enhance(handbook): improve paragraph spacing * enhance(handbook): improve margins of media elements * enhance(handbook): polish discord button * enhance(plugin): make headings/font weights/colors look like in the design * enhance(handbook): writing mode option is only available for develop mode * enhance(handbook): polish handbook dashboard page * enhance(handbook): typos * enhance(ux): get discord online users count from logseq server * fix(handbooks): incorrect var name * enhance(handbook): polish details --------- Co-authored-by: Bad3r <bad3r@protonmail.com> Co-authored-by: situ2001 <yongcong2001@outlook.com> Co-authored-by: Tienson Qin <tiensonqin@gmail.com> Co-authored-by: Konstantinos Kaloutas <konstantinos@logseq.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
(ns frontend.components.container
|
||||
(:require [cljs-drag-n-drop.core :as dnd]
|
||||
[clojure.string :as string]
|
||||
[frontend.version :refer [version]]
|
||||
[frontend.components.find-in-page :as find-in-page]
|
||||
[frontend.components.header :as header]
|
||||
[frontend.components.journal :as journal]
|
||||
@@ -11,6 +12,7 @@
|
||||
[frontend.components.select :as select]
|
||||
[frontend.components.theme :as theme]
|
||||
[frontend.components.widgets :as widgets]
|
||||
[frontend.components.handbooks :as handbooks]
|
||||
[frontend.config :as config]
|
||||
[frontend.context.i18n :refer [t]]
|
||||
[frontend.db :as db]
|
||||
@@ -35,6 +37,7 @@
|
||||
[frontend.util :as util]
|
||||
[frontend.util.cursor :as cursor]
|
||||
[frontend.components.window-controls :as window-controls]
|
||||
[medley.core :as medley]
|
||||
[goog.dom :as gdom]
|
||||
[goog.object :as gobj]
|
||||
[logseq.common.path :as path]
|
||||
@@ -696,15 +699,71 @@
|
||||
{:on-click state/toggle-document-mode!}
|
||||
"D"])))
|
||||
|
||||
(def help-menu-items
|
||||
[{:title "Handbook" :icon "book-2" :on-click #(handbooks/toggle-handbooks)}
|
||||
{:title "Keyboard shortcuts" :icon "command" :on-click #(state/sidebar-add-block! (state/get-current-repo) "shortcut-settings" :shortcut-settings)}
|
||||
{:title "Documentation" :icon "help" :href "https://docs.logseq.com/"}
|
||||
:hr
|
||||
{:title "Report bug" :icon "bug" :on-click #(rfe/push-state :bug-report)}
|
||||
{:title "Request feature" :icon "git-pull-request" :href "https://discuss.logseq.com/c/feature-requests/"}
|
||||
{:title "Submit feedback" :icon "messages" :href "https://discuss.logseq.com/c/feedback/13"}
|
||||
:hr
|
||||
{:title "Ask the community" :icon "brand-discord" :href "https://discord.com/invite/KpN4eHY"}
|
||||
{:title "Support forum" :icon "message" :href "https://discuss.logseq.com/"}
|
||||
:hr
|
||||
{:title "Release notes" :icon "asterisk" :href "https://docs.logseq.com/#/page/changelog"}])
|
||||
|
||||
(rum/defc help-menu-popup
|
||||
[]
|
||||
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(state/set-state! :ui/handbooks-open? false))
|
||||
[])
|
||||
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(let [h #(state/set-state! :ui/help-open? false)]
|
||||
(.addEventListener js/document.body "click" h)
|
||||
#(.removeEventListener js/document.body "click" h)))
|
||||
[])
|
||||
|
||||
[:div.cp__sidebar-help-menu-popup
|
||||
[:div.list-wrap
|
||||
(for [[idx {:keys [title icon href on-click] :as item}] (medley/indexed help-menu-items)]
|
||||
(case item
|
||||
:hr
|
||||
[:hr.my-2 {:key idx}]
|
||||
|
||||
;; default
|
||||
[:a.it.flex.items-center.px-4.py-1.select-none
|
||||
{:key title
|
||||
:on-click (fn []
|
||||
(cond
|
||||
(fn? on-click) (on-click)
|
||||
(string? href) (util/open-url href))
|
||||
(state/set-state! :ui/help-open? false))}
|
||||
[:span.flex.items-center.pr-2.opacity-40 (ui/icon icon {:size 20})]
|
||||
[:strong.font-normal title]]))]
|
||||
[:div.ft.pl-11.pb-3
|
||||
[:span.opacity.text-xs.opacity-30 "Logseq " version]]])
|
||||
|
||||
(rum/defc help-button < rum/reactive
|
||||
[]
|
||||
(when-not (state/sub :ui/sidebar-open?)
|
||||
[:div.cp__sidebar-help-btn
|
||||
[:div.inner
|
||||
{:title (t :help-shortcut-title)
|
||||
:on-click (fn []
|
||||
(state/sidebar-add-block! (state/get-current-repo) "help" :help))}
|
||||
"?"]]))
|
||||
(let [help-open? (state/sub :ui/help-open?)
|
||||
handbooks-open? (state/sub :ui/handbooks-open?)]
|
||||
[:<>
|
||||
[:div.cp__sidebar-help-btn
|
||||
[:div.inner
|
||||
{:title (t :help-shortcut-title)
|
||||
:on-click #(state/toggle! :ui/help-open?)}
|
||||
"?"]]
|
||||
|
||||
(when help-open?
|
||||
(help-menu-popup))
|
||||
|
||||
(when handbooks-open?
|
||||
(handbooks/handbooks-popup))]))
|
||||
|
||||
(rum/defcs ^:large-vars/cleanup-todo sidebar <
|
||||
(mixins/modal :modal/show?)
|
||||
@@ -828,7 +887,6 @@
|
||||
:nfs-granted? granted?
|
||||
:db-restoring? db-restoring?})
|
||||
[:a#download.hidden]
|
||||
(when
|
||||
(and (not config/mobile?)
|
||||
(not config/publishing?))
|
||||
(when (and (not config/mobile?)
|
||||
(not config/publishing?))
|
||||
(help-button))])))
|
||||
|
||||
Reference in New Issue
Block a user