Skip to content

feat(shopping): card-eligible prompts tab - #178

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
Pallavikumarimdb:feat/card-eligible-prompts
Jun 6, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
Pallavikumarimdb:feat/card-eligible-prompts

Conversation

@Pallavikumarimdb

Copy link
Copy Markdown
Contributor

Adds the Card-eligible prompts tab on the Shopping analytics dashboard to surface tracked prompts that trigger AI shopping cards.

Key Changes

  • Server Action: Added getCardEligiblePrompts(brandId, filters) to aggregate card-triggering prompts, own/competitor/other distributions, and last triggered dates. Fully type-safe without any casts.
  • Tab Layout: Refactored the Shopping page into Overview and Card-eligible prompts tabs, gated under the shopping_analytics plan limit.
  • KPI & Actions: Added a "Trigger rate" KPI card at the top, a live search bar, and a CSV export utility.
  • Drawer Details: Configured a row-click Sheet drawer to show exact appearances, grouped by platform and timestamp, containing product images, pricing, and merchant links.
  • Localization: Added corresponding copy key definitions inside en.json.

Closes: #106

@Pallavikumarimdb
Pallavikumarimdb marked this pull request as ready for review June 4, 2026 20:06
@gkhngyk

gkhngyk commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @Pallavikumarimdb — the getCardEligiblePrompts action looks solid (type-safe, no any, filter pattern matches the existing Shopping actions). One thing blocks merge though: this PR now conflicts with main.

#176 landed just before this and refactored the same three files (shopping/page.tsx, shopping.ts, en.json). It turned the Shopping page into a tabbed layout — Overview / My Products / Competitors — and #178 independently refactors the same page into Overview / Card-eligible prompts. Since both rewrote the same TabsList scaffolding and KPI/search/CSV/drawer machinery, Git can't auto-merge them.

What's needed

Rebase onto the current main and reconcile so the page ends up with four tabs:

Overview · Card-eligible prompts · My Products · Competitors

Concretely, after git rebase origin/main:

  1. shopping/page.tsx — keep the post-feat(shopping): My Products / Competitors tabs with brand matching #176 tab scaffolding (Overview / My Products / Competitors already there) and add your Card-eligible prompts TabsTrigger + TabsContent alongside them, rather than replacing the whole tab block. Your row-click Sheet drawer and feat(shopping): My Products / Competitors tabs with brand matching #176's ProductAppearancesDrawer are similar — please check whether they can share one drawer or need to stay separate; if separate, give them distinct state so they don't collide.
  2. shopping.ts — your getCardEligiblePrompts is append-only, so this file should rebase cleanly once the imports line is reconciled.
  3. en.json — merge both key sets under the shopping.* namespace (your cardEligible* / triggerRate keys + feat(shopping): My Products / Competitors tabs with brand matching #176's tabMyProducts / tabCompetitors etc.). Keep them all.
  4. The KPI grid: feat(shopping): My Products / Competitors tabs with brand matching #176 didn't add a top KPI; your Trigger rate card should slot into the existing KpiGrid rather than a parallel one.

Once it's rebased and green again, ping me and I'll re-review. The actual logic here is fine — it's purely the layout reconciliation that needs your eyes, since how the four tabs sit together is a design call I don't want to make for you.

@Pallavikumarimdb
Pallavikumarimdb force-pushed the feat/card-eligible-prompts branch from dceb069 to d2868e8 Compare June 5, 2026 15:55
@Pallavikumarimdb

Copy link
Copy Markdown
Contributor Author

Thanks @Pallavikumarimdb — the getCardEligiblePrompts action looks solid (type-safe, no any, filter pattern matches the existing Shopping actions). One thing blocks merge though: this PR now conflicts with main.

#176 landed just before this and refactored the same three files (shopping/page.tsx, shopping.ts, en.json). It turned the Shopping page into a tabbed layout — Overview / My Products / Competitors — and #178 independently refactors the same page into Overview / Card-eligible prompts. Since both rewrote the same TabsList scaffolding and KPI/search/CSV/drawer machinery, Git can't auto-merge them.

What's needed

Rebase onto the current main and reconcile so the page ends up with four tabs:

Overview · Card-eligible prompts · My Products · Competitors

Concretely, after git rebase origin/main:

1. **`shopping/page.tsx`** — keep the post-[feat(shopping): My Products / Competitors tabs with brand matching #176](https://github.com/ansvisor/ansvisor/pull/176) tab scaffolding (Overview / My Products / Competitors already there) and add your `Card-eligible prompts` `TabsTrigger` + `TabsContent` alongside them, rather than replacing the whole tab block. Your row-click `Sheet` drawer and [feat(shopping): My Products / Competitors tabs with brand matching #176](https://github.com/ansvisor/ansvisor/pull/176)'s `ProductAppearancesDrawer` are similar — please check whether they can share one drawer or need to stay separate; if separate, give them distinct state so they don't collide.

2. **`shopping.ts`** — your `getCardEligiblePrompts` is append-only, so this file should rebase cleanly once the imports line is reconciled.

3. **`en.json`** — merge both key sets under the `shopping.*` namespace (your `cardEligible*` / `triggerRate` keys + [feat(shopping): My Products / Competitors tabs with brand matching #176](https://github.com/ansvisor/ansvisor/pull/176)'s `tabMyProducts` / `tabCompetitors` etc.). Keep them all.

4. The KPI grid: [feat(shopping): My Products / Competitors tabs with brand matching #176](https://github.com/ansvisor/ansvisor/pull/176) didn't add a top KPI; your `Trigger rate` card should slot into the existing `KpiGrid` rather than a parallel one.

Once it's rebased and green again, ping me and I'll re-review. The actual logic here is fine — it's purely the layout reconciliation that needs your eyes, since how the four tabs sit together is a design call I don't want to make for you.

Hey @gkhngyk , Thanks for the review. I have resolved merge conflicts and CI is green, could you please review again.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Pallavikumarimdb — the rebase reconciliation is exactly right. All four tabs coexist cleanly (Overview · Card-eligible prompts · My Products · Competitors), the en.json key sets are both preserved, Trigger rate slots into the existing KpiGrid, and the drawer is reused rather than duplicated. getCardEligiblePrompts stays type-safe and consistent with the other Shopping actions. Nicely done — merging.

@gkhngyk
gkhngyk merged commit 78700ca into ansvisor:main Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(shopping): card-eligible prompts tab

2 participants