-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathBlankStatePanels.tsx
More file actions
454 lines (434 loc) · 13.9 KB
/
BlankStatePanels.tsx
File metadata and controls
454 lines (434 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
import {
BeakerIcon,
BellAlertIcon,
BookOpenIcon,
ChatBubbleLeftRightIcon,
ClockIcon,
PlusIcon,
RectangleGroupIcon,
RectangleStackIcon,
ServerStackIcon,
Squares2X2Icon,
} from "@heroicons/react/20/solid";
import { useLocation } from "react-use";
import { TaskIcon } from "~/assets/icons/TaskIcon";
import { useEnvironment } from "~/hooks/useEnvironment";
import { useOrganization } from "~/hooks/useOrganizations";
import { useProject } from "~/hooks/useProject";
import { type MinimumEnvironment } from "~/presenters/SelectBestEnvironmentPresenter.server";
import {
docsPath,
v3EnvironmentPath,
v3EnvironmentVariablesPath,
v3NewProjectAlertPath,
v3NewSchedulePath,
} from "~/utils/pathBuilder";
import { InlineCode } from "./code/InlineCode";
import { environmentFullTitle } from "./environments/EnvironmentLabel";
import { Feedback } from "./Feedback";
import { EnvironmentSelector } from "./navigation/EnvironmentSelector";
import { Button, LinkButton } from "./primitives/Buttons";
import { Header1 } from "./primitives/Headers";
import { InfoPanel } from "./primitives/InfoPanel";
import { Paragraph } from "./primitives/Paragraph";
import { StepNumber } from "./primitives/StepNumber";
import { TextLink } from "./primitives/TextLink";
import { InitCommandV3, PackageManagerProvider, TriggerDevStepV3 } from "./SetupCommands";
import { StepContentContainer } from "./StepContentContainer";
import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon";
export function HasNoTasksDev() {
return (
<PackageManagerProvider>
<div>
<div className="mb-6 flex items-center justify-between border-b">
<Header1 spacing>Get setup in 3 minutes</Header1>
<div className="flex items-center gap-2">
<Feedback
button={
<Button variant="minimal/small" LeadingIcon={ChatBubbleLeftRightIcon}>
I'm stuck!
</Button>
}
defaultValue="help"
/>
</div>
</div>
<StepNumber stepNumber="1" title="Run the CLI 'init' command in an existing project" />
<StepContentContainer>
<InitCommandV3 />
<Paragraph spacing>
You'll notice a new folder in your project called{" "}
<InlineCode variant="small">trigger</InlineCode>. We've added a few simple example tasks
in there to help you get started.
</Paragraph>
</StepContentContainer>
<StepNumber stepNumber="2" title="Run the CLI 'dev' command" />
<StepContentContainer>
<TriggerDevStepV3 />
</StepContentContainer>
<StepNumber stepNumber="3" title="Waiting for tasks" displaySpinner />
<StepContentContainer>
<Paragraph>This page will automatically refresh.</Paragraph>
</StepContentContainer>
</div>
</PackageManagerProvider>
);
}
export function HasNoTasksDeployed({ environment }: { environment: MinimumEnvironment }) {
return (
<InfoPanel
title={`You don't have any deployed tasks in ${environmentFullTitle(environment)}`}
icon={TaskIcon}
iconClassName="text-tasks"
panelClassName="max-w-full"
accessory={
<LinkButton
to={docsPath("deployment/overview")}
variant="docs/small"
LeadingIcon={BookOpenIcon}
>
How to deploy tasks
</LinkButton>
}
>
<Paragraph spacing variant="small">
Run the <TextLink to={docsPath("deployment/overview")}>CLI deploy command</TextLink> to
deploy your tasks to the {environmentFullTitle(environment)} environment.
</Paragraph>
</InfoPanel>
);
}
export function SchedulesNoPossibleTaskPanel() {
return (
<InfoPanel
title="Create your first scheduled task"
icon={ClockIcon}
iconClassName="text-schedules"
panelClassName="max-w-full"
accessory={
<LinkButton
to={docsPath("v3/tasks-scheduled")}
variant="docs/small"
LeadingIcon={BookOpenIcon}
>
How to schedule tasks
</LinkButton>
}
>
<Paragraph spacing variant="small">
You have no scheduled tasks in your project. Before you can schedule a task you need to
create a <InlineCode>schedules.task</InlineCode>.
</Paragraph>
</InfoPanel>
);
}
export function SchedulesNoneAttached() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
const location = useLocation();
return (
<InfoPanel
title="Attach your first schedule"
icon={ClockIcon}
iconClassName="text-schedules"
panelClassName="max-w-full"
>
<Paragraph spacing variant="small">
Scheduled tasks will only run automatically if you connect a schedule to them, you can do
this in the dashboard or using the SDK.
</Paragraph>
<div className="flex gap-2">
<LinkButton
to={`${v3NewSchedulePath(organization, project, environment)}${location.search}`}
variant="secondary/medium"
LeadingIcon={RectangleGroupIcon}
className="inline-flex"
leadingIconClassName="text-blue-500"
>
Use the dashboard
</LinkButton>
<LinkButton
to={docsPath("v3/tasks-scheduled")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Use the SDK
</LinkButton>
</div>
</InfoPanel>
);
}
export function BatchesNone() {
return (
<InfoPanel
title="Triggering batches"
icon={Squares2X2Icon}
iconClassName="text-batches"
panelClassName="max-w-full"
accessory={
<LinkButton to={docsPath("triggering")} variant="docs/small" LeadingIcon={BookOpenIcon}>
How to trigger batches
</LinkButton>
}
>
<Paragraph spacing variant="small">
You have no batches in this environment. You can trigger batches from your backend or from
inside other tasks.
</Paragraph>
</InfoPanel>
);
}
export function TestHasNoTasks() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<InfoPanel
title="You don't have any tasks to test"
icon={BeakerIcon}
iconClassName="text-tests"
panelClassName="max-w-full"
accessory={
<LinkButton
to={v3EnvironmentPath(organization, project, environment)}
variant="primary/small"
>
Create a task
</LinkButton>
}
>
<Paragraph spacing variant="small">
Before testing a task, you must first create one. Follow the instructions on the{" "}
<TextLink to={v3EnvironmentPath(organization, project, environment)}>Tasks page</TextLink>{" "}
to create a task, then return here to test it.
</Paragraph>
</InfoPanel>
);
}
export function DeploymentsNone() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<InfoPanel
icon={ServerStackIcon}
iconClassName="text-deployments"
title="Deploy for the first time"
panelClassName="max-w-full"
>
<Paragraph spacing variant="small">
There are several ways to deploy your tasks. You can use the CLI, Continuous Integration
(like GitHub Actions), or an integration with a service like Netlify or Vercel. Make sure
you{" "}
<TextLink href={v3EnvironmentVariablesPath(organization, project, environment)}>
set your environment variables
</TextLink>{" "}
first.
</Paragraph>
<div className="flex gap-3">
<LinkButton
to={docsPath("v3/cli-deploy")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Deploy with the CLI
</LinkButton>
<LinkButton
to={docsPath("v3/github-actions")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Deploy with GitHub actions
</LinkButton>
</div>
</InfoPanel>
);
}
export function DeploymentsNoneDev() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<div className="space-y-8">
<InfoPanel
icon={ServerStackIcon}
iconClassName="text-deployments"
title="Deploying tasks"
panelClassName="max-w-full"
>
<Paragraph spacing variant="small">
This is the Development environment. When you're ready to deploy your tasks, switch to a
different environment.
</Paragraph>
<Paragraph spacing variant="small">
There are several ways to deploy your tasks. You can use the CLI, Continuous Integration
(like GitHub Actions), or an integration with a service like Netlify or Vercel. Make sure
you{" "}
<TextLink href={v3EnvironmentVariablesPath(organization, project, environment)}>
set your environment variables
</TextLink>{" "}
first.
</Paragraph>
<div className="flex gap-3">
<LinkButton
to={docsPath("v3/cli-deploy")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Deploy with the CLI
</LinkButton>
<LinkButton
to={docsPath("v3/github-actions")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Deploy with GitHub actions
</LinkButton>
</div>
</InfoPanel>
<SwitcherPanel />
</div>
);
}
export function AlertsNoneDev() {
return (
<div className="space-y-8">
<InfoPanel
icon={BellAlertIcon}
iconClassName="text-alerts"
title="Adding alerts"
panelClassName="max-w-full"
>
<Paragraph spacing variant="small">
You can get alerted when deployed runs fail.
</Paragraph>
<Paragraph spacing variant="small">
We don't support alerts in the Development environment. Switch to a deployed environment
to setup alerts.
</Paragraph>
<div className="flex gap-3">
<LinkButton
to={docsPath("troubleshooting-alerts")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
How to setup alerts
</LinkButton>
</div>
</InfoPanel>
<SwitcherPanel />
</div>
);
}
export function AlertsNoneDeployed() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<div className="space-y-8">
<InfoPanel
icon={BellAlertIcon}
iconClassName="text-alerts"
title="Adding alerts"
panelClassName="max-w-full"
>
<Paragraph spacing variant="small">
You can get alerted when deployed runs fail. We currently support sending Slack, Email,
and webhooks.
</Paragraph>
<div className="flex items-center justify-between gap-3">
<LinkButton
to={docsPath("troubleshooting-alerts")}
variant="docs/medium"
LeadingIcon={BookOpenIcon}
className="inline-flex"
>
Alerts docs
</LinkButton>
<LinkButton
to={v3NewProjectAlertPath(organization, project, environment)}
variant="primary/medium"
LeadingIcon={PlusIcon}
shortcut={{ key: "n" }}
>
New alert
</LinkButton>
</div>
</InfoPanel>
</div>
);
}
export function QueuesHasNoTasks() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<InfoPanel
title="You don't have any queues"
icon={RectangleStackIcon}
iconClassName="text-queues"
panelClassName="max-w-md"
accessory={
<LinkButton
to={v3EnvironmentPath(organization, project, environment)}
variant="primary/small"
>
Create a task
</LinkButton>
}
>
<Paragraph spacing variant="small">
Queues will appear here when you have created a task in this environment. Follow the
instructions on the{" "}
<TextLink to={v3EnvironmentPath(organization, project, environment)}>Tasks page</TextLink>{" "}
to create a task, then return here to see its queue.
</Paragraph>
</InfoPanel>
);
}
export function NoWaitpointTokens() {
return (
<InfoPanel
title="You don't have any waitpoint tokens"
icon={WaitpointTokenIcon}
iconClassName="text-sky-500"
panelClassName="max-w-md"
accessory={
<LinkButton to={docsPath("wait-for-token")} variant="docs/small" LeadingIcon={BookOpenIcon}>
Waitpoint docs
</LinkButton>
}
>
<Paragraph spacing variant="small">
Waitpoint tokens pause task runs until you complete the token. They're commonly used for
approval workflows and other scenarios where you need to wait for external confirmation,
such as human-in-the-loop processes.
</Paragraph>
</InfoPanel>
);
}
function SwitcherPanel() {
const organization = useOrganization();
const project = useProject();
const environment = useEnvironment();
return (
<div className="flex items-center rounded-md border border-grid-bright bg-background-bright p-3">
<Paragraph variant="small" className="grow">
Switch to a deployed environment
</Paragraph>
<EnvironmentSelector
organization={organization}
project={project}
environment={environment}
className="w-auto grow-0 rounded-sm bg-grid-bright"
/>
</div>
);
}