All files / app/pricing page.tsx

100% Statements 25/25
100% Branches 4/4
100% Functions 1/1
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 351x       1x 1x 1x 1x 1x     1x   27x 27x 27x 27x   27x 7x 7x 7x 7x 7x 7x 7x   7x 6x 6x 7x   27x 27x  
import { Metadata } from 'next';
import { getUser, createClient } from '@/lib/supabase/server';
import { PricingContent } from './PricingContent';
 
export const metadata: Metadata = {
  title: 'Pricing - ProofID',
  description:
    'Choose the right plan for your proof-of-work identity. Start free, upgrade anytime.',
};
 
// Force dynamic rendering to always fetch fresh subscription data
export const dynamic = 'force-dynamic';
 
export default async function PricingPage() {
  const user = await getUser();
  let currentTier = 'free';
  let isLoggedIn = false;
 
  if (user) {
    isLoggedIn = true;
    const supabase = await createClient();
    const { data: profile } = await supabase
      .from('profiles')
      .select('subscription_tier')
      .eq('user_id', user.id)
      .single();
 
    if (profile?.subscription_tier) {
      currentTier = profile.subscription_tier;
    }
  }
 
  return <PricingContent isLoggedIn={isLoggedIn} currentTier={currentTier} />;
}