v5: "Report a problem" nav button that opens the chat pre-seeded#25
Conversation
Adds a maintenance-reporting entry point to the v5 nav. Clicking "Report" opens the chat assistant and auto-sends an opening message, then the assistant runs its existing diagnose-then-file flow (report_issue + photo upload). When clicked on a tool page, the report is automatically scoped to that tool via ChatFab's existing toolId-from-pathname context. - New ChatLauncherProvider owns just the launcher's open state + a one-shot seed message, so entry points outside ChatFab can open and seed the chat. All conversation state stays inside ChatFab. - ChatFab consumes the context for open/close and auto-sends the seed via a nonce-guarded effect (idempotent; waits for any in-flight turn). - PrimaryNav gains an accent-styled Report button. - i18n: nav.report / reportAria / reportSeed added to all 12 locales. Verified: v5 build + lint pass; browser check confirms the button opens the chat and the seeded message is sent (assistant reply requires ANTHROPIC_API_KEY). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9517ec4d44
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (seedText) { | ||
| setPendingSeed((prev) => ({ | ||
| text: seedText, | ||
| nonce: (prev?.nonce ?? 0) + 1, |
There was a problem hiding this comment.
Preserve seed nonce across consumed seeds
After ChatFab consumes a seed, pendingSeed is set back to null, so the next open(t("reportSeed")) call recomputes the nonce as 1 again. Since ChatFab keeps lastSeedNonce.current at 1, a user who clicks REPORT a second time after the first seeded turn has been sent will only open the sheet; the seed is skipped and no report prompt is sent. Keep a monotonic counter outside the consumed seed state (or otherwise make each seed unique after consumption).
Useful? React with 👍 / 👎.
What
Adds a maintenance-reporting entry point to the v5 app: a Report button in the top nav. Clicking it opens the chat assistant and auto-sends an opening message ("I'd like to report a problem."). The assistant then runs its existing diagnose-then-file flow —
report_issue+ photo upload to Notion + unit lookup — all of which already work.This closes the biggest UX gap noted when comparing v4 → v5: v5 could only file tickets if a student happened to start a chat, with no visible "report an issue" affordance.
Approach
The chosen design (option A from brainstorming): a nav button that launches the chat, rather than a standalone v4-style form. It's the smallest change, reuses the entire working ticketing pipeline, and fits v5's "first-line helper" conversational design.
ChatLauncherProvider(new) owns only the launcher's open state + a one-shot seed message (with a nonce so repeat clicks re-trigger). Entry points outsideChatFabcan now open and seed the chat; all conversation/message state stays insideChatFab.ChatFabconsumes the context for open/close and auto-sends the seed via a nonce-guarded effect — idempotent (no resend on re-render) and waits for any in-flight turn before sending.PrimaryNavgains an accent-styledReportbutton (mono/uppercase to match the nav).ChatFabalready derivestoolIdfrom the URL, so reporting from a tool page is auto-scoped to that tool — no extra plumbing.nav.report/nav.reportAria/nav.reportSeedadded to all 12 locales with real translations (matching the existing translated message files).Files
v5/src/components/ChatLauncherContext.tsx(new)v5/src/app/layout.tsx— wrap chrome + ChatFab in the providerv5/src/components/ChatFab.tsx— context-driven open/close + auto-send effectv5/src/components/PrimaryNav.tsx— the Report buttonv5/src/styles/globals.css—.primary-nav-reportv5/messages/*.json— 12 localesVerification
npm run build✅ andnpm run lint✅ (inv5/)>_FAB still opens the chat normally. (The assistant's reply needsANTHROPIC_API_KEY, absent in local dev — not part of this change.)Notes / not in scope
/reportform for a no-conversation "just log it" path.🤖 Generated with Claude Code