Skip to content

Commit c0d2ebf

Browse files
authored
feat: Remove starter templates, add welcome screen with guide and social links (#5722)
1 parent fc70898 commit c0d2ebf

19 files changed

Lines changed: 337 additions & 307 deletions

File tree

apps/builder/app/dashboard/dashboard.test.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,24 @@ const { getView } = __testing__;
55

66
describe("getView", () => {
77
test("returns 'search' for search path", () => {
8-
expect(getView("/dashboard/search", true, true)).toBe("search");
9-
expect(getView("/dashboard/search", false, true)).toBe("search");
8+
expect(getView("/dashboard/search", true, false)).toBe("search");
9+
expect(getView("/dashboard/search", false, false)).toBe("search");
1010
});
1111

12-
test("returns 'welcome' when no projects on default workspace", () => {
13-
expect(getView("/dashboard", false, true)).toBe("welcome");
14-
expect(getView("/dashboard/templates", false, true)).toBe("welcome");
12+
test("returns 'welcome' when no projects and workspace not suspended", () => {
13+
expect(getView("/dashboard", false, false)).toBe("welcome");
1514
});
1615

17-
test("returns 'projects' when no projects on non-default workspace", () => {
18-
// Non-default workspaces should never show the welcome onboarding page
19-
expect(getView("/dashboard", false, false)).toBe("projects");
16+
test("returns 'projects' when workspace is suspended with no projects", () => {
17+
expect(getView("/dashboard", false, true)).toBe("projects");
2018
});
2119

22-
test("returns 'templates' on non-default workspace with no projects", () => {
23-
expect(getView("/dashboard/templates", false, false)).toBe("templates");
24-
});
25-
26-
test("returns 'templates' for templates path with projects", () => {
27-
expect(getView("/dashboard/templates", true, true)).toBe("templates");
28-
});
29-
30-
test("returns 'projects' for dashboard root with projects", () => {
20+
test("returns 'projects' when there are projects", () => {
21+
expect(getView("/dashboard", true, false)).toBe("projects");
3122
expect(getView("/dashboard", true, true)).toBe("projects");
3223
});
3324

3425
test("returns 'projects' for unknown paths with projects", () => {
35-
expect(getView("/dashboard/unknown", true, true)).toBe("projects");
36-
});
37-
38-
test("search takes priority over welcome", () => {
39-
// Even with no projects, search view should show
40-
expect(getView("/dashboard/search", false, true)).toBe("search");
26+
expect(getView("/dashboard/unknown", true, false)).toBe("projects");
4127
});
4228
});

apps/builder/app/dashboard/dashboard.tsx

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
Grid,
1818
IconButton,
1919
} from "@webstudio-is/design-system";
20-
import { BodyIcon, ExtensionIcon } from "@webstudio-is/icons";
20+
import { BodyIcon } from "@webstudio-is/icons";
2121
import {
2222
NavLink,
2323
useLocation,
@@ -33,10 +33,9 @@ import { dashboardPath } from "~/shared/router-utils";
3333
import { CollapsibleSection } from "~/builder/shared/collapsible-section";
3434
import { ProfileMenu } from "./profile-menu";
3535
import { Projects } from "./projects/projects";
36-
import { Templates } from "./templates/templates";
3736
import { Welcome } from "./welcome/welcome";
3837
import { Header } from "./shared/layout";
39-
import { help } from "~/shared/help";
38+
import { help, socialLinks } from "~/shared/help";
4039
import { SearchResults } from "./search/search-results";
4140
import type { DashboardData } from "./shared/types";
4241
import { Search } from "./search/search-field";
@@ -194,22 +193,16 @@ export const DashboardSetup = ({ data }: { data: DashboardData }) => {
194193
const getView = (
195194
pathname: string,
196195
hasProjects: boolean,
197-
isDefaultWorkspace: boolean
196+
isWorkspaceSuspended: boolean
198197
) => {
199198
if (pathname === dashboardPath("search")) {
200199
return "search";
201200
}
202201

203-
// Only show the onboarding welcome page on the default workspace
204-
// when the user has no projects yet. Non-default workspaces that are
205-
// empty should show the normal (empty) projects view.
206-
if (hasProjects === false && isDefaultWorkspace) {
202+
if (hasProjects === false && isWorkspaceSuspended === false) {
207203
return "welcome";
208204
}
209205

210-
if (pathname === dashboardPath("templates")) {
211-
return "templates";
212-
}
213206
return "projects";
214207
};
215208

@@ -229,7 +222,6 @@ export const Dashboard = () => {
229222
publisherHost,
230223
projectToClone,
231224
projects,
232-
templates,
233225
workspaces,
234226
currentWorkspaceId,
235227
} = data;
@@ -243,38 +235,21 @@ export const Dashboard = () => {
243235
}
244236

245237
const isWorkspaceSuspended = isDowngradedForMember(currentWorkspace);
246-
const hasProjects = projects.length > 0 || isWorkspaceSuspended;
247-
const isDefaultWorkspace =
248-
currentWorkspaceId === undefined ||
249-
workspaces?.find((w) => w.id === currentWorkspaceId)?.isDefault === true;
250-
const view = getView(location.pathname, hasProjects, isDefaultWorkspace);
238+
const hasProjects = projects.length > 0;
239+
const view = getView(location.pathname, hasProjects, isWorkspaceSuspended);
251240

252241
const showWorkspaceSelector =
253242
workspaces !== undefined &&
254243
workspaces.length > 0 &&
255244
currentWorkspaceId !== undefined;
256245

257-
const navItems =
258-
view === "welcome"
259-
? [
260-
{
261-
to: dashboardPath(),
262-
prefix: <ExtensionIcon />,
263-
children: "Welcome",
264-
},
265-
]
266-
: [
267-
{
268-
to: dashboardPath("projects"),
269-
prefix: <BodyIcon />,
270-
children: "Projects",
271-
},
272-
{
273-
to: dashboardPath("templates"),
274-
prefix: <ExtensionIcon />,
275-
children: "Starter templates",
276-
},
277-
];
246+
const navItems = [
247+
{
248+
to: dashboardPath("projects"),
249+
prefix: <BodyIcon />,
250+
children: "Projects",
251+
},
252+
];
278253

279254
return (
280255
<TooltipProvider>
@@ -360,6 +335,29 @@ export const Dashboard = () => {
360335
children: item.label,
361336
}))}
362337
/>
338+
<Flex
339+
align="center"
340+
gap="3"
341+
css={{
342+
paddingInline: theme.panel.paddingInline,
343+
paddingBlock: theme.spacing[5],
344+
}}
345+
>
346+
<Text variant="labels" color="subtle">
347+
Follow us:
348+
</Text>
349+
{socialLinks.map(({ label, url, icon }) => (
350+
<Link
351+
key={url}
352+
href={url}
353+
target="_blank"
354+
color="subtle"
355+
aria-label={label}
356+
>
357+
{icon}
358+
</Link>
359+
))}
360+
</Flex>
363361
</CollapsibleSection>
364362
</Grid>
365363
{view === "projects" && (
@@ -372,17 +370,8 @@ export const Dashboard = () => {
372370
isWorkspaceSuspended={isWorkspaceSuspended}
373371
/>
374372
)}
375-
{view === "templates" && (
376-
<Templates
377-
projects={templates}
378-
currentWorkspaceId={currentWorkspaceId}
379-
/>
380-
)}
381373
{view === "welcome" && (
382-
<Welcome
383-
projects={templates}
384-
currentWorkspaceId={currentWorkspaceId}
385-
/>
374+
<Welcome currentWorkspaceId={currentWorkspaceId} />
386375
)}
387376
{view === "search" && <SearchResults {...data} />}
388377
</Flex>

apps/builder/app/dashboard/projects/projects.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
ToggleGroupButton,
1111
PanelBanner,
1212
panelBannerIconColor,
13+
Link,
14+
buttonStyle,
1315
} from "@webstudio-is/design-system";
1416
import { RepeatGridIcon, ListViewIcon } from "@webstudio-is/icons";
1517
import type { DashboardProject } from "@webstudio-is/dashboard";
@@ -145,6 +147,15 @@ export const Projects = (props: ProjectsProps) => {
145147
</ToggleGroupButton>
146148
</ToggleGroup>
147149
<SortSelect value={sortState} onValueChange={handleSortChange} />
150+
<Link
151+
className={buttonStyle({ color: "dark" })}
152+
underline="none"
153+
href="https://webstudio.is/marketplace/templates/"
154+
target="_blank"
155+
color="contrast"
156+
>
157+
Use template
158+
</Link>
148159
{permissions.canCreateProject && (
149160
<CreateProject workspaceId={props.currentWorkspaceId} />
150161
)}

apps/builder/app/dashboard/search/search-results.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,37 @@
11
import { useMemo } from "react";
22
import { matchSorter } from "match-sorter";
33
import { useSearchParams } from "react-router-dom";
4-
import { Flex, Separator, Text, theme } from "@webstudio-is/design-system";
4+
import { Flex, Text, theme } from "@webstudio-is/design-system";
55
import type { DashboardProject } from "@webstudio-is/dashboard";
66
import { ProjectsGrid } from "../projects/projects";
77
import { Header, Main } from "../shared/layout";
88
import type { DashboardData } from "../shared/types";
99
import { NothingFound } from "./nothing-found";
10-
import { TemplatesGrid } from "../templates/templates";
1110

1211
type SearchResults = {
1312
projects: Array<DashboardProject>;
14-
templates: Array<DashboardProject>;
1513
};
1614

1715
const initialSearchResults: SearchResults = {
18-
templates: [],
1916
projects: [],
2017
} as const;
2118

2219
export const SearchResults = (props: DashboardData) => {
2320
const [searchParams] = useSearchParams();
24-
const { projects, templates, publisherHost } = props;
21+
const { projects, publisherHost } = props;
2522
const search = searchParams.get("q");
2623

2724
const results = useMemo(() => {
28-
if (!search || !projects || !templates) {
25+
if (!search || !projects) {
2926
return initialSearchResults;
3027
}
3128
const keys = ["title", "domain"];
3229
return {
3330
projects: matchSorter(projects, search, { keys }),
34-
templates: matchSorter(templates, search, { keys }),
3531
};
36-
}, [projects, templates, search]);
32+
}, [projects, search]);
3733

38-
const nothingFound =
39-
results.projects.length === 0 && results.templates.length === 0;
34+
const nothingFound = results.projects.length === 0;
4035

4136
return (
4237
<Main>
@@ -66,15 +61,6 @@ export const SearchResults = (props: DashboardData) => {
6661
/>
6762
</>
6863
)}
69-
{results.templates.length > 0 && (
70-
<>
71-
<Separator />
72-
<Text variant="brandSectionTitle" as="h2">
73-
Templates
74-
</Text>
75-
<TemplatesGrid projects={results.templates} />
76-
</>
77-
)}
7864
</Flex>
7965
</Main>
8066
);

apps/builder/app/dashboard/shared/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { Notifications } from "~/shared/polly/types";
77
export type DashboardData = {
88
user: User;
99
projects: Array<DashboardProject>;
10-
templates: Array<DashboardProject>;
1110
planFeatures: PlanFeatures;
1211
purchases: Array<Purchase>;
1312
publisherHost: string;

apps/builder/app/dashboard/templates/template-card.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)