feat: enhance accessibility and testing with data-test attributes and improve error handling
This commit is contained in:
@@ -90,9 +90,9 @@ export default async function BookingsPage({
|
||||
// Post-filter by search query (guest name or room name/number)
|
||||
if (searchQuery) {
|
||||
const q = searchQuery.toLowerCase();
|
||||
bookingsData = bookingsData.filter((b) => {
|
||||
const room = b.room as Record<string, string> | null;
|
||||
const guest = b.guest as Record<string, string> | null;
|
||||
bookingsData = bookingsData.filter((booking) => {
|
||||
const room = booking.room as Record<string, string> | null;
|
||||
const guest = booking.guest as Record<string, string> | null;
|
||||
const roomName = (room?.name ?? '').toLowerCase();
|
||||
const roomNumber = (room?.room_number ?? '').toLowerCase();
|
||||
const guestFirst = (guest?.first_name ?? '').toLowerCase();
|
||||
@@ -107,7 +107,8 @@ export default async function BookingsPage({
|
||||
}
|
||||
|
||||
const activeBookings = bookingsData.filter(
|
||||
(b) => b.status === 'confirmed' || b.status === 'checked_in',
|
||||
(booking) =>
|
||||
booking.status === 'confirmed' || booking.status === 'checked_in',
|
||||
);
|
||||
|
||||
const totalPages = Math.ceil(total / PAGE_SIZE);
|
||||
@@ -122,7 +123,7 @@ export default async function BookingsPage({
|
||||
</p>
|
||||
|
||||
<Link href={`/home/${account}/bookings/new`}>
|
||||
<Button>
|
||||
<Button data-test="bookings-new-btn">
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Neue Buchung
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user