Repository navigation
fix(insights): CSV export writes platform display names, not slugs - #234
Merged
Merged
Conversation
The insights Export CSV wrote the raw platform slug (e.g. chatgpt-web) in the platform column, while the charts and tables showed display names (ChatGPT). The label map lived locally in both _charts.tsx and page.tsx and the export never used it. Centralize the map into web/src/config/platform-labels.ts (union of both local copies, all existing labels preserved) and import it in both files. The CSV row now maps platform via PLATFORM_LABELS[r.platform] ?? r.platform, so unknown slugs still fall through to the raw value.
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.
Closes #187
Problem
On
/dashboard/insights, Export CSV wrote the raw platform slug (e.g.chatgpt-web,google-aio) in theplatformcolumn, while the charts and tables everywhere else show display names (ChatGPT,Google AI Overview).handleExportCsvmappedplatform: r.platformdirectly.The label map existed but lived locally — and was in fact duplicated in both
_charts.tsxandpage.tsx— so the export couldn't reach it.Fix
web/src/config/platform-labels.tsexportingPLATFORM_LABELS— the union of the two local copies, every existing label preserved (generic slugs, the tracked*-web/google-aio/google-aimodeslugs, plus the handful of model-slug fallback labels the charts already carried)._charts.tsxandinsights/page.tsxnow import from it; both local definitions removed.platform: PLATFORM_LABELS[r.platform] ?? r.platform— falls back to the raw slug for unknown platforms so nothing disappears.Verification
yarn typecheck— cleanyarn lint— clean (the onegroupResultsByPromptwarning is pre-existing onmain, unrelated)yarn format:check— cleanyarn build— compiles;/[locale]/dashboard/insightsand/insights/[id]renderFollow-up (out of scope, noted)
There are three more copies of essentially the same map, with minor label drift between them, in
insights/[id]/page.tsx,prompts/[id]/page.tsx, andcitations/page.tsx(e.g.gemini-webisGeminiin some,Google Geminiin others;google-ai-overviewsisGoogle AIvsGoogle AI Overview). I kept this PR scoped to the export bug rather than silently changing labels on those unrelated pages — happy to follow up with a second PR that migrates all three onto the shared module if wanted.