Skip to content

Conversation

@lorenzocorallo
Copy link
Member

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce an email-based OTP authentication system replacing GitHub sign-in, enhance dashboard authorization with role-based permission checks, add user profile completion workflows, and restructure layout components. A new CompleteProfile component prompts users to set their name, while a SetName dialog and OTP input UI components are added. The authentication client is extended with email OTP and next.js cookie plugins. Header is moved from login/onboarding layouts to the root layout, and several onboarding and session-handling flows are refactored.

Changes

Cohort / File(s) Summary
Dependency Updates
package.json
Upgrades: @polinetwork/backend (^0.12.1 → ^0.14.0), @t3-oss/env-nextjs (^0.10.1 → ^0.13.10), @tanstack/react-query (^5.90.12 → ^5.90.19), zod (^3.23.3 → ^4.3.5), better-auth (^1.3.15 → ^1.4.15). Adds: input-otp (^1.4.2).
Email OTP & Auth Client
src/lib/auth.ts, src/app/login/login-form.tsx, src/components/ui/input-otp.tsx
Adds email-based OTP authentication flow with two-step email/OTP verification, including new InputOTP component variants (InputOTPGroup, InputOTPSlot, InputOTPSeparator). Integrates emailOTPClient and nextCookies plugins into auth client.
Login Flow Restructuring
src/app/login/page.tsx, src/app/login/login-button.tsx, src/app/login/can-i-access.tsx, src/app/login/layout.tsx, src/app/login/success/page.tsx
Replaces multi-component login UI with single LoginForm; converts Github button to LoginButton with navigation instead of sign-in action; updates UI text from "Login with GitHub" to "Login with email"; removes login/layout.tsx wrapper and login/success page logic (now handled elsewhere).
Root Navigation & Header
src/app/layout.tsx, src/app/page.tsx, src/components/header.tsx
Moves Header from login/onboarding layouts to root layout; adds conditional rendering in home page based on session state (redirects authenticated users to /dashboard); updates logo link target from /login/success to /; adds Toaster position adjustment.
Dashboard Authorization & Account Management
src/app/dashboard/layout.tsx, src/app/dashboard/(active)/page.tsx, src/app/dashboard/(active)/account/..., src/app/dashboard/(active)/complete-profile.tsx
Adds server-side permission checks with TRPC role fetch and role-based redirects in dashboard layout; removes Header from dashboard layout. Introduces SetName dialog component and CompleteProfile banner for users without names; restructures account page with explicit labels and conditional avatar fallback (UserIcon when name missing); updates Telegram roles display formatting.
Onboarding & Session Handling
src/app/onboarding/link/page.tsx, src/app/onboarding/link/logout.tsx, src/app/onboarding/link/telegram.tsx, src/app/onboarding/no-role/page.tsx, src/app/onboarding/layout.tsx
Adds Logout component for email/session signout and navigation; introduces OnboardingNoRole page with permission guards and role-based redirects; updates TelegramLink to redirect to /dashboard instead of /login/success; removes Header from onboarding layout; refines OTP error handling and request/response logic.
Sidebar & User Components
src/components/sidebar/nav-user.tsx, src/components/user-card.tsx
Adds UserIcon fallback in avatar when user.name is absent; switches from redirect to useRouter for logout navigation; simplifies dropdown menu structure; adds avatar border; updates dropdown positioning from bottom/right to top/start.
UI Styling & Theme Updates
src/components/ui/alert.tsx, src/components/ui/dropdown-menu.tsx, src/components/ui/sidebar.tsx
Adjusts hover backgrounds from sidebar-specific colors to accent/40 opacity across menu components; removes alert warning/info variants; changes DropdownMenuSeparator background from bg-muted to bg-border/80; simplifies AlertTitle typography classes.
TRPC Client Configuration
src/lib/trpc/client.tsx
Updates SuperJSON import alias and transformer configuration (superjson → SuperJSON).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Client as Login Form
    participant Auth as Better Auth
    participant Email as Email Service
    
    User->>Client: Enter email
    Client->>Auth: sendVerificationOtp(email)
    Auth->>Email: Send OTP
    Email->>User: OTP delivered
    User->>Client: Enter 6-digit OTP
    Client->>Auth: signIn.emailOtp(otp)
    Auth->>Client: Success response
    Client->>User: Redirect to /dashboard
Loading
sequenceDiagram
    participant User
    participant DashboardLayout as Dashboard Layout
    participant Auth as Server Session
    participant TRPC as TRPC Query
    participant Redirect as Router
    
    User->>DashboardLayout: Access /dashboard
    DashboardLayout->>Auth: getServerSession()
    Auth->>DashboardLayout: Return session
    DashboardLayout->>DashboardLayout: Check telegramId exists
    alt Missing telegramId
        DashboardLayout->>Redirect: redirect(/onboarding/link)
    else Has telegramId
        DashboardLayout->>TRPC: getRoles(telegramId)
        TRPC->>DashboardLayout: Return roles
        alt No roles
            DashboardLayout->>Redirect: redirect(/onboarding/no-role)
        else Has creator role
            DashboardLayout->>Redirect: redirect(/onboarding/unauthorized)
        else Has valid roles
            DashboardLayout->>User: Render dashboard with children
        end
    end
Loading
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lorenzocorallo lorenzocorallo marked this pull request as ready for review January 25, 2026 15:41
@lorenzocorallo lorenzocorallo merged commit cbaa56c into main Jan 25, 2026
1 of 2 checks passed
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