Update dashboard navigation and landing page interactivity#81
Update dashboard navigation and landing page interactivity#81DealPatrol wants to merge 11 commits into
Conversation
Updated Next.js type import for development environment. Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
Updated import path for route types to align with current Next.js structure Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
Replaced DashboardHeader with DashboardSidebar for updated layout; added sidebar component Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
… handling Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
…ironment type import Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
Updated Stripe webhook secret retrieval to use new getStripeWebhookSecret function Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
…hook route Renamed function for clarity and consistency in stripe secret handling Co-authored-by: Cole Collins <118781133+DealPatrol@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the dashboard UI structure and Stripe/auth integration points to support a new sidebar navigation layout, streamlined Stripe env lookups, and stronger access control for running analyses.
Changes:
- Replaced the dashboard header layout with a fixed left sidebar navigation component.
- Refactored Stripe helpers/usage to rely on consolidated env lookups and a single “pro” price accessor.
- Added early authentication handling to the analysis “run” API route.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| next-env.d.ts | Updates the generated route-types reference import. |
| lib/stripe.ts | Simplifies Stripe env-variable access and pricing helpers. |
| components/dashboard-sidebar.tsx | Adds the new client-side dashboard sidebar navigation UI. |
| app/dashboard/layout.tsx | Switches dashboard layout from header-based to sidebar-based shell. |
| app/api/stripe/webhook/route.ts | Refactors Stripe webhook imports and configuration/signature checks. |
| app/api/checkout/route.ts | Uses the unified getPriceId() helper for checkout line items. |
| app/api/analyses/[id]/run/route.ts | Adds authentication gating behavior before starting SSE analysis runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type StripeMode = 'live' | 'test' | ||
|
|
||
| function normalizeMode(value?: string): StripeMode { | ||
| if (value?.toLowerCase() === 'test') return 'test' | ||
| return 'live' | ||
| } | ||
|
|
||
| function detectModeFromKey(key: string): StripeMode { | ||
| if (key.startsWith('sk_test_') || key.startsWith('rk_test_')) return 'test' | ||
| return 'live' |
| console.log('[v0] getStripe() called') | ||
| console.log('[v0] Checking env vars:') | ||
| console.log('[v0] STRIPE_LIVE_SECRET_KEY:', process.env.STRIPE_LIVE_SECRET_KEY ? '***SET***' : 'NOT SET') | ||
| console.log('[v0] STRIPE_SECRET_KEY:', process.env.STRIPE_SECRET_KEY ? '***SET***' : 'NOT SET') | ||
| console.log('[v0] Available env keys containing STRIPE:', Object.keys(process.env).filter(k => k.includes('STRIPE'))) |
| const signature = request.headers.get('stripe-signature') | ||
|
|
||
| const webhookSecret = getWebhookSecret() | ||
| if (!signature || !webhookSecret) { | ||
| return NextResponse.json({ error: 'Webhook not configured' }, { status: 400 }) |
| <DashboardSidebar user={user ? { | ||
| name: user.name || 'Developer', | ||
| email: user.email, | ||
| plan: 'pro' | ||
| } : undefined} /> |
| <button className="w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-[#8B949E] hover:text-[#F0F6FC] hover:bg-[#161B22] transition-colors"> | ||
| <LogOut className="h-3.5 w-3.5" /> | ||
| Sign Out | ||
| </button> |
| export function DashboardSidebar({ user }: SidebarProps) { | ||
| const pathname = usePathname() | ||
|
|
||
| const isActive = (href: string) => pathname === href |
| const accessToken = await getCurrentAccessToken().catch(() => null) | ||
| if (!accessToken) { | ||
| const redirectUrl = new URL('/api/auth/github/login', req.url) | ||
| redirectUrl.searchParams.set('returnTo', `/dashboard/analyses/${id}`) | ||
| return NextResponse.redirect(redirectUrl) |
| import { NextRequest, NextResponse } from 'next/server' | ||
| import { getStripe, getWebhookSecret } from '@/lib/stripe' | ||
| import { upsertSubscription, getSubscriptionByStripeCustomerId, getUserByGithubId } from '@/lib/queries' | ||
| import { getWebhookSecret, getStripe, getPriceIdForPlan } from '@/lib/stripe' |
User Interface
Security & Authentication
Infrastructure
v0 Session