Skip to content

fix(admin): clarify legacy null-country submissions in review UI#947

Merged
ericsocrat merged 1 commit intomainfrom
fix/admin-legacy-country-ux
Mar 17, 2026
Merged

fix(admin): clarify legacy null-country submissions in review UI#947
ericsocrat merged 1 commit intomainfrom
fix/admin-legacy-country-ux

Conversation

@ericsocrat
Copy link
Owner

Problem

Production smoke test after epic #920 deployment revealed 3 legacy submissions (Coca-Cola, Kellogg's Krave, PG Tips — all from Feb 2026) with zero country context in the admin review UI. Both scan_country and suggested_country are NULL for these rows because they were submitted before country tracking was added in epic #920.

Root cause: Missing feature / scope gap — NOT a regression. Epic #920 correctly implemented country-aware features for new submissions only. No fallback UX was designed for pre-existing null-country rows.

Changes

CountryChip.tsx

  • Added nullLabel?: string prop — backward compatible (existing callers unaffected)
  • When country is null AND nullLabel is provided → renders muted chip with FallbackFlag + label text
  • When country is null AND no nullLabel → still returns null (existing behavior preserved)

Admin Submissions Page (page.tsx)

  • Extracted effectiveCountry variable (replaces inline suggested_country ?? scan_country)
  • CountryChip now passes nullLabel={t("admin.noCountry")} → shows "No country" chip for legacy rows
  • Added legacy help text: "Submitted before country tracking was added" (italic, muted, with ℹ icon)
  • Added GS1 informational hint: "GS1 barcode registered in {country} (informational)" — shown only when country is null but GS1 hint exists, clearly labeled as informational (not proof of origin)
  • Added "No country" filter option with __none__ sentinel value in country dropdown
  • Simplified GS1 mismatch badge to use effectiveCountry variable

i18n (3 locales)

  • Added admin.noCountry / admin.noCountryHint / admin.gs1InfoHint to en.json, pl.json, de.json

Tests

  • 1 modified test: "does not render country chip when null" → "shows fallback country chip when null" (asserts chip IS present with data-null-country attribute)
  • 6 new tests: legacy help text visible, GS1 info hint for null-country, "No country" filter exists, filter sends __none__, mismatch badges suppressed for null-country, CountryChip nullLabel rendering

Hard Rules Followed

  • ❌ No historical data guessing — NULL values preserved as-is
  • ❌ No auto-backfill of legacy rows
  • ❌ GS1 prefix NOT treated as proof of product origin — labeled "informational" only

Verification

npx tsc --noEmit                  → 0 errors
npx vitest run (2 files)          → 63/63 tests pass
npx vitest run (i18n)             → 45/45 tests pass (dictionary parity confirmed)

New/Updated Tests

  • CountryChip.test.tsx — 1 new test (nullLabel rendering)
  • page.test.tsx — 1 modified + 5 new tests (legacy UX coverage)

File Impact

7 files changed, +206 / -35 lines

  • 1 component modified (CountryChip.tsx — nullLabel prop)
  • 1 page modified (page.tsx — effectiveCountry, legacy text, GS1 hint, filter)
  • 3 i18n files (3 new keys each)
  • 2 test files (1 modified test + 6 new tests)

Follow-Up (Not in Scope)

Backend api_admin_get_submissions does not yet handle the __none__ sentinel for NULL-country filtering. The frontend sends it correctly; backend handling can be added as a separate issue.

- Add nullLabel prop to CountryChip for null-country fallback rendering
- Show 'No country' chip with muted styling for legacy submissions
- Add legacy help text: 'Submitted before country tracking was added'
- Add GS1 informational hint for null-country with known GS1 barcode
- Add 'No country' filter option in country dropdown (__none__ sentinel)
- Use effectiveCountry variable to simplify GS1 mismatch logic
- Add 3 new admin i18n keys to en/pl/de locales
- Update 1 existing test + add 6 new tests (63/63 passing)
Copilot AI review requested due to automatic review settings March 17, 2026 21:28
@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tryvit Ready Ready Preview, Comment Mar 17, 2026 9:30pm

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions
Copy link

Bundle Size Report

Metric Value
Main baseline 0 KB
This PR 0 KB
Delta +0 KB (+0%)
JS chunks 0
Hard limit 4000 KB

✅ Bundle size is within acceptable limits.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit UX for legacy submissions that have no scan/suggested country, so admins can still see a meaningful “no country” indicator and related GS1 context in the submissions review UI.

Changes:

  • Extend CountryChip with a nullLabel prop to render a fallback chip when country is null.
  • Update admin submissions page to display fallback country chip + legacy info/GS1 hints when country is missing, and add a “No country” filter option.
  • Add/adjust tests and i18n strings for the new UI paths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/components/common/CountryChip.tsx Adds nullLabel rendering path when country is null.
frontend/src/components/common/CountryChip.test.tsx Tests fallback chip behavior for null-country with nullLabel.
frontend/src/app/app/admin/submissions/page.tsx Uses fallback chip + adds legacy null-country help text/GS1 hint + adds “No country” filter option.
frontend/src/app/app/admin/submissions/page.test.tsx Updates mocks/tests to cover null-country chip and new filter option behavior.
frontend/messages/en.json Adds admin translations for null-country labels/hints.
frontend/messages/pl.json Adds admin translations for null-country labels/hints.
frontend/messages/de.json Adds admin translations for null-country labels/hints.

Comment on lines 284 to 288
{c.code}
</option>
))}
<option value="__none__">{t("admin.noCountry")}</option>
</select>
@ericsocrat ericsocrat merged commit 17d375c into main Mar 17, 2026
20 of 21 checks passed
@ericsocrat ericsocrat deleted the fix/admin-legacy-country-ux branch March 17, 2026 21:52
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.

2 participants