Skip to content

Commit a73fb65

Browse files
committed
Unified the blank state panels and improved some copy in them
1 parent 412325b commit a73fb65

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

apps/webapp/app/components/BlankStatePanels.tsx

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
ServerStackIcon,
1111
Squares2X2Icon,
1212
} from "@heroicons/react/20/solid";
13+
import { useLocation } from "react-use";
1314
import { TaskIcon } from "~/assets/icons/TaskIcon";
15+
import { useEnvironment } from "~/hooks/useEnvironment";
16+
import { useOrganization } from "~/hooks/useOrganizations";
17+
import { useProject } from "~/hooks/useProject";
1418
import { type MinimumEnvironment } from "~/presenters/SelectBestEnvironmentPresenter.server";
1519
import {
1620
docsPath,
@@ -22,20 +26,15 @@ import {
2226
import { InlineCode } from "./code/InlineCode";
2327
import { environmentFullTitle } from "./environments/EnvironmentLabel";
2428
import { Feedback } from "./Feedback";
29+
import { EnvironmentSelector } from "./navigation/EnvironmentSelector";
2530
import { Button, LinkButton } from "./primitives/Buttons";
2631
import { Header1 } from "./primitives/Headers";
2732
import { InfoPanel } from "./primitives/InfoPanel";
2833
import { Paragraph } from "./primitives/Paragraph";
2934
import { StepNumber } from "./primitives/StepNumber";
35+
import { TextLink } from "./primitives/TextLink";
3036
import { InitCommandV3, PackageManagerProvider, TriggerDevStepV3 } from "./SetupCommands";
3137
import { StepContentContainer } from "./StepContentContainer";
32-
import { useLocation } from "react-use";
33-
import { useEnvironment } from "~/hooks/useEnvironment";
34-
import { useOrganization } from "~/hooks/useOrganizations";
35-
import { useProject } from "~/hooks/useProject";
36-
import { TextLink } from "./primitives/TextLink";
37-
import { EnvironmentSelector } from "./navigation/EnvironmentSelector";
38-
import { Pi } from "lucide-react";
3938

4039
export function HasNoTasksDev() {
4140
return (
@@ -104,18 +103,15 @@ export function SchedulesNoPossibleTaskPanel() {
104103
icon={ClockIcon}
105104
iconClassName="text-sun-500"
106105
panelClassName="max-w-full"
106+
to={docsPath("v3/tasks-scheduled")}
107+
buttonLabel="How to schedule tasks"
108+
buttonVariant="docs/small"
109+
buttonLeadingIcon={BookOpenIcon}
107110
>
108111
<Paragraph spacing variant="small">
109112
You have no scheduled tasks in your project. Before you can schedule a task you need to
110113
create a <InlineCode>schedules.task</InlineCode>.
111114
</Paragraph>
112-
<LinkButton
113-
to={docsPath("v3/tasks-scheduled")}
114-
variant="docs/medium"
115-
LeadingIcon={BookOpenIcon}
116-
>
117-
View the docs
118-
</LinkButton>
119115
</InfoPanel>
120116
);
121117
}
@@ -166,14 +162,15 @@ export function BatchesNone() {
166162
icon={Squares2X2Icon}
167163
iconClassName="text-blue-500"
168164
panelClassName="max-w-full"
165+
to={docsPath("triggering")}
166+
buttonLabel="How to trigger batches"
167+
buttonVariant="docs/small"
168+
buttonLeadingIcon={BookOpenIcon}
169169
>
170170
<Paragraph spacing variant="small">
171171
You have no batches in this environment. You can trigger batches from your backend or from
172172
inside other tasks.
173173
</Paragraph>
174-
<LinkButton to={docsPath("triggering")} variant="docs/medium" LeadingIcon={BookOpenIcon}>
175-
How to trigger batches
176-
</LinkButton>
177174
</InfoPanel>
178175
);
179176
}
@@ -182,23 +179,20 @@ export function TestHasNoTasks() {
182179
const organization = useOrganization();
183180
const project = useProject();
184181
const environment = useEnvironment();
185-
186182
return (
187183
<InfoPanel
188-
title="No tasks to test"
184+
title="You don't have any tasks to test"
189185
icon={BeakerIcon}
190186
iconClassName="text-lime-500"
191187
panelClassName="max-w-full"
188+
to={v3EnvironmentPath(organization, project, environment)}
189+
buttonLabel="Create a task"
192190
>
193191
<Paragraph spacing variant="small">
194-
You have no tasks in this environment.
192+
Before testing a task, you must first create one. Follow the instructions on the{" "}
193+
<TextLink to={v3EnvironmentPath(organization, project, environment)}>Tasks page</TextLink>{" "}
194+
to create a task, then return here to test it.
195195
</Paragraph>
196-
<LinkButton
197-
to={v3EnvironmentPath(organization, project, environment)}
198-
variant="tertiary/medium"
199-
>
200-
Add tasks
201-
</LinkButton>
202196
</InfoPanel>
203197
);
204198
}
@@ -376,20 +370,19 @@ export function QueuesHasNoTasks() {
376370

377371
return (
378372
<InfoPanel
379-
title="You have no queues"
373+
title="You don't have any queues"
380374
icon={RectangleStackIcon}
381375
iconClassName="text-blue-500"
382-
panelClassName="max-w-full"
376+
panelClassName="max-w-md"
377+
to={v3EnvironmentPath(organization, project, environment)}
378+
buttonLabel="Create a task"
383379
>
384380
<Paragraph spacing variant="small">
385-
This means you haven't got any tasks yet in this environment.
381+
Queues will appear here when you have created a task in this environment. Follow the
382+
instructions on the{" "}
383+
<TextLink to={v3EnvironmentPath(organization, project, environment)}>Tasks page</TextLink>{" "}
384+
to create a task, then return here to see its queue.
386385
</Paragraph>
387-
<LinkButton
388-
to={v3EnvironmentPath(organization, project, environment)}
389-
variant="tertiary/medium"
390-
>
391-
Add tasks
392-
</LinkButton>
393386
</InfoPanel>
394387
);
395388
}

apps/webapp/app/components/primitives/InfoPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type Props = {
2222
children: React.ReactNode;
2323
to?: string;
2424
buttonLabel?: string;
25+
buttonVariant?: React.ComponentProps<typeof LinkButton>["variant"];
26+
buttonLeadingIcon?: React.ComponentProps<typeof LinkButton>["LeadingIcon"];
2527
icon: React.ComponentType<any>;
2628
iconClassName?: string;
2729
variant?: InfoPanelVariant;
@@ -33,6 +35,8 @@ export function InfoPanel({
3335
children,
3436
to,
3537
buttonLabel,
38+
buttonVariant = "secondary/small",
39+
buttonLeadingIcon,
3640
icon,
3741
iconClassName,
3842
variant = "info",
@@ -54,7 +58,7 @@ export function InfoPanel({
5458
<Icon className={cn("size-5", iconClassName)} />
5559

5660
{to && (
57-
<LinkButton to={to} variant="secondary/small">
61+
<LinkButton to={to} variant={buttonVariant} LeadingIcon={buttonLeadingIcon}>
5862
{buttonLabel}
5963
</LinkButton>
6064
)}

0 commit comments

Comments
 (0)