Skip to content

Commit ea93776

Browse files
feat(trains): update train details and add Italian route suggestions in chat component
1 parent ce3b07a commit ea93776

File tree

7 files changed

+125
-128
lines changed

7 files changed

+125
-128
lines changed

components/custom/chat.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,34 @@ export function Chat({
3636
return (
3737
<div className="flex flex-row justify-center pb-4 md:pb-8 h-dvh bg-background">
3838
<div className="flex flex-col justify-between items-center gap-4">
39+
{/* Italian train route suggestions */}
40+
<div className="flex flex-row gap-4 mb-4">
41+
<button
42+
className="bg-muted px-4 py-2 rounded-lg text-left text-muted-foreground hover:bg-zinc-800"
43+
onClick={() => append({
44+
role: "user",
45+
content: "Book a train from Rome to Florence",
46+
})}
47+
>
48+
<div className="font-medium">Book a train from Rome to Florence</div>
49+
<div className="text-xs">from Roma Termini to Firenze SMN</div>
50+
</button>
51+
<button
52+
className="bg-muted px-4 py-2 rounded-lg text-left text-muted-foreground hover:bg-zinc-800"
53+
onClick={() => append({
54+
role: "user",
55+
content: "What is the status of train ITALO9512 departing tomorrow?",
56+
})}
57+
>
58+
<div className="font-medium">What is the status</div>
59+
<div className="text-xs">of train ITALO9512 departing tomorrow?</div>
60+
</button>
61+
</div>
62+
3963
<div
4064
ref={messagesContainerRef}
4165
className="flex flex-col gap-4 h-full w-dvw items-center overflow-y-scroll"
4266
>
43-
{messages.length === 0 && <Overview />}
44-
4567
{messages.map((message) => (
4668
<PreviewMessage
4769
key={message.id}

components/custom/multimodal-input.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ import { Textarea } from "../ui/textarea";
2121

2222
const suggestedActions = [
2323
{
24-
title: "Book a train from Paris to Berlin",
25-
label: "from Paris to Berlin",
26-
action: "Help me book a train from Paris to Berlin",
24+
title: "Book a train from Rome to Florence",
25+
label: "from Roma Termini to Firenze SMN",
26+
action: "Help me book a train from Rome to Florence",
2727
},
2828
{
2929
title: "What is the status",
30-
label: "of train TR142 departing tomorrow?",
31-
action: "What is the status of train TR142 departing tomorrow?",
32-
},
30+
label: "of train ITALO9512 departing tomorrow?",
31+
action: "What is the status of train ITALO9512 departing tomorrow?",
32+
},
3333
];
3434

3535
export function MultimodalInput({

components/trains/boarding-pass.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@ import { format } from "date-fns";
22
import { FlashlightIcon } from "lucide-react";
33

44
const SAMPLE = {
5-
reservationId: "RES123456",
6-
trainNumber: "TR1",
7-
seat: "1C",
5+
reservationId: "RESIT20250731",
6+
trainNumber: "ITALO9512",
7+
seat: "12A",
88
departure: {
9-
cityName: "London",
10-
stationCode: "LDN",
11-
stationName: "London Central Station",
12-
timestamp: "2023-11-01T09:00:00Z",
13-
platform: "5",
14-
gate: "A10",
9+
cityName: "Rome",
10+
stationCode: "ROMA",
11+
stationName: "Roma Termini",
12+
timestamp: "2025-07-31T08:00:00Z",
13+
platform: "12",
14+
gate: "A1",
1515
},
1616
arrival: {
17-
cityName: "Manchester",
18-
stationCode: "MAN",
19-
stationName: "Manchester Piccadilly",
20-
timestamp: "2023-11-01T12:00:00Z",
21-
platform: "4",
22-
gate: "B22",
17+
cityName: "Florence",
18+
stationCode: "FI",
19+
stationName: "Firenze SMN",
20+
timestamp: "2025-07-31T09:30:00Z",
21+
platform: "3",
22+
gate: "B3",
2323
},
24-
passengerName: "John Doe",
24+
passengerName: "Giulia Rossi",
2525
};
2626

2727
export function DisplayBoardingPass({ boardingPass = SAMPLE }) {

components/trains/create-reservation.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { format } from "date-fns";
22

33
const SAMPLE = {
4-
seats: ["4C"],
5-
trainNumber: "TR413",
4+
seats: ["12A"],
5+
trainNumber: "ITALO9512",
66
departure: {
7-
cityName: "Sydney",
8-
stationCode: "SYD",
9-
timestamp: "2023-11-01T06:00:00",
10-
platform: "1",
11-
gate: "A12",
7+
cityName: "Rome",
8+
stationCode: "ROMA",
9+
timestamp: "2025-07-31T08:00:00Z",
10+
platform: "12",
11+
gate: "A1",
1212
},
1313
arrival: {
14-
cityName: "Chennai",
15-
stationCode: "MAA",
16-
timestamp: "2023-11-01T18:45:00",
14+
cityName: "Florence",
15+
stationCode: "FI",
16+
timestamp: "2025-07-31T09:30:00Z",
1717
platform: "3",
18-
gate: "B5",
18+
gate: "B3",
1919
},
20-
passengerName: "John Doe",
21-
totalPriceInUSD: 1200,
20+
passengerName: "Giulia Rossi",
21+
totalPriceInUSD: 49.99,
2222
};
2323

2424
export function CreateReservation({ reservation = SAMPLE }) {

components/trains/list-trains.tsx

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,68 @@ import { differenceInHours, format } from "date-fns";
66
const SAMPLE = {
77
trains: [
88
{
9-
id: "result_1",
9+
id: "italy_1",
1010
departure: {
11-
cityName: "San Francisco",
12-
stationCode: "SFC",
13-
timestamp: "2024-05-19T18:00:00Z",
11+
cityName: "Rome",
12+
stationCode: "ROMA",
13+
timestamp: "2025-07-31T08:00:00Z",
1414
},
1515
arrival: {
16-
cityName: "Rome",
17-
stationCode: "ROM",
18-
timestamp: "2024-05-20T14:30:00Z",
16+
cityName: "Florence",
17+
stationCode: "FI",
18+
timestamp: "2025-07-31T09:30:00Z",
1919
},
20-
operators: ["Amtrak", "Eurostar"],
21-
priceInUSD: 120.5,
22-
numberOfStops: 1,
20+
operators: ["Trenitalia", "Italo"],
21+
priceInUSD: 49.99,
22+
numberOfStops: 0,
2323
},
2424
{
25-
id: "result_2",
25+
id: "italy_2",
2626
departure: {
27-
cityName: "San Francisco",
28-
stationCode: "SFC",
29-
timestamp: "2024-05-19T17:30:00Z",
27+
cityName: "Milan",
28+
stationCode: "MILANO",
29+
timestamp: "2025-07-31T10:00:00Z",
3030
},
3131
arrival: {
32-
cityName: "Rome",
33-
stationCode: "ROM",
34-
timestamp: "2024-05-20T15:00:00Z",
32+
cityName: "Venice",
33+
stationCode: "VENEZIA",
34+
timestamp: "2025-07-31T12:30:00Z",
3535
},
36-
operators: ["Caltrain"],
37-
priceInUSD: 135,
38-
numberOfStops: 0,
36+
operators: ["Trenitalia"],
37+
priceInUSD: 59.99,
38+
numberOfStops: 1,
3939
},
4040
{
41-
id: "result_3",
41+
id: "italy_3",
4242
departure: {
43-
cityName: "San Francisco",
44-
stationCode: "SFC",
45-
timestamp: "2024-05-19T19:15:00Z",
43+
cityName: "Florence",
44+
stationCode: "FI",
45+
timestamp: "2025-07-31T13:00:00Z",
4646
},
4747
arrival: {
48-
cityName: "Rome",
49-
stationCode: "ROM",
50-
timestamp: "2024-05-20T16:45:00Z",
48+
cityName: "Pisa",
49+
stationCode: "PISA",
50+
timestamp: "2025-07-31T14:00:00Z",
5151
},
52-
operators: ["BART", "Trenitalia"],
53-
priceInUSD: 115.75,
54-
numberOfStops: 1,
52+
operators: ["Trenitalia"],
53+
priceInUSD: 19.99,
54+
numberOfStops: 0,
5555
},
5656
{
57-
id: "result_4",
57+
id: "italy_4",
5858
departure: {
59-
cityName: "San Francisco",
60-
stationCode: "SFC",
61-
timestamp: "2024-05-19T16:30:00Z",
59+
cityName: "Rome",
60+
stationCode: "ROMA",
61+
timestamp: "2025-07-31T15:00:00Z",
6262
},
6363
arrival: {
64-
cityName: "Rome",
65-
stationCode: "ROM",
66-
timestamp: "2024-05-20T13:50:00Z",
64+
cityName: "Venice",
65+
stationCode: "VENEZIA",
66+
timestamp: "2025-07-31T18:30:00Z",
6767
},
68-
operators: ["ACE", "Iberia"],
69-
totalDurationInMinutes: 740,
70-
priceInUSD: 125.25,
71-
numberOfStops: 1,
68+
operators: ["Italo"],
69+
priceInUSD: 69.99,
70+
numberOfStops: 2,
7271
},
7372
],
7473
};

components/trains/select-seats.tsx

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,20 @@ interface Seat {
1212
const SAMPLE: { seats: Seat[][] } = {
1313
seats: [
1414
[
15-
{ seatNumber: "1A", priceInUSD: 150, isAvailable: false },
16-
{ seatNumber: "1B", priceInUSD: 150, isAvailable: false },
17-
{ seatNumber: "1C", priceInUSD: 150, isAvailable: false },
18-
{ seatNumber: "1D", priceInUSD: 150, isAvailable: false },
19-
{ seatNumber: "1E", priceInUSD: 150, isAvailable: false },
20-
{ seatNumber: "1F", priceInUSD: 150, isAvailable: false },
15+
{ seatNumber: "12A", priceInUSD: 49.99, isAvailable: true },
16+
{ seatNumber: "12B", priceInUSD: 49.99, isAvailable: true },
17+
{ seatNumber: "12C", priceInUSD: 49.99, isAvailable: false },
18+
{ seatNumber: "12D", priceInUSD: 49.99, isAvailable: true },
19+
{ seatNumber: "12E", priceInUSD: 49.99, isAvailable: true },
20+
{ seatNumber: "12F", priceInUSD: 49.99, isAvailable: false },
2121
],
2222
[
23-
{ seatNumber: "2A", priceInUSD: 150, isAvailable: false },
24-
{ seatNumber: "2B", priceInUSD: 150, isAvailable: false },
25-
{ seatNumber: "2C", priceInUSD: 150, isAvailable: false },
26-
{ seatNumber: "2D", priceInUSD: 150, isAvailable: false },
27-
{ seatNumber: "2E", priceInUSD: 150, isAvailable: false },
28-
{ seatNumber: "2F", priceInUSD: 150, isAvailable: false },
29-
],
30-
[
31-
{ seatNumber: "3A", priceInUSD: 150, isAvailable: false },
32-
{ seatNumber: "3B", priceInUSD: 150, isAvailable: false },
33-
{ seatNumber: "3C", priceInUSD: 150, isAvailable: false },
34-
{ seatNumber: "3D", priceInUSD: 150, isAvailable: false },
35-
{ seatNumber: "3E", priceInUSD: 150, isAvailable: false },
36-
{ seatNumber: "3F", priceInUSD: 150, isAvailable: false },
37-
],
38-
[
39-
{ seatNumber: "4A", priceInUSD: 150, isAvailable: false },
40-
{ seatNumber: "4B", priceInUSD: 150, isAvailable: false },
41-
{ seatNumber: "4C", priceInUSD: 150, isAvailable: false },
42-
{ seatNumber: "4D", priceInUSD: 150, isAvailable: false },
43-
{ seatNumber: "4E", priceInUSD: 150, isAvailable: false },
44-
{ seatNumber: "4F", priceInUSD: 150, isAvailable: false },
45-
],
46-
[
47-
{ seatNumber: "5A", priceInUSD: 150, isAvailable: false },
48-
{ seatNumber: "5B", priceInUSD: 150, isAvailable: false },
49-
{ seatNumber: "5C", priceInUSD: 150, isAvailable: false },
50-
{ seatNumber: "5D", priceInUSD: 150, isAvailable: false },
51-
{ seatNumber: "5E", priceInUSD: 150, isAvailable: false },
52-
{ seatNumber: "5F", priceInUSD: 150, isAvailable: false },
23+
{ seatNumber: "13A", priceInUSD: 49.99, isAvailable: true },
24+
{ seatNumber: "13B", priceInUSD: 49.99, isAvailable: false },
25+
{ seatNumber: "13C", priceInUSD: 49.99, isAvailable: true },
26+
{ seatNumber: "13D", priceInUSD: 49.99, isAvailable: true },
27+
{ seatNumber: "13E", priceInUSD: 49.99, isAvailable: true },
28+
{ seatNumber: "13F", priceInUSD: 49.99, isAvailable: true },
5329
],
5430
],
5531
};

components/trains/train-status.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import { differenceInHours, format } from "date-fns";
33
import { ArrowUpRightSmallIcon } from "../custom/icons";
44

55
const SAMPLE = {
6-
trainNumber: "TR142",
6+
trainNumber: "ITALO9512",
77
departure: {
8-
cityName: "London",
9-
stationCode: "LDN",
10-
stationName: "London Central Station",
11-
timestamp: "2024-10-08T18:30:00Z",
12-
platform: "5",
13-
gate: "A10",
8+
cityName: "Rome",
9+
stationCode: "ROMA",
10+
stationName: "Roma Termini",
11+
timestamp: "2025-07-31T08:00:00Z",
12+
platform: "12",
13+
gate: "A1",
1414
},
1515
arrival: {
16-
cityName: "Manchester",
17-
stationCode: "MAN",
18-
stationName: "Manchester Piccadilly",
19-
timestamp: "2024-10-09T07:30:00Z",
20-
platform: "7",
21-
gate: "B22",
16+
cityName: "Florence",
17+
stationCode: "FI",
18+
stationName: "Firenze SMN",
19+
timestamp: "2025-07-31T09:30:00Z",
20+
platform: "3",
21+
gate: "B3",
2222
},
23-
totalDistanceInMiles: 180,
23+
totalDistanceInMiles: 144,
2424
};
2525

2626
export function Row({ row = SAMPLE.arrival, type = "arrival" }) {

0 commit comments

Comments
 (0)