Skip to content

Commit 03a46d3

Browse files
authored
Merge branch 'main' into fix/prevent-closed-stream-enqueue
2 parents 0967cad + 8977d25 commit 03a46d3

File tree

111 files changed

+2665
-1006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2665
-1006
lines changed

apps/webapp/app/assets/icons/ConnectionIcons.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,28 @@ export function DisconnectedIcon({ className }: { className?: string }) {
4646
</svg>
4747
);
4848
}
49+
50+
export function CheckingConnectionIcon({ className }: { className?: string }) {
51+
return (
52+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
53+
<rect
54+
x="0.5"
55+
y="-0.5"
56+
width="19"
57+
height="1"
58+
rx="0.5"
59+
transform="matrix(1 0 0 -1 1.99998 20)"
60+
stroke="#878C99"
61+
/>
62+
<path
63+
fillRule="evenodd"
64+
clipRule="evenodd"
65+
d="M18 6.5L6.00001 6.5C5.72387 6.5 5.50001 6.72386 5.50001 7L5.50001 15C5.50001 15.2761 5.72387 15.5 6.00001 15.5L18 15.5C18.2762 15.5 18.5 15.2761 18.5 15V7C18.5 6.72386 18.2762 6.5 18 6.5ZM6.00001 5C4.89545 5 4.00001 5.89543 4.00001 7L4.00001 15C4.00001 16.1046 4.89545 17 6.00001 17L18 17C19.1046 17 20 16.1046 20 15V7C20 5.89543 19.1046 5 18 5L6.00001 5Z"
66+
fill="#878C99"
67+
/>
68+
<circle cx="9" cy="11" r="1" fill="#878C99" />
69+
<circle cx="12" cy="11" r="1" fill="#878C99" />
70+
<circle cx="15" cy="11" r="1" fill="#878C99" />
71+
</svg>
72+
);
73+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export function PythonLogoIcon({ className }: { className?: string }) {
2+
return (
3+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<g clipPath="url(#clip0_16722_101857)">
5+
<path
6+
d="M11.9281 2C6.85063 2 7.1675 4.20188 7.1675 4.20188L7.17375 6.48313H12.0187V7.1675H5.24813C5.24813 7.1675 2 6.79875 2 11.9225C2 17.045 4.83563 16.8638 4.83563 16.8638H6.52813V14.4863C6.52813 14.4863 6.43687 11.6506 9.31875 11.6506H14.1237C14.1237 11.6506 16.8237 11.6944 16.8237 9.04125V4.65438C16.8237 4.65438 17.2338 2 11.9281 2ZM9.25625 3.53375C9.73813 3.53375 10.1281 3.92375 10.1281 4.40563C10.1281 4.8875 9.73813 5.2775 9.25625 5.2775C9.14171 5.27766 9.02826 5.25523 8.9224 5.21147C8.81655 5.16771 8.72037 5.10349 8.63937 5.0225C8.55838 4.94151 8.49417 4.84533 8.45041 4.73947C8.40665 4.63362 8.38421 4.52017 8.38438 4.40563C8.38438 3.92375 8.77438 3.53375 9.25625 3.53375Z"
7+
fill="#387EB8"
8+
/>
9+
<path
10+
d="M12.0719 21.9839C17.1494 21.9839 16.8325 19.782 16.8325 19.782L16.8263 17.5008H11.9813V16.8164H18.7513C18.7513 16.8164 22 17.1852 22 12.062C22 6.93892 19.1644 7.12079 19.1644 7.12079H17.4719V9.49767C17.4719 9.49767 17.5631 12.3333 14.6813 12.3333H9.87626C9.87626 12.3333 7.17626 12.2895 7.17626 14.9427V19.3295C7.17626 19.3295 6.76626 21.9839 12.0719 21.9839ZM14.7438 20.4502C14.6292 20.4503 14.5158 20.4279 14.4099 20.3841C14.3041 20.3404 14.2079 20.2762 14.1269 20.1952C14.0459 20.1142 13.9817 20.018 13.9379 19.9121C13.8942 19.8063 13.8717 19.6928 13.8719 19.5783C13.8719 19.097 14.2619 18.707 14.7438 18.707C15.2256 18.707 15.6156 19.0964 15.6156 19.5783C15.6156 20.0608 15.2256 20.4502 14.7438 20.4502Z"
11+
fill="#F4D441"
12+
/>
13+
</g>
14+
<defs>
15+
<clipPath id="clip0_16722_101857">
16+
<rect width="20" height="20" fill="white" transform="translate(2 2)" />
17+
</clipPath>
18+
</defs>
19+
</svg>
20+
);
21+
}

apps/webapp/app/components/BlankStatePanels.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export function HasNoTasksDev() {
5959
<InitCommandV3 />
6060
<Paragraph spacing>
6161
You'll notice a new folder in your project called{" "}
62-
<InlineCode variant="small">trigger</InlineCode>. We've added a very simple example task
63-
in here to help you get started.
62+
<InlineCode variant="small">trigger</InlineCode>. We've added a few simple example tasks
63+
in there to help you get started.
6464
</Paragraph>
6565
</StepContentContainer>
6666
<StepNumber stepNumber="2" title="Run the CLI 'dev' command" />
@@ -200,8 +200,7 @@ export function TestHasNoTasks() {
200200
accessory={
201201
<LinkButton
202202
to={v3EnvironmentPath(organization, project, environment)}
203-
variant="secondary/small"
204-
LeadingIcon={PlusIcon}
203+
variant="primary/small"
205204
>
206205
Create a task
207206
</LinkButton>
@@ -396,8 +395,7 @@ export function QueuesHasNoTasks() {
396395
accessory={
397396
<LinkButton
398397
to={v3EnvironmentPath(organization, project, environment)}
399-
variant="secondary/small"
400-
LeadingIcon={PlusIcon}
398+
variant="primary/small"
401399
>
402400
Create a task
403401
</LinkButton>

apps/webapp/app/components/DevPresence.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from "react";
2-
import { useDebounce } from "~/hooks/useDebounce";
32
import { useEnvironment } from "~/hooks/useEnvironment";
43
import { useEventSource } from "~/hooks/useEventSource";
54
import { useOrganization } from "~/hooks/useOrganizations";
65
import { useProject } from "~/hooks/useProject";
76

87
// Define Context types
98
type DevPresenceContextType = {
10-
lastSeen: Date | null;
11-
isConnected: boolean;
9+
isConnected: boolean | undefined;
1210
};
1311

1412
// Create Context with default values
1513
const DevPresenceContext = createContext<DevPresenceContextType>({
16-
lastSeen: null,
17-
isConnected: false,
14+
isConnected: undefined,
1815
});
1916

2017
// Provider component with enabled prop
@@ -30,50 +27,44 @@ export function DevPresenceProvider({ children, enabled = true }: DevPresencePro
3027

3128
// Only subscribe to event source if enabled is true
3229
const streamedEvents = useEventSource(
33-
`/resources/orgs/${organization.slug}/projects/${project.slug}/env/${environment.slug}/dev/presence`,
30+
`/resources/orgs/${organization.slug}/projects/${project.slug}/dev/presence`,
3431
{
3532
event: "presence",
3633
disabled: !enabled,
3734
}
3835
);
3936

40-
const [lastSeen, setLastSeen] = useState<Date | null>(null);
41-
42-
const debouncer = useDebounce((seen: Date | null) => {
43-
setLastSeen(seen);
44-
}, 3_000);
37+
const [isConnected, setIsConnected] = useState<boolean | undefined>(undefined);
4538

4639
useEffect(() => {
47-
// If disabled or no events, set lastSeen to null
40+
// If disabled or no events
4841
if (!enabled || streamedEvents === null) {
49-
debouncer(null);
42+
setIsConnected(undefined);
5043
return;
5144
}
5245

5346
try {
5447
const data = JSON.parse(streamedEvents) as any;
55-
if ("lastSeen" in data && data.lastSeen) {
48+
if ("isConnected" in data && data.isConnected) {
5649
try {
57-
const lastSeenDate = new Date(data.lastSeen);
58-
debouncer(lastSeenDate);
50+
setIsConnected(true);
5951
} catch (error) {
6052
console.log("DevPresence: Failed to parse lastSeen timestamp", { error });
61-
debouncer(null);
53+
setIsConnected(false);
6254
}
6355
} else {
64-
debouncer(null);
56+
setIsConnected(false);
6557
}
6658
} catch (error) {
6759
console.log("DevPresence: Failed to parse presence message", { error });
68-
debouncer(null);
60+
setIsConnected(false);
6961
}
7062
}, [streamedEvents, enabled]);
7163

7264
// Calculate isConnected and memoize the context value
7365
const contextValue = useMemo(() => {
74-
const isConnected = enabled && lastSeen !== null && lastSeen > new Date(Date.now() - 120_000);
75-
return { lastSeen, isConnected };
76-
}, [lastSeen, enabled]);
66+
return { isConnected };
67+
}, [isConnected, enabled]);
7768

7869
return <DevPresenceContext.Provider value={contextValue}>{children}</DevPresenceContext.Provider>;
7970
}

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import {
2020
import { useNavigation } from "@remix-run/react";
2121
import { useEffect, useRef, useState, type ReactNode } from "react";
2222
import simplur from "simplur";
23-
import { ConnectedIcon, DisconnectedIcon } from "~/assets/icons/ConnectionIcons";
23+
import {
24+
CheckingConnectionIcon,
25+
ConnectedIcon,
26+
DisconnectedIcon,
27+
} from "~/assets/icons/ConnectionIcons";
2428
import { RunsIconExtraSmall, RunsIconSmall } from "~/assets/icons/RunsIcon";
2529
import { TaskIconSmall } from "~/assets/icons/TaskIcon";
2630
import { Avatar } from "~/components/primitives/Avatar";
@@ -82,6 +86,7 @@ import { SideMenuHeader } from "./SideMenuHeader";
8286
import { SideMenuItem } from "./SideMenuItem";
8387
import { SideMenuSection } from "./SideMenuSection";
8488
import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon";
89+
import { Spinner } from "../primitives/Spinner";
8590

8691
type SideMenuUser = Pick<User, "email" | "admin"> & { isImpersonating: boolean };
8792
export type SideMenuProject = Pick<
@@ -532,7 +537,9 @@ export function DevConnection() {
532537
variant="minimal/small"
533538
className="aspect-square h-7 p-1"
534539
LeadingIcon={
535-
isConnected ? (
540+
isConnected === undefined ? (
541+
<CheckingConnectionIcon className="size-5" />
542+
) : isConnected ? (
536543
<ConnectedIcon className="size-5" />
537544
) : (
538545
<DisconnectedIcon className="size-5" />
@@ -543,24 +550,34 @@ export function DevConnection() {
543550
</div>
544551
</TooltipTrigger>
545552
<TooltipContent side="right" className={"text-xs"}>
546-
{isConnected ? "Your dev server is connected" : "Your dev server is not connected"}
553+
{isConnected === undefined
554+
? "Checking connection..."
555+
: isConnected
556+
? "Your dev server is connected"
557+
: "Your dev server is not connected"}
547558
</TooltipContent>
548559
</Tooltip>
549560
</TooltipProvider>
550561
<DialogContent>
551562
<DialogHeader>
552-
{isConnected ? "Your dev server is connected" : "Your dev server is not connected"}
563+
{isConnected === undefined
564+
? "Checking connection..."
565+
: isConnected
566+
? "Your dev server is connected"
567+
: "Your dev server is not connected"}
553568
</DialogHeader>
554569
<div className="mt-2 flex flex-col gap-3 px-2">
555570
<div className="flex flex-col items-center justify-center gap-6 px-6 py-10">
556571
<img
557-
src={isConnected ? connectedImage : disconnectedImage}
558-
alt={isConnected ? "Connected" : "Disconnected"}
572+
src={isConnected === true ? connectedImage : disconnectedImage}
573+
alt={isConnected === true ? "Connected" : "Disconnected"}
559574
width={282}
560575
height={45}
561576
/>
562577
<Paragraph variant="small" className={isConnected ? "text-success" : "text-error"}>
563-
{isConnected
578+
{isConnected === undefined
579+
? "Checking connection..."
580+
: isConnected
564581
? "Your local dev server is connected to Trigger.dev"
565582
: "Your local dev server is not connected to Trigger.dev"}
566583
</Paragraph>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ export function AppliedFilter({
3434
}: AppliedFilterProps) {
3535
const variantClassName = variants[variant];
3636
return (
37-
<div className={cn("flex items-center transition", variantClassName.box, className)}>
37+
<div
38+
className={cn(
39+
"flex items-center transition",
40+
variantClassName.box,
41+
!removable && "pr-2",
42+
className
43+
)}
44+
>
3845
<div className="flex items-center gap-0.5">
3946
<div className="text-text-dimmed">
4047
<span>{label}</span>:

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ type Size = keyof typeof sizes;
4242
const theme = {
4343
primary: {
4444
textColor:
45-
"text-charcoal-900 group-hover/button:text-charcoal-900 transition group-disabled/button:text-charcoal-900",
45+
"text-text-bright group-hover/button:text-white transition group-disabled/button:text-text-dimmed",
4646
button:
47-
"bg-primary group-hover/button:bg-apple-200 group-disabled/button:opacity-50 group-disabled/button:bg-primary group-disabled/button:pointer-events-none",
47+
"bg-indigo-600 border border-indigo-500 group-hover/button:bg-indigo-500 group-hover/button:border-indigo-400 group-disabled/button:opacity-50 group-disabled/button:bg-indigo-600 group-disabled/button:border-indigo-500 group-disabled/button:pointer-events-none",
4848
shortcut:
49-
"border-black/40 text-charcoal-900 group-hover/button:border-black/60 group-hover/button:text-charcoal-900",
50-
icon: "text-charcoal-900",
49+
"border-text-bright/40 text-text-bright group-hover/button:border-text-bright/60 group-hover/button:text-text-bright",
50+
icon: "text-text-bright",
5151
},
5252
secondary: {
5353
textColor: "text-text-bright transition group-disabled/button:text-text-dimmed/80",
5454
button:
55-
"bg-secondary group-hover/button:bg-charcoal-600 group-hover/button:border-charcoal-650 border border-charcoal-600 group-disabled/button:bg-secondary group-disabled/button:opacity-60 group-disabled/button:pointer-events-none",
55+
"bg-secondary group-hover/button:bg-charcoal-600 group-hover/button:border-charcoal-550 border border-charcoal-600 group-disabled/button:bg-secondary group-disabled/button:opacity-60 group-disabled/button:pointer-events-none",
5656
shortcut:
5757
"border-text-dimmed/40 text-text-dimmed group-hover/button:text-text-bright group-hover/button:border-text-dimmed",
5858
icon: "text-text-bright",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import { Button } from "./Buttons";
1010

1111
const variants = {
1212
small: {
13-
fieldStyles: "h-5 text-sm rounded-sm px-0.5",
13+
fieldStyles: "h-5 text-xs rounded-sm px-0.5",
1414
nowButtonVariant: "tertiary/small" as const,
1515
clearButtonVariant: "tertiary/small" as const,
1616
},
1717
medium: {
18-
fieldStyles: "h-7 text-base rounded px-1",
18+
fieldStyles: "h-7 text-sm rounded px-1",
1919
nowButtonVariant: "tertiary/medium" as const,
2020
clearButtonVariant: "minimal/medium" as const,
2121
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import * as Ariakit from "@ariakit/react";
2-
import { SelectProps as AriaSelectProps } from "@ariakit/react";
2+
import { type SelectProps as AriaSelectProps } from "@ariakit/react";
33
import { SelectValue } from "@ariakit/react-core/select/select-value";
44
import { Link } from "@remix-run/react";
55
import * as React from "react";
66
import { Fragment, useMemo, useState } from "react";
7-
import { ShortcutDefinition, useShortcutKeys } from "~/hooks/useShortcutKeys";
7+
import { type ShortcutDefinition, useShortcutKeys } from "~/hooks/useShortcutKeys";
88
import { cn } from "~/utils/cn";
99
import { ShortcutKey } from "./ShortcutKey";
1010
import { ChevronDown } from "lucide-react";
11-
import { MatchSorterOptions, matchSorter } from "match-sorter";
11+
import { type MatchSorterOptions, matchSorter } from "match-sorter";
1212

1313
const sizes = {
1414
small: {

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
import * as React from "react";
44
import * as SwitchPrimitives from "@radix-ui/react-switch";
55
import { cn } from "~/utils/cn";
6-
import { ShortcutDefinition, useShortcutKeys } from "~/hooks/useShortcutKeys";
6+
import { type ShortcutDefinition, useShortcutKeys } from "~/hooks/useShortcutKeys";
7+
8+
const small = {
9+
container:
10+
"flex items-center h-[1.5rem] gap-x-1.5 rounded hover:bg-tertiary pr-1 py-[0.1rem] pl-1.5 hover:disabled:bg-charcoal-700 transition focus-custom disabled:opacity-50 text-text-dimmed hover:text-text-bright disabled:hover:cursor-not-allowed hover:cursor-pointer disabled:hover:text-rose-500",
11+
root: "h-3 w-6",
12+
thumb: "size-2.5 data-[state=checked]:translate-x-2.5 data-[state=unchecked]:translate-x-0",
13+
text: "text-xs text-text-dimmed",
14+
};
715

816
const variations = {
917
large: {
@@ -12,12 +20,18 @@ const variations = {
1220
thumb: "size-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
1321
text: "text-sm text-text-dimmed",
1422
},
15-
small: {
16-
container:
17-
"flex items-center h-[1.5rem] gap-x-1.5 rounded hover:bg-tertiary disabled:hover:bg-transparent pr-1 py-[0.1rem] pl-1.5 transition focus-custom disabled:hover:text-charcoal-400 disabled:opacity-50 text-charcoal-400 hover:text-charcoal-200 disabled:hover:cursor-not-allowed hover:cursor-pointer",
18-
root: "h-3 w-6",
19-
thumb: "size-2.5 data-[state=checked]:translate-x-2.5 data-[state=unchecked]:translate-x-0",
20-
text: "text-xs text-text-dimmed",
23+
small,
24+
"tertiary/small": {
25+
container: small.container,
26+
root: cn(
27+
small.root,
28+
"group-data-[state=unchecked]:bg-charcoal-600 group-data-[state=unchecked]:group-hover:bg-charcoal-500/50"
29+
),
30+
thumb: small.thumb,
31+
text: cn(
32+
small.text,
33+
"transition group-hover:text-text-bright group-disabled:group-hover:text-text-dimmed"
34+
),
2135
},
2236
};
2337

@@ -53,7 +67,12 @@ export const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitives.
5367
ref={innerRef}
5468
>
5569
{label ? (
56-
<label className={cn("whitespace-nowrap", text)}>
70+
<label
71+
className={cn(
72+
"cursor-pointer whitespace-nowrap group-disabled:cursor-not-allowed",
73+
text
74+
)}
75+
>
5776
{typeof label === "string" ? <span>{label}</span> : label}
5877
</label>
5978
) : null}

0 commit comments

Comments
 (0)