Skip to content

Commit fc4a57f

Browse files
alexluongclaude
andcommitted
feat: rename Delivery to Attempt in UI components
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2ef43d2 commit fc4a57f

File tree

6 files changed

+104
-104
lines changed

6 files changed

+104
-104
lines changed

internal/portal/src/common/RetryDeliveryButton/RetryDeliveryButton.tsx renamed to internal/portal/src/common/RetryAttemptButton/RetryAttemptButton.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { ReplayIcon } from "../Icons";
44
import { showToast } from "../Toast/Toast";
55
import { ApiContext, formatError } from "../../app";
66

7-
interface RetryDeliveryButtonProps {
8-
deliveryId: string;
7+
interface RetryAttemptButtonProps {
8+
attemptId: string;
99
disabled: boolean;
1010
loading: boolean;
1111
completed: (success: boolean) => void;
1212
icon?: boolean;
1313
iconLabel?: string;
1414
}
1515

16-
const RetryDeliveryButton: React.FC<RetryDeliveryButtonProps> = ({
17-
deliveryId,
16+
const RetryAttemptButton: React.FC<RetryAttemptButtonProps> = ({
17+
attemptId,
1818
disabled,
1919
loading,
2020
completed,
@@ -24,12 +24,12 @@ const RetryDeliveryButton: React.FC<RetryDeliveryButtonProps> = ({
2424
const apiClient = useContext(ApiContext);
2525
const [retrying, setRetrying] = useState<boolean>(false);
2626

27-
const retryDelivery = useCallback(
27+
const retryAttempt = useCallback(
2828
async (e: MouseEvent<HTMLButtonElement>) => {
2929
e.stopPropagation();
3030
setRetrying(true);
3131
try {
32-
await apiClient.fetch(`deliveries/${deliveryId}/retry`, {
32+
await apiClient.fetch(`attempts/${attemptId}/retry`, {
3333
method: "POST",
3434
});
3535
showToast("success", "Retry successful.");
@@ -41,15 +41,15 @@ const RetryDeliveryButton: React.FC<RetryDeliveryButtonProps> = ({
4141

4242
setRetrying(false);
4343
},
44-
[apiClient, deliveryId, completed],
44+
[apiClient, attemptId, completed],
4545
);
4646

4747
return (
4848
<Button
4949
minimal
5050
icon={icon}
5151
iconLabel={iconLabel}
52-
onClick={(e) => retryDelivery(e)}
52+
onClick={(e) => retryAttempt(e)}
5353
disabled={disabled || retrying}
5454
loading={loading || retrying}
5555
>
@@ -58,4 +58,4 @@ const RetryDeliveryButton: React.FC<RetryDeliveryButtonProps> = ({
5858
);
5959
};
6060

61-
export default RetryDeliveryButton;
61+
export default RetryAttemptButton;

internal/portal/src/scenes/Destination/Destination.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from "../../typings/Destination";
1515
import getLogo from "../../utils/logo";
1616
import DestinationSettings from "./DestinationSettings/DestinationSettings";
17-
import { DeliveryRoutes } from "./Events/Deliveries";
17+
import { AttemptRoutes } from "./Events/Attempts";
1818

1919
// Define the tab interface
2020
interface Tab {
@@ -26,7 +26,7 @@ interface Tab {
2626
const tabs: Tab[] = [
2727
{ label: "Overview", path: "" },
2828
{ label: "Settings", path: "/settings" },
29-
{ label: "Deliveries", path: "/deliveries" },
29+
{ label: "Attempts", path: "/attempts" },
3030
];
3131

3232
const Destination = () => {
@@ -133,8 +133,8 @@ const Destination = () => {
133133
}
134134
/>
135135
<Route
136-
path="/deliveries/*"
137-
element={<DeliveryRoutes destination={destination} />}
136+
path="/attempts/*"
137+
element={<AttemptRoutes destination={destination} />}
138138
/>
139139
<Route
140140
path="/"

internal/portal/src/scenes/Destination/Events/DeliveryDetails.tsx renamed to internal/portal/src/scenes/Destination/Events/AttemptDetails.tsx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@ import { useParams } from "react-router-dom";
22
import Button from "../../../common/Button/Button";
33
import { CloseIcon } from "../../../common/Icons";
44
import useSWR from "swr";
5-
import { Delivery, EventFull } from "../../../typings/Event";
5+
import { Attempt, EventFull } from "../../../typings/Event";
66
import Badge from "../../../common/Badge/Badge";
7-
import RetryDeliveryButton from "../../../common/RetryDeliveryButton/RetryDeliveryButton";
7+
import RetryAttemptButton from "../../../common/RetryAttemptButton/RetryAttemptButton";
88
import { CopyButton } from "../../../common/CopyButton/CopyButton";
99

10-
const DeliveryDetails = ({
11-
navigateDelivery,
10+
const AttemptDetails = ({
11+
navigateAttempt,
1212
}: {
13-
navigateDelivery: (path: string, params?: any) => void;
13+
navigateAttempt: (path: string, params?: any) => void;
1414
}) => {
15-
const { delivery_id: deliveryId } = useParams();
15+
const { attempt_id: attemptId } = useParams();
1616

17-
const { data: delivery } = useSWR<Delivery>(
18-
`deliveries/${deliveryId}?include=event.data,response_data`,
17+
const { data: attempt } = useSWR<Attempt>(
18+
`attempts/${attemptId}?include=event.data,response_data`,
1919
);
2020

21-
if (!delivery) {
21+
if (!attempt) {
2222
return <div>Loading...</div>;
2323
}
2424

2525
const event =
26-
typeof delivery.event === "object" ? (delivery.event as EventFull) : null;
26+
typeof attempt.event === "object" ? (attempt.event as EventFull) : null;
2727

2828
return (
2929
<div className="drawer">
3030
<div className="drawer__header">
3131
<h3 className="drawer__header-title mono-s">
32-
{event?.topic || "Delivery"}
32+
{event?.topic || "Attempt"}
3333
</h3>
3434
<div className="drawer__header-actions">
35-
<RetryDeliveryButton
36-
deliveryId={delivery.id}
35+
<RetryAttemptButton
36+
attemptId={attempt.id}
3737
disabled={false}
3838
loading={false}
3939
completed={() => {}}
@@ -45,38 +45,38 @@ const DeliveryDetails = ({
4545
icon
4646
iconLabel="Close"
4747
minimal
48-
onClick={() => navigateDelivery("/")}
48+
onClick={() => navigateAttempt("/")}
4949
>
5050
<CloseIcon />
5151
</Button>
5252
</div>
5353
</div>
5454

5555
<div className="drawer__body">
56-
<div className="delivery-data">
57-
<div className="delivery-data__section">
56+
<div className="attempt-data">
57+
<div className="attempt-data__section">
5858
<dl className="body-m description-list">
5959
<div>
6060
<dt>Status</dt>
6161
<dd>
6262
<Badge
6363
text={
64-
delivery.status === "success" ? "Successful" : "Failed"
64+
attempt.status === "success" ? "Successful" : "Failed"
6565
}
66-
success={delivery.status === "success"}
67-
danger={delivery.status === "failed"}
66+
success={attempt.status === "success"}
67+
danger={attempt.status === "failed"}
6868
/>
6969
</dd>
7070
</div>
71-
{delivery.code && (
71+
{attempt.code && (
7272
<div>
7373
<dt>Response Code</dt>
74-
<dd className="mono-s">{delivery.code}</dd>
74+
<dd className="mono-s">{attempt.code}</dd>
7575
</div>
7676
)}
7777
<div>
7878
<dt>Attempt</dt>
79-
<dd className="mono-s">{delivery.attempt}</dd>
79+
<dd className="mono-s">{attempt.attempt}</dd>
8080
</div>
8181
{event && (
8282
<div>
@@ -87,7 +87,7 @@ const DeliveryDetails = ({
8787
<div>
8888
<dt>Delivered at</dt>
8989
<dd className="mono-s time">
90-
{new Date(delivery.delivered_at).toLocaleString("en-US", {
90+
{new Date(attempt.delivered_at).toLocaleString("en-US", {
9191
year: "numeric",
9292
month: "numeric",
9393
day: "numeric",
@@ -99,10 +99,10 @@ const DeliveryDetails = ({
9999
</dd>
100100
</div>
101101
<div>
102-
<dt>Delivery ID</dt>
102+
<dt>Attempt ID</dt>
103103
<dd className="mono-s id-field">
104-
<span>{delivery.id}</span>
105-
<CopyButton value={delivery.id} />
104+
<span>{attempt.id}</span>
105+
<CopyButton value={attempt.id} />
106106
</dd>
107107
</div>
108108
{event && (
@@ -118,7 +118,7 @@ const DeliveryDetails = ({
118118
</div>
119119

120120
{event?.data && (
121-
<div className="delivery-data__section">
121+
<div className="attempt-data__section">
122122
<h3 className="subtitle-m">Data</h3>
123123
<pre className="mono-s">
124124
{JSON.stringify(event.data, null, 2)}
@@ -127,19 +127,19 @@ const DeliveryDetails = ({
127127
)}
128128

129129
{event?.metadata && Object.keys(event.metadata).length > 0 && (
130-
<div className="delivery-data__section">
130+
<div className="attempt-data__section">
131131
<h3 className="subtitle-m">Metadata</h3>
132132
<pre className="mono-s">
133133
{JSON.stringify(event.metadata, null, 2)}
134134
</pre>
135135
</div>
136136
)}
137137

138-
{delivery.response_data && (
139-
<div className="delivery-data__section">
138+
{attempt.response_data && (
139+
<div className="attempt-data__section">
140140
<h3 className="subtitle-m">Response</h3>
141141
<pre className="mono-s">
142-
{JSON.stringify(delivery.response_data, null, 2)}
142+
{JSON.stringify(attempt.response_data, null, 2)}
143143
</pre>
144144
</div>
145145
)}
@@ -149,4 +149,4 @@ const DeliveryDetails = ({
149149
);
150150
};
151151

152-
export default DeliveryDetails;
152+
export default AttemptDetails;

internal/portal/src/scenes/Destination/Events/Deliveries.scss renamed to internal/portal/src/scenes/Destination/Events/Attempts.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.destination-deliveries {
1+
.destination-attempts {
22
margin-top: var(--spacing-5);
33
margin-bottom: var(--spacing-20);
44

@@ -32,7 +32,7 @@
3232
display: grid;
3333
min-height: 713px;
3434

35-
.delivery-time-cell {
35+
.attempt-time-cell {
3636
text-transform: uppercase;
3737
}
3838

@@ -117,7 +117,7 @@
117117
}
118118
}
119119

120-
.delivery-data {
120+
.attempt-data {
121121
height: 100%;
122122
box-sizing: border-box;
123123

0 commit comments

Comments
 (0)