Feat/menu schedule strings - #195
Open
yerloveraaa wants to merge 5 commits into
Open
Conversation
Replace the SectionList + getItemLayout approach with an Animated.ScrollView that measures each section's real position via onLayout. Row heights were estimates, so tab presses landed in the wrong section and the render window left blank areas on screen. Index updates are blocked while a tab press travels to its target and released on arrival, so the tab strip animates once per press instead of once per section crossed. Also corrects the no-description/no-photo row height estimate in getItemLayout to match what ProductListItem renders.
A menu now says when it can be ordered, so the storefront needs to name a day
and an hour: nineteen keys covering the days of the week, the start/end labels
of the vendor's hour editor, and the sentences the customer reads under the
menu tabs.
These are the first keys to interpolate. i18n-js resolves %{name} against the
options object, which is what lets "opens Saturday at 4:00 AM" and "opens at
5:00 PM" be the same sentence with and without a day — the caller decides,
because the day is only worth naming when the next opening is not today. The
day names double as the section headers of the hour editor, which is why they
are capitalised and read a little formal inside a Spanish sentence.
- ListItem gives its description rows a key. The array branch has always
mapped without one; nothing hit it until a caller passed an array on a
screen that renders a list, and React warned. It is a rendering bug of the
component, not of the caller.
The Vendor app kept this editor to itself, but it is design-system work: Paper primitives, MD3 tokens, and the nineteen strings the previous commit already put in en.json and es.json. It arrives here as a component folder and leaves the app with an import. utils.js is the editor's logic and comes with it. The form uses all of it — rangesOf, timeSlotsFor, isRangeInvalid and the withRange* builders — so it is not a helper the consumer could own. Only what a screen actually calls is public: MenuScheduleForm plus hasInvalidRanges, invalidRanges, isValidTime and DAYS_OF_WEEK. The builders stay internal, since a caller that rewrote a range by hand would be writing a shape the backend parses. The map is the same one functions/inventory/schedule.js persists: a missing day is closed, an empty map is always open, and an end at or before the start crosses midnight. Nothing here converts it, which is why utils.js has no react-native import and can be checked in node. The story covers the three states worth looking at, including a range imported from Uber with an inclusive end (18:00–02:59) — timeSlotsFor splices such a value into the 15-minute list so opening the picker neither hides nor rewrites it. Its glob is in .storybook/main.ts; that list is hand-maintained and the web docs would not show the story otherwise.
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.
No description provided.