simplify /bookings/[status] logic (#845)

This commit is contained in:
Alex Johansson authored and GitHub committed 2021-10-02 13:29:26 +00:00
1 parent 342ea3e5d2
commit eb93e778bd
2 files changed
+10 -14

No files matched your search

+8 -12
View File
@@ -11,7 +11,7 @@ import BookingListItem from "@components/booking/BookingListItem";
type BookingListingStatus = inferQueryInput<"viewer.bookings">["status"];
const descriptionByStatus = {
const descriptionByStatus: Record<BookingListingStatus, string> = {
upcoming: "As soon as someone books a time with you it will show up here.",
past: "Your past bookings will show up here.",
cancelled: "Your cancelled bookings will show up here.",
@@ -41,17 +41,13 @@ export default function Bookings() {
</table>
</div>
)}
empty={
status
? () => (
<EmptyScreen
Icon={CalendarIcon}
headline={`No ${status} bookings, yet`}
description={`You have no ${status} bookings. ${descriptionByStatus[status]}`}
/>
)
: undefined
}
empty={() => (
<EmptyScreen
Icon={CalendarIcon}
headline={`No ${status} bookings, yet`}
description={`You have no ${status} bookings. ${descriptionByStatus[status]}`}
/>
)}
/>
</div>
</div>