feat(admin): add search with submit and safe-area layout

Add submit-based search to admin books page and switch borrows
search from debounced to submit-based for consistency. Update
layout headers and nav bars to respect mobile safe-area insets
via CSS custom properties.
This commit is contained in:
2026-05-24 21:51:29 +08:00
parent 9780083476
commit 3a341393ef
14 changed files with 576 additions and 401 deletions
+9 -1
View File
@@ -1,5 +1,5 @@
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"
import { getAllMyBorrows, returnBookForMe } from "@/api/borrows"
import { getAllMyBorrows, searchMyBorrows, returnBookForMe } from "@/api/borrows"
import { toast } from "sonner"
import { getErrorMessage } from "@/lib/errors"
@@ -10,6 +10,14 @@ export function useMyBorrows() {
})
}
export function useSearchMyBorrows(query: string) {
return useQuery({
queryKey: ["myBorrows", "search", query],
queryFn: () => searchMyBorrows(query),
enabled: query.length > 0,
})
}
export function useReturnBook() {
const qc = useQueryClient()
return useMutation({