From 81658c90d111281e4f944d1c80165d3d4a5374fa Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 23 Jun 2023 12:33:34 +0200 Subject: [PATCH] :sparkles: Add the ability to disable dashboard templates section --- CHANGES.md | 1 + frontend/src/app/config.cljs | 1 + frontend/src/app/main/ui/dashboard.cljs | 24 +++++++++++-------- .../src/app/main/ui/dashboard/projects.cljs | 7 ++++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f0a812b249..9b9b326f1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - Improve dashboard performance related to thumbnails; now the thumbnails are rendered as bitmap images. - Add the ability to disable google fonts provider with the `disable-google-fonts-provider` flag +- Add the ability to disable dashboard templates section with the `disable-dashboard-templates-section` flag ### :bug: Bugs fixed diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index 4e3bda7cef..704ac51b86 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -60,6 +60,7 @@ (def default-flags [:enable-newsletter-subscription + :enable-dashboard-templates-section :enable-google-fonts-provider]) (defn- parse-flags diff --git a/frontend/src/app/main/ui/dashboard.cljs b/frontend/src/app/main/ui/dashboard.cljs index 881928a88d..5df57f6603 100644 --- a/frontend/src/app/main/ui/dashboard.cljs +++ b/frontend/src/app/main/ui/dashboard.cljs @@ -9,6 +9,7 @@ [app.common.data :as d] [app.common.math :as mth] [app.common.spec :as us] + [app.config :as cf] [app.main.data.dashboard :as dd] [app.main.data.dashboard.shortcuts :as sc] [app.main.data.events :as ev] @@ -259,11 +260,13 @@ :projects projects :profile profile :default-project-id default-project-id}] - [:& templates-section {:profile profile - :project project - :default-project-id default-project-id - :team team - :content-width @content-width}]] + + (when (contains? cf/flags :dashboard-templates-section) + [:& templates-section {:profile profile + :project project + :default-project-id default-project-id + :team team + :content-width @content-width}])] :dashboard-fonts [:& fonts-page {:team team}] @@ -275,11 +278,12 @@ (when project [:* [:& files-section {:team team :project project}] - [:& templates-section {:profile profile - :project project - :default-project-id default-project-id - :team team - :content-width @content-width}]]) + (when (contains? cf/flags :dashboard-templates-section) + [:& templates-section {:profile profile + :project project + :default-project-id default-project-id + :team team + :content-width @content-width}])]) :dashboard-search [:& search-page {:team team diff --git a/frontend/src/app/main/ui/dashboard/projects.cljs b/frontend/src/app/main/ui/dashboard/projects.cljs index 95a9648db6..eca9a2342e 100644 --- a/frontend/src/app/main/ui/dashboard/projects.cljs +++ b/frontend/src/app/main/ui/dashboard/projects.cljs @@ -9,6 +9,7 @@ [app.common.data :as d] [app.common.geom.point :as gpt] [app.common.math :as mth] + [app.config :as cf] [app.main.data.dashboard :as dd] [app.main.data.events :as ev] [app.main.data.messages :as msg] @@ -195,7 +196,7 @@ on-menu-click (mf/use-fn (fn [event] - (dom/prevent-default event) + (dom/prevent-default event) (let [client-position (dom/get-client-position event) position (if (and (nil? (:y client-position)) (nil? (:x client-position))) @@ -414,7 +415,9 @@ (when team-hero? [:& team-hero {:team team :close-fn close-banner}]) - (when (or (not tutorial-viewed?) (not walkthrough-viewed?)) + (when (and (contains? cf/flags :dashboard-templates-section) + (or (not tutorial-viewed?) + (not walkthrough-viewed?))) [:div.hero-projects (when (and (not tutorial-viewed?) (:is-default team)) [:& tutorial-project