From b3e2604ce774131da6692d39cb0ed1b50f024653 Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Tue, 21 Jan 2025 14:10:55 +0000 Subject: [PATCH] feat: Dashboard welcome state (#4765) ## Description The state for when user first signs up and has no projects image ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file --- .../app/dashboard/dashboard.stories.tsx | 18 ++------- apps/builder/app/dashboard/dashboard.tsx | 38 ++++++++++++------- .../dashboard/projects/project-dialogs.tsx | 4 +- .../app/dashboard/projects/projects.tsx | 4 +- .../app/dashboard/templates/templates.tsx | 9 ++++- .../app/routes/_ui.dashboard._index.tsx | 9 ++++- .../app/routes/_ui.dashboard.templates.tsx | 4 ++ packages/dashboard/src/db/projects.ts | 27 +++++++++++++ packages/dashboard/src/trpc/project-router.ts | 18 ++++----- 9 files changed, 88 insertions(+), 43 deletions(-) diff --git a/apps/builder/app/dashboard/dashboard.stories.tsx b/apps/builder/app/dashboard/dashboard.stories.tsx index 0397552455..c6e26b1925 100644 --- a/apps/builder/app/dashboard/dashboard.stories.tsx +++ b/apps/builder/app/dashboard/dashboard.stories.tsx @@ -38,18 +38,6 @@ const userPlanFeatures: UserPlanFeatures = { maxDomainsAllowedPerUser: 1, }; -export const Empty: StoryFn = () => { - const router = createRouter( - - ); - return ; -}; - export const WithProjects: StoryFn = () => { const projects = [ { @@ -70,6 +58,7 @@ export const WithProjects: StoryFn = () => { const router = createRouter( = () => { }; export const WithTemplates: StoryFn = () => { - const projects = [ + const templates = [ { id: "0", createdAt: new Date().toString(), @@ -98,7 +87,8 @@ export const WithTemplates: StoryFn = () => { const router = createRouter( diff --git a/apps/builder/app/dashboard/dashboard.tsx b/apps/builder/app/dashboard/dashboard.tsx index e3dfc4c7ba..b1bfbfdffd 100644 --- a/apps/builder/app/dashboard/dashboard.tsx +++ b/apps/builder/app/dashboard/dashboard.tsx @@ -128,6 +128,7 @@ type DashboardProps = { user: User; projects?: Array; templates?: Array; + welcome: boolean; userPlanFeatures: UserPlanFeatures; publisherHost: string; projectToClone?: { @@ -141,6 +142,7 @@ export const Dashboard = ({ user, projects, templates, + welcome, userPlanFeatures, publisherHost, projectToClone, @@ -167,18 +169,28 @@ export const Dashboard = ({