Skip to content

Refactor SupportModal into core lib, add CAPTCHA & clean up repo pages#55

Merged
jfrench9 merged 4 commits intomainfrom
chore/cleanup-repo-pages
Mar 10, 2026
Merged

Refactor SupportModal into core lib, add CAPTCHA & clean up repo pages#55
jfrench9 merged 4 commits intomainfrom
chore/cleanup-repo-pages

Conversation

@jfrench9
Copy link
Member

Summary

This PR consolidates the SupportModal component into the src/lib/core module, adds Cloudflare Turnstile CAPTCHA verification to the support submission flow, and performs minor cleanup on repository page components.

What changed

SupportModal relocation & enhancement

  • Moved SupportModal from src/components/app/ to src/lib/core/ui-components/support/, integrating it into the shared core library for better reusability and organization.
  • Updated layout-wrapper.tsx to import SupportModal from its new location.
  • Significantly enhanced the SupportModal component with Cloudflare Turnstile CAPTCHA integration, adding client-side token generation before form submission.

CAPTCHA verification (Turnstile)

  • Added a new src/lib/core/utils/turnstile-config.ts utility with Turnstile site key configuration and helper utilities.
  • Added server-side CAPTCHA token verification in src/app/api/support/route.ts, validating the Turnstile token against Cloudflare's siteverify endpoint before processing support requests.

Repository page cleanup

  • Removed unused code/imports from ActiveSubscriptions.tsx.
  • Minor updates to BrowseRepositories.tsx (likely import or rendering adjustments).

Core library barrel exports

  • Updated src/lib/core/index.ts and src/lib/core/ui-components/index.ts to export the new SupportModal and support-related modules.
  • Added src/lib/core/ui-components/support/index.ts barrel file.

Key UI/UX Improvements

  • Bot protection: Support form submissions are now protected by Cloudflare Turnstile CAPTCHA, reducing spam and abuse without degrading the user experience (Turnstile is non-intrusive compared to traditional CAPTCHAs).
  • No visible UI regression — the SupportModal behaves the same from the user's perspective, with the addition of the invisible/managed Turnstile challenge widget.

Breaking Changes

  • Import path change: Any code importing SupportModal from src/components/app/SupportModal will break. All imports must now reference src/lib/core/ui-components/support (or the core barrel export). This PR updates all known consumers.
  • Environment variable requirement: The Turnstile secret key must be configured server-side for the support API route to function. Ensure TURNSTILE_SECRET_KEY (or the relevant env var referenced in turnstile-config.ts) is set in all deployment environments.

Testing Notes for Reviewers

  1. Support form happy path: Open the SupportModal, fill out the form, and submit. Verify the Turnstile widget renders (may be invisible/managed mode), the token is sent with the request, and the server validates it successfully.
  2. CAPTCHA failure: Simulate an invalid/missing Turnstile token (e.g., by intercepting the request in DevTools and removing the token). Confirm the API returns an appropriate error and the UI handles it gracefully.
  3. Import integrity: Verify no broken imports exist — run the build (next build) to catch any missing module references.
  4. Repository pages: Navigate to pages using ActiveSubscriptions and BrowseRepositories to confirm no regressions from the cleanup.
  5. Environment config: Confirm the Turnstile site key is correctly loaded client-side and the secret key is available server-side.

Browser Compatibility Considerations

  • Cloudflare Turnstile supports all modern browsers (Chrome, Firefox, Safari, Edge). No IE11 support is provided by Turnstile, which aligns with typical Next.js application targets.
  • The Turnstile JS SDK is loaded externally from Cloudflare's CDN — ensure CSP (Content Security Policy) headers allow https://challenges.cloudflare.com if a strict CSP is in place.
  • No other browser-specific concerns; all other changes are standard React/Next.js patterns.

🤖 Generated with Claude Code

Branch Info:

  • Source: chore/cleanup-repo-pages
  • Target: main
  • Type: feature

Co-Authored-By: Claude noreply@anthropic.com

- Integrated CAPTCHA verification logic in the POST request handler.
- Added functions to check if CAPTCHA is required, retrieve client IP, and verify the Turnstile token.
- Enhanced error handling for missing or failed CAPTCHA verification, returning appropriate responses.
d9f7f4d0 Add SupportModal component with Turnstile CAPTCHA integration
0dd40557 Refactor dashboard content and enhance support modal with CAPTCHA verification. Removed quick actions from the dashboard and improved layout for schema extensions and graph ID display. Added Turnstile CAPTCHA integration in the support modal for enhanced security during form submissions.
34596f06 Enhance subscription filtering in OverviewTab and BrowseRepositories components. Updated repository subscription logic to include only active subscriptions in the OverviewTab and refined user subscription checks in BrowseRepositories to account for canceled subscriptions with valid end dates.

git-subtree-dir: src/lib/core
git-subtree-split: d9f7f4d0edc30928107d7620b0bba75c57c3c9f5
…s previous file. This change streamlines the component structure by integrating SupportModal into the layout, enhancing code organization and maintainability.
@jfrench9 jfrench9 merged commit 1670c8f into main Mar 10, 2026
3 checks passed
jfrench9 added a commit that referenced this pull request Mar 11, 2026
Align README and CLAUDE.md with current app state
@jfrench9 jfrench9 deleted the chore/cleanup-repo-pages branch March 11, 2026 02:18
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.

1 participant