New focus mode in workspace

This commit is contained in:
alonso.torres 2022-02-23 16:30:01 +01:00 committed by Andrey Antukh
parent dc18a6c3bc
commit 78d7fe3e10
26 changed files with 484 additions and 179 deletions

View file

@ -7,7 +7,9 @@
(ns app.main.ui.hooks
"A collection of general purpose react hooks."
(:require
[app.common.pages :as cp]
[app.main.data.shortcuts :as dsc]
[app.main.refs :as refs]
[app.main.store :as st]
[app.util.dom :as dom]
[app.util.dom.dnd :as dnd]
@ -235,3 +237,14 @@
(let [ret (effect-fn)]
(when (fn? ret) (ret)))
(mf/use-effect deps effect-fn)))
(defn with-focus-objects
([objects]
(let [focus (mf/deref refs/workspace-focus-selected)]
(with-focus-objects objects focus)))
([objects focus]
(let [objects (mf/use-memo
(mf/deps focus objects)
#(cp/focus-objects objects focus))]
objects)))