mirror of
https://github.com/penpot/penpot.git
synced 2025-02-23 07:16:07 -05:00
Merge pull request #5869 from penpot/marina-empty-workspace-create-board-tool-default
🎉 Add AB test for empty workspace set board tool by default
This commit is contained in:
commit
c41aa56a60
2 changed files with 19 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns app.common.types.page
|
||||
(:refer-clojure :exclude [empty?])
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.point :as-alias gpt]
|
||||
|
@ -98,3 +99,8 @@
|
|||
(defn get-frame-flow
|
||||
[flows frame-id]
|
||||
(d/seek #(= (:starting-frame %) frame-id) (vals flows)))
|
||||
|
||||
(defn is-empty?
|
||||
"Check if page is empty or contains shapes"
|
||||
[page]
|
||||
(= 1 (count (:objects page))))
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
[app.common.types.components-list :as ctkl]
|
||||
[app.common.types.container :as ctn]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
|
@ -270,6 +271,15 @@
|
|||
(rx/of (dws/select-shapes frames-id)
|
||||
dwz/zoom-to-selected-shape)))))
|
||||
|
||||
(defn- select-frame-tool
|
||||
[file-id page-id]
|
||||
(ptk/reify ::select-frame-tool
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [page (dsh/lookup-page state file-id page-id)]
|
||||
(when (ctp/is-empty? page)
|
||||
(rx/of (dwd/select-for-drawing :frame)))))))
|
||||
|
||||
(defn- fetch-bundle
|
||||
"Multi-stage file bundle fetch coordinator"
|
||||
[file-id]
|
||||
|
@ -463,7 +473,9 @@
|
|||
(if-let [page (dsh/lookup-page state file-id page-id)]
|
||||
(rx/of (initialize-page* file-id page-id page)
|
||||
(dwth/watch-state-changes file-id page-id)
|
||||
(dwl/watch-component-changes))
|
||||
(dwl/watch-component-changes)
|
||||
(when (cf/external-feature-flag "boards-02" "test")
|
||||
(select-frame-tool file-id page-id)))
|
||||
(rx/of (dcm/go-to-workspace :file-id file-id ::rt/replace true))))))
|
||||
|
||||
(defn finalize-page
|
||||
|
|
Loading…
Add table
Reference in a new issue