Skip to content

Feature/social auth buttons - #784

Open
Unclebaffa wants to merge 2 commits into
MentoNest:mainfrom
Unclebaffa:feature/social-auth-buttons
Open

Feature/social auth buttons#784
Unclebaffa wants to merge 2 commits into
MentoNest:mainfrom
Unclebaffa:feature/social-auth-buttons

Conversation

@Unclebaffa

Copy link
Copy Markdown
Contributor

Here are the full implementation notes:


Implementation Notes — feature/social-auth-buttons (f7dc3d9)

Final Verification State

Check Result
npx tsc --noEmit ✅ 0 errors
npm run lint ✅ 0 errors
npx prettier --check ✅ 0 violations
npx jest ✅ 153 tests / 15 suites

1. New Feature — Social Authentication Buttons

components/auth/SocialAuthButtons.tsx (NEW)

A reusable, accessible component with Google + Facebook sign-in buttons.

  • Inline SVG logos (no icon-lib dependency), full dark-mode support
  • Horizontal "or continue with" divider, hover/focus transitions, aria-label per button
  • Props: onGoogleSignIn?, onFacebookSignIn?, className? — all optional (safe before OAuth is wired up)

Integrated into both app/(auth)/login/page.tsx and app/(auth)/register/page.tsx.

Tests — __tests__/auth/SocialAuthButtons.test.tsx (NEW)

7 unit tests: renders both buttons, divider text, callback invocation per button, graceful no-op without callbacks, className forwarding, and aria-label presence.


2. TypeScript Fixes (61 errors → 0)

File Fix
lib/api/client.ts Typed headers as Record<string, string>HeadersInit doesn't allow index access
lib/types.ts Added experienceYears?: number to Mentor (alongside existing yearsExperience?)
components/mentors/data.ts Re-exported Mentor, ExperienceLevel; added EXPERIENCE_LEVELS array
components/mentors/DiscoveryMentorCard.tsx Nullish coalesced all optional Mentor fields (?? 0, ?? [])
components/mentors/MentorComparisonDrawer.tsx rating ?? 0, id || mentorId || "" fallbacks
components/DiscussionMetadata.tsx Full prop types + React.CSSProperties; fixed now - datenow.getTime() - date.getTime()
app/(public)/mentors/data/mockMentors.ts Typed as Mentor[], string IDs, added MENTORS alias + mentorSlug() function
app/(public)/mentors/[id]/page.tsx Typed existing: Mentor in filter callback
app/(public)/mentors/components/MentorCard.tsx Replaced @heroicons/react (not installed) with lucide-react Star
app/(public)/resources/tracks/LearningTracks.tsx Fixed LearningTrackCard import path (landing/components/)
app/CategoryBadge.tsx Added ColorKey/ColorEntry types, typed COLOR_MAP, hashStringToColorKey, and component props
components/community/CreateDiscussionForm.tsx Imported missing Toast from @/components/ui/toast
components/icons.tsx Added named aliases: CodeIcon, GearIcon, PaletteIcon, ChartIcon, RocketIcon, BriefcaseIcon, ChevronRightIcon, SearchIcon
components/resources/icons.ts (NEW) Created re-export barrel for HeroSearchBar's SearchIcon import

3. ESLint Fixes (28 errors → 0)

File Problem Fix
components/community/RichTextEditor.tsx ToolbarButton defined inside render — 26 static-components errors Moved to module-level scope
hooks/useDiscussions.ts setState called synchronously inside effect Wrapped in async IIFE
components/ResourceSearchBar.tsx Same set-state-in-effect violation Deferred via Promise.resolve().then(...)
lib/auth-context.tsx setState in effect for localStorage read Replaced with lazy useState(() => ...) initializer

4. Bug Fixes

