Skip to content

Commit 2abfae7

Browse files
feat(companion): Booking details screen navigation header improvements (#26163)
* feat(companion): restructure booking detail components and enhance type safety - Migrate BookingDetail component to a new file structure under (tabs)/(bookings) for better organization. - Introduce a new BookingDetailScreen with improved header and menu options. - Update app.json to enable typed routes and enhance TypeScript configuration in tsconfig.json. - Remove the old booking-detail.tsx file to clean up the codebase. - Adjust imports and routing to reflect the new structure, ensuring all components are properly linked. This refactor aims to improve maintainability and clarity in the booking detail flow. * add header options * refactor(booking-detail): rename "Standalone Actions" menu to "Danger Zone" for clarity --------- Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com>
1 parent 75d8300 commit 2abfae7

File tree

7 files changed

+469
-357
lines changed

7 files changed

+469
-357
lines changed

companion/app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
}
4141
},
4242
"owner": "calcoms-organization",
43-
"plugins": ["expo-router", "expo-secure-store", "expo-web-browser"]
43+
"plugins": ["expo-router", "expo-secure-store", "expo-web-browser"],
44+
"experiments": {
45+
"typedRoutes": true
46+
}
4447
}
4548
}

companion/app/(tabs)/(bookings)/_layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default function BookingsLayout() {
55
return (
66
<Stack>
77
<Stack.Screen name="index" options={{ headerShown: Platform.OS !== "ios" ? false : true }} />
8+
<Stack.Screen name="booking-detail" />
89
</Stack>
910
);
1011
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import { BookingDetailScreen } from "../../../components/screens/BookingDetailScreen";
2+
import { Stack, useLocalSearchParams } from "expo-router";
3+
import React from "react";
4+
import { Alert } from "react-native";
5+
6+
export default function BookingDetail() {
7+
const { uid } = useLocalSearchParams<{ uid: string }>();
8+
9+
if (!uid) {
10+
return null;
11+
}
12+
13+
// Define booking actions organized by sections
14+
const bookingActionsSections = {
15+
editEvent: [
16+
{
17+
id: "reschedule",
18+
label: "Reschedule Booking",
19+
icon: "calendar",
20+
onPress: () => Alert.alert("Reschedule", "Reschedule functionality coming soon"),
21+
},
22+
{
23+
id: "edit-location",
24+
label: "Edit Location",
25+
icon: "location",
26+
onPress: () => Alert.alert("Edit Location", "Edit location functionality coming soon"),
27+
},
28+
{
29+
id: "add-guests",
30+
label: "Add Guests",
31+
icon: "person.badge.plus",
32+
onPress: () => Alert.alert("Add Guests", "Add guests functionality coming soon"),
33+
},
34+
],
35+
afterEvent: [
36+
{
37+
id: "view-recordings",
38+
label: "View Recordings",
39+
icon: "video",
40+
onPress: () => Alert.alert("View Recordings", "View recordings functionality coming soon"),
41+
},
42+
{
43+
id: "session-details",
44+
label: "Meeting Session Details",
45+
icon: "info.circle",
46+
onPress: () =>
47+
Alert.alert("Session Details", "Meeting session details functionality coming soon"),
48+
},
49+
{
50+
id: "mark-no-show",
51+
label: "Mark as No-Show",
52+
icon: "eye.slash",
53+
onPress: () => Alert.alert("Mark No-Show", "Mark as no-show functionality coming soon"),
54+
},
55+
],
56+
standalone: [
57+
{
58+
id: "report",
59+
label: "Report Booking",
60+
icon: "flag",
61+
onPress: () => Alert.alert("Report", "Report booking functionality coming soon"),
62+
destructive: true,
63+
},
64+
{
65+
id: "cancel",
66+
label: "Cancel Event",
67+
icon: "xmark.circle",
68+
onPress: () => Alert.alert("Cancel Event", "Cancel event functionality coming soon"),
69+
destructive: true,
70+
},
71+
],
72+
} as const;
73+
74+
return (
75+
<>
76+
<Stack.Screen
77+
options={{
78+
headerBackButtonDisplayMode: "minimal",
79+
}}
80+
/>
81+
82+
<Stack.Header style={{ shadowColor: "transparent" }}>
83+
<Stack.Header.Title>Booking Details</Stack.Header.Title>
84+
85+
{/* Header right and left API only works on iOS ATM see: https://docs.expo.dev/versions/unversioned/sdk/router/#stackheaderright */}
86+
<Stack.Header.Right>
87+
<Stack.Header.Menu>
88+
<Stack.Header.Label>Actions</Stack.Header.Label>
89+
<Stack.Header.Icon sf="ellipsis" />
90+
91+
{/* Edit Event Section */}
92+
<Stack.Header.Menu inline title="Edit Event">
93+
{bookingActionsSections.editEvent.map((action) => (
94+
<Stack.Header.MenuAction
95+
key={action.id}
96+
icon={action.icon}
97+
onPress={action.onPress}
98+
>
99+
{action.label}
100+
</Stack.Header.MenuAction>
101+
))}
102+
</Stack.Header.Menu>
103+
104+
{/* After Event Section */}
105+
<Stack.Header.Menu inline title="After Event">
106+
{bookingActionsSections.afterEvent.map((action) => (
107+
<Stack.Header.MenuAction
108+
key={action.id}
109+
icon={action.icon}
110+
onPress={action.onPress}
111+
>
112+
{action.label}
113+
</Stack.Header.MenuAction>
114+
))}
115+
</Stack.Header.Menu>
116+
117+
{/* Danger Zone Submenu */}
118+
<Stack.Header.Menu inline title="Danger Zone">
119+
{bookingActionsSections.standalone.map((action) => (
120+
<Stack.Header.MenuAction
121+
key={action.id}
122+
icon={action.icon}
123+
onPress={action.onPress}
124+
destructive
125+
>
126+
{action.label}
127+
</Stack.Header.MenuAction>
128+
))}
129+
</Stack.Header.Menu>
130+
</Stack.Header.Menu>
131+
</Stack.Header.Right>
132+
</Stack.Header>
133+
134+
<BookingDetailScreen uid={uid} />
135+
</>
136+
);
137+
}

companion/app/booking-detail.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)