Repository navigation
Staff area redesign, break game, price and admin fixes - #4
Merged
Merged
Conversation
- Statistics page returned 500: ApexCharts and the dark mode check touched `window` during server rendering. Load the chart in the browser only. - Settings: the "force open/close today" switch compared an unpadded date with the padded one the order queue saves, so it showed as off on most days. Turning it off saved an empty value, which the settings validation rejects, leaving the save button stuck. It now resets to the default. - Non-admins opening /user/manage/* got a 500 page (or the settings form). Every admin page now redirects them to their dashboard. - Order and log times used toLocaleString(), which formats differently on the server and in the browser and caused hydration errors. Use a fixed format in the store's time zone. - README: explain that uploads must be served by the web server in production, since `next start` only serves files present at build time.
…r hydration Pricing - A sale multiplier could produce prices like 16.915, which were shown, charged and stored with three decimals. Each cup is now rounded to cents (half up) on the menu, in the cart and on the server. - Base prices, sale multipliers and option price changes were not checked on the server: negative prices, a multiplier of 1.5, 0 or -1, three decimals or "4abc" were saved, and "4abc" broke every order using that option. The server and the admin forms now validate them. Cart hydration - The cart and last order were read from browser storage before React hydrated, so the checkout page rendered differently from the server HTML. The stores now load after mount; the empty-cart redirect and the WeChat pay page wait for them. - Login links are no longer prefetched; the prefetch followed the redirect to OneLogin and failed as a cross-origin request.
- New dashboard layout with a sticker sidebar: a "mine" group, a store group for staff, and the break game. Phones get a top bar and a slide-in drawer. - Dashboard: greeting from the beluga, balance and points tiles, and a "today at the store" overview for staff (queue, cups left, hours). - Waiting orders queue shown as paper tickets with a wait timer that turns butter after 5 minutes and tomato after 10, next to a store status card. - Storefront: chip tabs with counts, coupons drawn as tickets, tag colour dots, ad thumbnails and an empty state with the sleepy beluga. - Product editor shows a live preview of the menu card and the price the customer pays. - Settings grouped into hours, cup limits and payment; users as cards; user details as a profile with tiles; stats tiles and charts in the palette. - Tables, tabs, pagination, breadcrumbs and form fields restyled in the Flowbite theme; detail pages use a shared label/value sheet. - Break game (摸鱼一下): the beluga catches coffee beans and cups and dodges alarm clocks. Keyboard and touch controls, pause, local best score, and a boss key that jumps to the order queue. - Chinese translations for the dashboard, which were missing; localized pagination and the stats date picker; greeting hour uses the store's time zone so it renders the same on the server and in the browser. - Order items without options no longer show a trailing "/".
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
Follow-up to #3. I tested the admin account end to end, plus new products, prices and discounts. This PR fixes what those tests turned up, redesigns the staff area in the same cartoon sticker style as the ordering pages, and adds a small break game for staff.
Before and after
Before is the current
main; after is this branch. Same data, same viewport.main)New page, the break game (摸鱼一下):
Bug fixes
Prices and discounts
4abcwere all saved, and4abcbroke every order that used that option. They are now validated on the server and in the admin forms, with clear error messages.Admin pages
windowduring server rendering./user/manage/*got a 500 page, or the settings form. Every admin page now redirects them to their dashboard. Data was already protected by the server actions.toLocaleString(), which formats differently on the server and in the browser and caused hydration errors. They now use a fixed format in the store's time zone.Ordering
Staff area redesign
docs/DESIGN.md.Break game
/user/manage/break, for admins only. The beluga catches coffee beans (+1) and cups (+5) and dodges alarm clocks (the manager checking in). It works with the keyboard and with touch, pauses when the tab is hidden, keeps the best score inlocalStorage, andBis a boss key that jumps to the order queue.Docs
next startonly serves files that were inpublic/at build time.Testing