MCPcopy Index your code
hub / github.com/coder/coder / WorkspacesEmpty

Function WorkspacesEmpty

site/src/pages/WorkspacesPage/WorkspacesEmpty.tsx:15–111  ·  view source on GitHub ↗
({
	isUsingFilter,
	templates,
	canCreateTemplate,
})

Source from the content-addressed store, hash-verified

13}
14
15export const WorkspacesEmpty: FC<WorkspacesEmptyProps> = ({
16 isUsingFilter,
17 templates,
18 canCreateTemplate,
19}) => {
20 const getLink = useLinks();
21
22 const totalFeaturedTemplates = 6;
23 const featuredTemplates = templates?.slice(0, totalFeaturedTemplates);
24 const defaultTitle = "Create a workspace";
25 const defaultMessage =
26 "A workspace is your personal, customizable development environment.";
27 const defaultImage = (
28 <div className="max-w-[50%] h-[272px] overflow-hidden mt-12 opacity-85">
29 <img src="/featured/workspaces.webp" alt="" className="max-w-full" />
30 </div>
31 );
32
33 if (isUsingFilter) {
34 return <EmptyState message="No results matched your search" />;
35 }
36
37 if (templates && templates.length === 0 && canCreateTemplate) {
38 return (
39 <EmptyState
40 message={defaultTitle}
41 description={`${defaultMessage} To create a workspace, you first need to create a template.`}
42 cta={
43 <Button asChild>
44 <Link to="/templates">Go to templates</Link>
45 </Button>
46 }
47 className="pb-0"
48 image={defaultImage}
49 />
50 );
51 }
52
53 if (templates && templates.length === 0 && !canCreateTemplate) {
54 return (
55 <EmptyState
56 message={defaultTitle}
57 description={`${defaultMessage} There are no templates available, but you will see them here once your admin adds them.`}
58 className="pb-0"
59 image={defaultImage}
60 />
61 );
62 }
63
64 return (
65 <EmptyState
66 message={defaultTitle}
67 description={`${defaultMessage} Select one template below to start.`}
68 cta={
69 <div>
70 <div className="flex flex-wrap gap-4 mb-6 justify-center max-w-[800px]">
71 {featuredTemplates?.map((t) => (
72 <Link

Callers

nothing calls this directly

Calls 2

useLinksFunction · 0.90
linkToTemplateFunction · 0.90

Tested by

no test coverage detected