fix(web): use real discovery data and owner-aware store pages#350
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
Warning Review limit reached
More reviews will be available in 4 minutes and 14 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR introduces public search functionality for stores and products, standardizes handle display across discovery surfaces, adds ownership-based branching on store detail pages, and transforms the right sidebar from static content to a dynamic API-driven discovery panel with search integration. ChangesPublic Discovery & Store Management Features
Sequence DiagramssequenceDiagram
participant SearchPage
participant API
participant Validator
participant UI
SearchPage->>API: GET /search?q=query
API-->>SearchPage: response with stores/products
SearchPage->>Validator: validate and normalize response
Validator-->>SearchPage: typed stores[] and products[]
SearchPage->>UI: render StoreSearchCard/ProductSearchCard
UI-->>SearchPage: linked cards with metadata
flowchart TD
StorePageClient[StorePageClient loads]
StorePageClient-->OwnerCheck{useOwnerStore checks<br/>ownership}
OwnerCheck-->|is owner|OwnerConfig["AppShell mode=edit<br/>OwnerStoreActions<br/>profile fields shown"]
OwnerCheck-->|not owner|GuestConfig["AppShell mode=view<br/>Follow button<br/>public store data"]
OwnerConfig-->Render["Render store page"]
GuestConfig-->Render
sequenceDiagram
participant RightPanel
participant APIFetch
participant State
participant Render
RightPanel->>APIFetch: fetch stores + hashtags on mount
APIFetch-->>State: update stores[] and hashtags[]
State->>Render: render store cards with getPublicStoreHref
State->>Render: render hashtag links to /search?q=hashtag
Render-->>RightPanel: display discovery panel + search input
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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 `@apps/web/src/app/`(public)/search/page.tsx:
- Around line 80-89: Remove the local formatPrice function and swap all its
usages to the shared utility formatKobo: delete the function named formatPrice
in page.tsx and replace any occurrences like
{formatPrice(product.retailPriceKobo)} with
{formatKobo(product.retailPriceKobo)}; ensure you import formatKobo from the
shared utils (apps/web/src/lib/utils.ts) at the top of the file if not already
imported and keep the existing fallback behavior provided by formatKobo.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8f6d3471-ac9e-4fbf-a736-b6575de15f1f
📒 Files selected for processing (5)
apps/web/src/app/(public)/search/page.tsxapps/web/src/app/(public)/stores/[handle]/StorePageClient.tsxapps/web/src/app/(public)/stores/page.tsxapps/web/src/components/feed/FeedCard.tsxapps/web/src/components/layout/RightPanel.tsx
7ee4cbd to
17abeda
Compare
What does this PR do?
This PR removes hardcoded discovery/sidebar data from the public store surfaces and wires the web app to real backend feed/search endpoints. It adds the public
/searchpage, updates store directory/detail/feed links to use canonical/stores/:handleroutes, and makes the public store page owner-aware so store owners see edit/add/dashboard actions while public viewers continue to see the public Follow action.Type of change
Area affected
How to test this
/storesand confirm it loads fromGET /feed/stores?limit=24or shows a clean empty/error state./stores/test-handleand confirm it renders public store data or a clean unavailable/not-found state; store owners should see Edit profile, Add product, and Dashboard instead of Follow./searchand/search?q=testand confirm results come fromGET /search?q=...&type=all&limit=12with no fake stores/products./stores/:handlelinks and no generated/@handlelinks.Expected result: public discovery surfaces use backend data, hardcoded trending hashtags are removed, store handles display without a visible
@prefix in touched surfaces, and owner-specific actions appear only when the current viewer owns the public store.Pre-commit checklist
console.logleft in production code.envfiles committedanytypes addeddb pushScreenshots
N/A. UI behavior changed but no local browser smoke was run in this split worktree.
Notes for reviewer
Backend endpoints used:
GET /feed/stores?limit=24,GET /feed/stores?limit=3,GET /feed/explore?limit=12, andGET /search?q=...&type=all&limit=12. Product detail links were already canonical and QuickBuySheet already matches the current/checkout/[productId]?code=...contract, so they were intentionally left unchanged. The owner-aware public store page only uses the public store payload for rendering public store data; private owner-store data such as bank details, internal address, Paystack recipient data, and internal verification fields are not exposed.Validation:
pnpm.cmd run lint: passed, with existing warning insrc/app/(store)/store/settings/StoreSettingsClient.tsxabout a missingloaddependency.npx.cmd tsc --noEmit: passed.pnpm.cmd run build: passed, with the same existing store settings hook warning.Summary by CodeRabbit
New Features
Improvements