Skip to content

Commit c2a9267

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: tweak projects empty state (#41524)
GitOrigin-RevId: ca2e9c3f49b0faff9f02ce00fda2bb4c9b30d4ea
1 parent 0b97784 commit c2a9267

File tree

2 files changed

+42
-31
lines changed

2 files changed

+42
-31
lines changed

npm-packages/dashboard-common/src/elements/EmptySection.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function EmptySection({
1313
learnMoreButton,
1414
sheet = true,
1515
}: {
16-
Icon: React.FunctionComponent<{ className: string | undefined }>;
16+
Icon?: React.FunctionComponent<{ className: string | undefined }>;
1717
color?: "yellow" | "red" | "purple" | "green" | "none";
1818
header: string;
1919
body: React.ReactNode;
@@ -26,20 +26,22 @@ export function EmptySection({
2626
return (
2727
<Parent className="size-full" padding={sheet ? false : undefined}>
2828
<div className="flex h-full animate-fadeInFromLoading flex-col items-center justify-center p-4 text-center">
29-
<div
30-
className={cn(
31-
"mb-4 flex aspect-square h-[2.625rem] shrink-0 items-center justify-center rounded-lg bg-util-accent bg-gradient-to-tr shadow-md",
32-
color === "yellow" && "from-yellow-200 to-util-brand-yellow",
33-
color === "red" &&
34-
// eslint-disable-next-line no-restricted-syntax
35-
"from-red-300 to-util-brand-red",
36-
color === "purple" && "from-purple-200 to-util-brand-purple",
37-
color === "green" && "from-util-success to-util-success",
38-
color === "none" && "bg-transparent shadow-none",
39-
)}
40-
>
41-
<Icon className="h-6 w-6 text-white" />
42-
</div>
29+
{Icon && (
30+
<div
31+
className={cn(
32+
"mb-4 flex aspect-square h-[2.625rem] shrink-0 items-center justify-center rounded-lg bg-util-accent bg-gradient-to-tr shadow-md",
33+
color === "yellow" && "from-yellow-200 to-util-brand-yellow",
34+
color === "red" &&
35+
// eslint-disable-next-line no-restricted-syntax
36+
"from-red-300 to-util-brand-red",
37+
color === "purple" && "from-purple-200 to-util-brand-purple",
38+
color === "green" && "from-util-success to-util-success",
39+
color === "none" && "bg-transparent shadow-none",
40+
)}
41+
>
42+
<Icon className="h-6 w-6 text-white" />
43+
</div>
44+
)}
4345
<h2 className="mx-2 mb-2">{header}</h2>
4446

4547
<p className="mb-2 max-w-prose text-balance text-content-tertiary">

npm-packages/dashboard/src/pages/t/[team]/index.tsx

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
2+
ExternalLinkIcon,
23
GridIcon,
34
ListBulletIcon,
45
PlusIcon,
5-
RocketIcon,
66
} from "@radix-ui/react-icons";
77
import { Button } from "@ui/Button";
88
import { Callout } from "@ui/Callout";
@@ -24,6 +24,7 @@ import { useState, useEffect } from "react";
2424
import { cn } from "@ui/cn";
2525
import { PaginationControls } from "elements/PaginationControls";
2626
import { usePagination } from "hooks/usePagination";
27+
import { EmptySection } from "@common/elements/EmptySection";
2728

2829
export { getServerSideProps } from "lib/ssr";
2930

@@ -173,7 +174,7 @@ function ProjectGrid({ projects }: { projects: ProjectDetails[] }) {
173174
href="https://docs.convex.dev/tutorial"
174175
size="sm"
175176
target="_blank"
176-
icon={<RocketIcon />}
177+
icon={<ExternalLinkIcon />}
177178
>
178179
Start Tutorial
179180
</Button>
@@ -192,20 +193,28 @@ function ProjectGrid({ projects }: { projects: ProjectDetails[] }) {
192193
</div>
193194
)}
194195
{projects.length === 0 && (
195-
<div className="mt-8 mb-24 flex w-full animate-fadeInFromLoading flex-col items-center justify-center gap-6">
196-
<h3>Welcome to Convex!</h3>
197-
<p>Get started by following the tutorial.</p>
198-
199-
<Button
200-
size="lg"
201-
href="https://docs.convex.dev/tutorial"
202-
target="_blank"
203-
className="gap-3 text-base"
204-
>
205-
<RocketIcon className="h-8 w-8 text-white" />
206-
Start Tutorial
207-
</Button>
208-
</div>
196+
<EmptySection
197+
header="Welcome to Convex!"
198+
sheet={false}
199+
body={
200+
<>
201+
<p className="text-sm">
202+
This team doesn't have an projects yet.{" "}
203+
</p>
204+
<p className="text-sm">Get started by following the tutorial.</p>
205+
</>
206+
}
207+
action={
208+
<Button
209+
href="https://docs.convex.dev/tutorial"
210+
target="_blank"
211+
icon={<ExternalLinkIcon />}
212+
className="mt-2"
213+
>
214+
Start Tutorial
215+
</Button>
216+
}
217+
/>
209218
)}
210219
<div
211220
className={cn(

0 commit comments

Comments
 (0)