all pages: filter by whiteboard

pull/6345/head
Peng Xiao 2022-08-05 00:10:29 +08:00
parent 2f0125b31f
commit a2103a0d45
4 changed files with 25 additions and 6 deletions

View File

@ -785,6 +785,7 @@
(rum/local :block/updated-at ::sort-by-item)
(rum/local true ::desc?)
(rum/local false ::journals)
(rum/local false ::whiteboards)
(rum/local nil ::filter-fn)
(rum/local 1 ::current-page)
[state]
@ -793,6 +794,7 @@
*sort-by-item (get state ::sort-by-item)
*desc? (::desc? state)
*journal? (::journals state)
*whiteboard? (::whiteboards state)
*results (::results state)
*results-all (::results-all state)
*checks (::checks state)
@ -845,16 +847,19 @@
:block/backlinks (count (:block/_refs (db/entity (:db/id page))))
:block/idx idx))))]
(reset! *filter-fn
(memoize (fn [sort-by-item desc? journal?]
(memoize (fn [sort-by-item desc? journal? whiteboard?]
(->> pages
(filter #(or (boolean journal?)
(= false (boolean (:block/journal? %)))))
(filter #(and
(or (boolean journal?)
(= false (boolean (:block/journal? %))))
(or (boolean whiteboard?)
(= false (boolean (:block/whiteboard? %))))))
(sort-pages-by sort-by-item desc?)))))
(reset! *pages pages)))
;; filter results
(when @*filter-fn
(let [pages (@*filter-fn @*sort-by-item @*desc? @*journal?)
(let [pages (@*filter-fn @*sort-by-item @*desc? @*journal? @*whiteboard?)
;; search key
pages (if-not (string/blank? @*search-key)
@ -921,6 +926,14 @@
(ui/icon "x")])])]]
[:div.r.flex.items-center.justify-between
[:div
(ui/tippy
{:html [:small (str (t :page/show-whiteboards) " ?")]
:arrow true}
[:a.button.whiteboard
{:class (util/classnames [{:active (boolean @*whiteboard?)}])
:on-click #(reset! *whiteboard? (not @*whiteboard?))}
(ui/icon "artboard" {:style {:fontSize ui/icon-size}})])]
[:div
(ui/tippy
{:html [:small (str (t :page/show-journals) " ?")]

View File

@ -99,6 +99,7 @@
:page/add-to-favorites "Add to Favorites"
:page/unfavorite "Unfavorite page"
:page/show-journals "Show journals"
:page/show-whiteboards "Show whiteboards"
:page/show-name "Show page name"
:page/hide-name "Hide page name"
:block/name "Page name"
@ -1198,6 +1199,7 @@
:page/add-to-favorites "添加收藏"
:page/unfavorite "取消收藏"
:page/show-journals "显示日志"
:page/show-whiteboards "显示白板"
:page/show-name "显示页面名"
:page/hide-name "隐藏页面名"
:block/name "页面名称"

View File

@ -158,7 +158,11 @@ export const Canvas = observer(function Renderer<S extends TLReactShape>({
{selectedShapes && selectionBounds && (
<>
{showSelection && components.SelectionForeground && (
<Container data-type="SelectionForeground" bounds={selectionBounds} zIndex={10002}>
<Container
data-type="SelectionForeground"
bounds={selectionBounds}
zIndex={editingShape && selectedShapes.includes(editingShape) ? 1002 : 10002}
>
<components.SelectionForeground
zoom={zoom}
shapes={selectedShapes}

View File

@ -34,7 +34,7 @@ export const Indicator = observer(function Shape({
bounds={bounds}
rotation={rotation}
scale={scale}
zIndex={10000}
zIndex={isEditing ? 1000 : 10000}
>
<SVGContainer>
<g className={`tl-indicator-container ${isSelected ? 'tl-selected' : 'tl-hovered'}`}>