@@ -3,6 +3,7 @@ import { useState } from "react";
33import { usePostRoomsHook } from "@shared/api/generated/endpoints/rooms/rooms" ;
44import { useQuery } from "@tanstack/react-query" ;
55import type { RoomWithOptionalGuestBooking } from "@shared" ;
6+ import { SortByContainer } from "@/components/rooms/SortByContainer" ;
67import { PageShell } from "@/components/ui/PageShell" ;
78import { RoomsHeader } from "@/components/rooms/RoomsHeader" ;
89import { RoomsList } from "@/components/rooms/RoomsList" ;
@@ -16,10 +17,11 @@ function RoomsPage() {
1617 const [ selectedFloors , setSelectedFloors ] = useState < Array < number > > ( [ ] ) ;
1718 const [ selectedRoom , setSelectedRoom ] =
1819 useState < RoomWithOptionalGuestBooking | null > ( null ) ;
20+ const [ ascending , setAscending ] = useState ( true ) ;
1921
2022 const postRooms = usePostRoomsHook ( ) ;
2123
22- const { data } = useQuery ( {
24+ const { data : rooms } = useQuery ( {
2325 queryKey : [ "rooms" , selectedFloors ] ,
2426 queryFn : ( ) =>
2527 postRooms ( {
@@ -44,8 +46,11 @@ function RoomsPage() {
4446 />
4547 }
4648 >
49+ < SortByContainer ascending = { ascending } setAscending = { setAscending } />
50+
4751 < RoomsList
48- rooms = { data ?. items ?? [ ] }
52+ rooms = { rooms ?. items ?? [ ] }
53+ ascending = { ascending }
4954 onRoomSelect = { setSelectedRoom }
5055 selectedRoomNumber = { selectedRoom ?. room_number ?? null }
5156 />
0 commit comments