feat: pass comingSoon into HoursTable and HoursStatus#1223
Conversation
|
Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information. |
WalkthroughThis PR introduces support for displaying a "Coming Soon" status in location hours sections. It adds Sequence DiagramsequenceDiagram
participant LocationCard as LocatorResultCard/<br/>NearbyLocationCard
participant HoursContentBlocks as HoursStatus/<br/>HoursTable Blocks
participant HoursAtoms as HoursStatusAtom/<br/>HoursTableAtom
participant Renderer as HoursStatusJS/<br/>HoursTable Component
LocationCard->>LocationCard: Extract comingSoon from location data
LocationCard->>HoursContentBlocks: Render if hours OR comingSoon
HoursContentBlocks->>HoursContentBlocks: Derive comingSoon from data or stream
HoursContentBlocks->>HoursAtoms: Pass hours (with fallback) + comingSoon
HoursAtoms->>Renderer: Forward props to underlying component
Renderer->>Renderer: Detect comingSoon flag
alt comingSoon is true
Renderer->>Renderer: Render localized "Coming Soon" text
else hours data exists
Renderer->>Renderer: Render hours table/status
end
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/visual-editor/src/components/contentBlocks/HoursStatus.tsx`:
- Line 105: The current comingSoon assignment (const comingSoon =
parentData?.comingSoon ?? !!streamDocument.comingSoon) incorrectly falls back to
streamDocument when parentData exists but lacks comingSoon; change the logic so
that if parentData is provided we only use parentData.comingSoon (or false) and
only read streamDocument.comingSoon when parentData is absent. Update the
comingSoon expression in HoursStatus.tsx to something like: if (parentData) use
!!parentData.comingSoon, otherwise use !!streamDocument.comingSoon, referencing
the comingSoon variable, parentData, and streamDocument identifiers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3d4ff1b9-4701-426d-9d44-cd3a0adc9991
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (60)
packages/visual-editor/locales/components/cs/visual-editor.jsonpackages/visual-editor/locales/components/da/visual-editor.jsonpackages/visual-editor/locales/components/de/visual-editor.jsonpackages/visual-editor/locales/components/en-GB/visual-editor.jsonpackages/visual-editor/locales/components/en/visual-editor.jsonpackages/visual-editor/locales/components/es/visual-editor.jsonpackages/visual-editor/locales/components/et/visual-editor.jsonpackages/visual-editor/locales/components/fi/visual-editor.jsonpackages/visual-editor/locales/components/fr/visual-editor.jsonpackages/visual-editor/locales/components/hr/visual-editor.jsonpackages/visual-editor/locales/components/hu/visual-editor.jsonpackages/visual-editor/locales/components/it/visual-editor.jsonpackages/visual-editor/locales/components/ja/visual-editor.jsonpackages/visual-editor/locales/components/lt/visual-editor.jsonpackages/visual-editor/locales/components/lv/visual-editor.jsonpackages/visual-editor/locales/components/nb/visual-editor.jsonpackages/visual-editor/locales/components/nl/visual-editor.jsonpackages/visual-editor/locales/components/pl/visual-editor.jsonpackages/visual-editor/locales/components/pt/visual-editor.jsonpackages/visual-editor/locales/components/ro/visual-editor.jsonpackages/visual-editor/locales/components/sk/visual-editor.jsonpackages/visual-editor/locales/components/sv/visual-editor.jsonpackages/visual-editor/locales/components/tr/visual-editor.jsonpackages/visual-editor/locales/components/zh-TW/visual-editor.jsonpackages/visual-editor/locales/components/zh/visual-editor.jsonpackages/visual-editor/locales/platform/cs/visual-editor.jsonpackages/visual-editor/locales/platform/da/visual-editor.jsonpackages/visual-editor/locales/platform/de/visual-editor.jsonpackages/visual-editor/locales/platform/en-GB/visual-editor.jsonpackages/visual-editor/locales/platform/en/visual-editor.jsonpackages/visual-editor/locales/platform/es/visual-editor.jsonpackages/visual-editor/locales/platform/et/visual-editor.jsonpackages/visual-editor/locales/platform/fi/visual-editor.jsonpackages/visual-editor/locales/platform/fr/visual-editor.jsonpackages/visual-editor/locales/platform/hr/visual-editor.jsonpackages/visual-editor/locales/platform/hu/visual-editor.jsonpackages/visual-editor/locales/platform/it/visual-editor.jsonpackages/visual-editor/locales/platform/ja/visual-editor.jsonpackages/visual-editor/locales/platform/lt/visual-editor.jsonpackages/visual-editor/locales/platform/lv/visual-editor.jsonpackages/visual-editor/locales/platform/nb/visual-editor.jsonpackages/visual-editor/locales/platform/nl/visual-editor.jsonpackages/visual-editor/locales/platform/pl/visual-editor.jsonpackages/visual-editor/locales/platform/pt/visual-editor.jsonpackages/visual-editor/locales/platform/ro/visual-editor.jsonpackages/visual-editor/locales/platform/sk/visual-editor.jsonpackages/visual-editor/locales/platform/sv/visual-editor.jsonpackages/visual-editor/locales/platform/tr/visual-editor.jsonpackages/visual-editor/locales/platform/zh-TW/visual-editor.jsonpackages/visual-editor/locales/platform/zh/visual-editor.jsonpackages/visual-editor/package.jsonpackages/visual-editor/src/components/LocatorResultCard.tsxpackages/visual-editor/src/components/atoms/hoursStatus.tsxpackages/visual-editor/src/components/atoms/hoursTable.tsxpackages/visual-editor/src/components/contentBlocks/HoursStatus.tsxpackages/visual-editor/src/components/contentBlocks/HoursTable.tsxpackages/visual-editor/src/components/directory/DirectoryCard.tsxpackages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationCard.tsxpackages/visual-editor/src/components/pageSections/NearbyLocations/useNearbyLocations.tsstarter/package.json
Just a copy of work in this PR for our other branch.
Included a small change in DirectoryCard.tsx so tests would pass.