feat(admin): page count & colour badges + React Query migration for orders-by-timeslot#88
Merged
Merged
Conversation
…t files Display per-file page count and colour preference as responsive badges in the Orders by Timeslot admin view so the admin can see print details at a glance without clicking into each order. Adds pageCount to the orders-by-timeslot API response and renders flex-wrapping badges.
Replace raw useEffect + fetch data loading with useQuery (keyed ["orders-by-timeslot", filter]) and convert the mark-ready / mark-picked-up status updates to useMutation that invalidate the query on success. Follows the pattern established in TimeslotSelector and the React Query roadmap in AGENTS.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related improvements to the Orders by Timeslot admin view (
components/admin/OrdersByTimeslotView.tsx):useEffect+fetchto@tanstack/react-query, per the roadmap inAGENTS.md.Changes
Page count & colour badges
📄 12p) — pages per copyflex-wrapso badges and the existing Open button reflow cleanly on narrow widths (responsive).pageCountto theorders-by-timeslotAPI response (app/api/admin/orders-by-timeslot/route.ts) so the component can render it.React Query migration
useState/useEffect/fetchDatawithuseQuerykeyed["orders-by-timeslot", filter], usingplaceholderData: (prev) => prev.useMutationthat invalidate the["orders-by-timeslot"]query on success.fetchOrdersByTimeslotandupdateOrderStatushelpers.refetch().components/pickup/TimeslotSelector.tsx.Notes
COLOR→ "Colour", otherwise "B&W").pageCountis rendered conditionally, so older data without it degrades gracefully.Verification
tsc --noEmitpasses with no errors.biome checkpasses on all changed files.