File Bug
app/layout.tsx Duplicate AuthProvider import from merge conflict
app/(dashboard)/community/[id]/page.tsx File content fully duplicated (bad merge), missing braces, unescaped ' in JSX, timeAgo inside component
app/(public)/discover-mentors/MentorDiscoveryView.tsx Corrupted merge, wrong Mentor field names (hourlyRate, yearsOfExperience), filter function inline
app/(public)/mentors/page.tsx Duplicated component declaration, missing return (
components/ui/StarRating.tsx Off-by-one in partial-fill formula (0-indexed loop, 1-indexed comparison)
lib/utils.ts Imported clsx/tailwind-merge which aren't in package.json — replaced with self-contained cn()

5. Test Infrastructure

  • __tests__/ui/ResourceSearchBar.test.tsx — Added useSearchParams to the next/navigation mock (was missing, causing immediate crash)
  • __tests__/ui/StarRating.test.tsx — Updated float assertions to tolerate rounding after the star formula fix

Closes #611

- Add SocialAuthButtons component with Google and Facebook buttons
- Include inline SVG icons for both providers (no external deps)
- Add divider with configurable 'or ...' label
- Fully accessible: aria-label, role=group/separator, aria-hidden on decorative SVGs
- Dark mode support via Tailwind dark: variants
- No backend integration (UI only)
- Fix pre-existing broken login page (code inside return statement)
- Refactor register page to use shared SocialAuthButtons component
- Add 7 unit tests for SocialAuthButtons (all passing)
…uth UI

- feat: add SocialAuthButtons component (Google + Facebook, dark mode, SVG icons)
- feat: integrate SocialAuthButtons into login and register pages
- test: add 7 unit tests for SocialAuthButtons; all 153 tests pass across 15 suites

TypeScript (tsc --noEmit now clean):
- lib/api/client.ts: type headers as Record<string,string> to allow Authorization indexing
- lib/types.ts: add experienceYears? field to Mentor interface
- components/mentors/data.ts: re-export Mentor, ExperienceLevel; add EXPERIENCE_LEVELS array
- components/mentors/DiscoveryMentorCard.tsx: nullish coalesce all optional Mentor fields
- components/mentors/MentorComparisonDrawer.tsx: add rating ?? 0 and id || mentorId fallbacks
- components/DiscussionMetadata.tsx: add full TypeScript types + React.CSSProperties
- app/(public)/mentors/data/mockMentors.ts: type as Mentor[], add MENTORS + mentorSlug exports
- app/(public)/mentors/[id]/page.tsx: type existing param in filter callback
- app/(public)/mentors/components/MentorCard.tsx: replace @heroicons/react with lucide-react
- app/(public)/resources/tracks/LearningTracks.tsx: fix LearningTrackCard import path
- app/CategoryBadge.tsx: add ColorKey/ColorEntry types, typed COLOR_MAP and props
- components/community/CreateDiscussionForm.tsx: import missing Toast component
- components/icons.tsx: add named aliases (CodeIcon, GearIcon, ChevronRightIcon, etc.)
- components/resources/icons.ts: create re-export barrel for resource icon imports

ESLint (0 errors):
- components/community/RichTextEditor.tsx: move ToolbarButton to module level
- hooks/useDiscussions.ts: wrap setState in async IIFE to fix react-hooks/set-state-in-effect
- components/ResourceSearchBar.tsx: wrap setState in microtask
- lib/auth-context.tsx: use lazy useState initializer for localStorage reads

Prettier: all files formatted clean

Bug fixes:
- app/layout.tsx: remove duplicate AuthProvider import
- app/(dashboard)/community/[id]/page.tsx: fix duplicate content, unescaped JSX entities
- app/(public)/discover-mentors/MentorDiscoveryView.tsx: fix corruption, align Mentor fields
- app/(public)/mentors/page.tsx: fix duplicate component syntax and missing return wrapper
- components/ui/StarRating.tsx: fix 1-indexed partial-fill star calculation
- lib/utils.ts: replace missing clsx/tailwind-merge with pure cn() implementation
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Unclebaffa Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nafiuishaaq

Copy link
Copy Markdown
Contributor

Please resolve conflict

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.

Implement Social Authentication Buttons UI

2 participants