diff --git a/src/app/login/actions.ts b/src/app/login/actions.ts index 1b5acb1..c6795a4 100644 --- a/src/app/login/actions.ts +++ b/src/app/login/actions.ts @@ -2,7 +2,6 @@ import { revalidatePath } from 'next/cache'; import { redirect } from 'next/navigation'; - import { createClient } from '@/utils/supabase/server'; interface FormData { @@ -33,3 +32,18 @@ export async function signInWithGithub() { redirect(data.url); } } + +export async function loginAnonymously() { + const supabase = createClient(); + const { error: signInError } = await supabase.auth.signInAnonymously(); + const { error: updateUserError } = await supabase.auth.updateUser({ + email: `anonymous+${Date.now().toString(36)}@example.com`, + }); + + if (signInError || updateUserError) { + return { error: true }; + } + + revalidatePath('/', 'layout'); + redirect('/'); +} diff --git a/src/components/authentication/login-form.tsx b/src/components/authentication/login-form.tsx index 6d61bd1..ccd9e18 100644 --- a/src/components/authentication/login-form.tsx +++ b/src/components/authentication/login-form.tsx @@ -2,9 +2,10 @@ import Image from 'next/image'; import { Button } from '@/components/ui/button'; -import { login } from '@/app/login/actions'; +import { login, loginAnonymously } from '@/app/login/actions'; import { useState } from 'react'; import { AuthenticationForm } from '@/components/authentication/authentication-form'; +import { Separator } from '@/components/ui/separator'; import { useToast } from '@/components/ui/use-toast'; export function LoginForm() { @@ -20,12 +21,28 @@ export function LoginForm() { }); } + function handleAnonymousLogin() { + loginAnonymously().then((data) => { + if (data?.error) { + toast({ description: 'Something went wrong. Please try again', variant: 'destructive' }); + } + }); + } + return (
{'AeroEdit'}
Log in to your account
+ +
+ +
or
+ +
setEmail(email)} diff --git a/src/components/checkout/checkout-line-items.tsx b/src/components/checkout/checkout-line-items.tsx index cb18b73..42a5582 100644 --- a/src/components/checkout/checkout-line-items.tsx +++ b/src/components/checkout/checkout-line-items.tsx @@ -1,6 +1,5 @@ import { QuantityField } from '@/components/checkout/quantity-field'; import { Separator } from '@/components/ui/separator'; -import { PricePreviewResponse } from '@paddle/paddle-js'; import { CheckoutEventsData } from '@paddle/paddle-js/types/checkout/events'; import { formatMoney } from '@/utils/paddle/parse-money'; import { Skeleton } from '@/components/ui/skeleton'; diff --git a/src/components/checkout/checkout-price-amount.tsx b/src/components/checkout/checkout-price-amount.tsx index a13ff68..5c53b15 100644 --- a/src/components/checkout/checkout-price-amount.tsx +++ b/src/components/checkout/checkout-price-amount.tsx @@ -1,5 +1,4 @@ import { Skeleton } from '@/components/ui/skeleton'; -import { PricePreviewResponse } from '@paddle/paddle-js'; import { CheckoutEventsData } from '@paddle/paddle-js/types/checkout/events'; import { formatMoney } from '@/utils/paddle/parse-money'; diff --git a/src/components/checkout/checkout-price-container.tsx b/src/components/checkout/checkout-price-container.tsx index d44d03a..b27b4c4 100644 --- a/src/components/checkout/checkout-price-container.tsx +++ b/src/components/checkout/checkout-price-container.tsx @@ -1,6 +1,6 @@ import { CheckoutPriceAmount } from '@/components/checkout/checkout-price-amount'; import { CheckoutEventsData } from '@paddle/paddle-js/types/checkout/events'; -import { formatMoney, parseMoney } from '@/utils/paddle/parse-money'; +import { formatMoney } from '@/utils/paddle/parse-money'; import { Skeleton } from '@/components/ui/skeleton'; interface Props { diff --git a/src/components/checkout/quantity-field.tsx b/src/components/checkout/quantity-field.tsx index 4f80209..b1aebbd 100644 --- a/src/components/checkout/quantity-field.tsx +++ b/src/components/checkout/quantity-field.tsx @@ -1,6 +1,5 @@ import { Minus, Plus } from 'lucide-react'; import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; interface Props { quantity: number; diff --git a/src/components/dashboard/landing/components/dashboard-team-members-card.tsx b/src/components/dashboard/landing/components/dashboard-team-members-card.tsx index 8f8ef3f..d308156 100644 --- a/src/components/dashboard/landing/components/dashboard-team-members-card.tsx +++ b/src/components/dashboard/landing/components/dashboard-team-members-card.tsx @@ -4,7 +4,6 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import Link from 'next/link'; import { Plus } from 'lucide-react'; -import { Select } from '@/components/shared/select/select'; const teamMembers = [ { diff --git a/src/components/dashboard/landing/components/dashboard-tutorial-card.tsx b/src/components/dashboard/landing/components/dashboard-tutorial-card.tsx index 81c1d05..46363ef 100644 --- a/src/components/dashboard/landing/components/dashboard-tutorial-card.tsx +++ b/src/components/dashboard/landing/components/dashboard-tutorial-card.tsx @@ -1,4 +1,4 @@ -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { ArrowUpRight } from 'lucide-react'; diff --git a/src/components/dashboard/layout/sidebar.tsx b/src/components/dashboard/layout/sidebar.tsx index e8d81b0..15bc9be 100644 --- a/src/components/dashboard/layout/sidebar.tsx +++ b/src/components/dashboard/layout/sidebar.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Album, CreditCard, Home, User } from 'lucide-react'; +import { Album, CreditCard, Home } from 'lucide-react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { cn } from '@/lib/utils'; diff --git a/src/components/dashboard/subscriptions/components/subscription-cards.tsx b/src/components/dashboard/subscriptions/components/subscription-cards.tsx index 670abb3..c58bfce 100644 --- a/src/components/dashboard/subscriptions/components/subscription-cards.tsx +++ b/src/components/dashboard/subscriptions/components/subscription-cards.tsx @@ -1,11 +1,11 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { ArrowRight, DollarSign } from 'lucide-react'; +import { ArrowRight } from 'lucide-react'; import Link from 'next/link'; import { Status } from '@/components/shared/status/status'; import { Subscription } from '@paddle/paddle-node-sdk'; import { cn } from '@/lib/utils'; import Image from 'next/image'; -import { convertAmountFromLowestUnit, parseMoney } from '@/utils/paddle/parse-money'; +import { parseMoney } from '@/utils/paddle/parse-money'; interface Props { subscriptions: Subscription[]; diff --git a/src/components/dashboard/subscriptions/components/subscription-detail.tsx b/src/components/dashboard/subscriptions/components/subscription-detail.tsx index bc7f349..6fb14bb 100644 --- a/src/components/dashboard/subscriptions/components/subscription-detail.tsx +++ b/src/components/dashboard/subscriptions/components/subscription-detail.tsx @@ -9,7 +9,6 @@ import { SubscriptionHeader } from '@/components/dashboard/subscriptions/compone import { Separator } from '@/components/ui/separator'; import { ErrorContent } from '@/components/dashboard/layout/error-content'; import { useEffect, useState } from 'react'; -import { Subscription, Transaction } from '@paddle/paddle-node-sdk'; import { LoadingScreen } from '@/components/dashboard/layout/loading-screen'; import { SubscriptionDetailResponse, TransactionResponse } from '@/lib/api.types'; diff --git a/src/components/home/header/header.tsx b/src/components/home/header/header.tsx index 3efcd15..760008f 100644 --- a/src/components/home/header/header.tsx +++ b/src/components/home/header/header.tsx @@ -1,7 +1,5 @@ import Link from 'next/link'; import { User } from '@supabase/supabase-js'; -import { createClient } from '@/utils/supabase/client'; -import { MouseEvent } from 'react'; import Image from 'next/image'; import { Button } from '@/components/ui/button'; diff --git a/src/utils/supabase/middleware.ts b/src/utils/supabase/middleware.ts index ca6eb7b..2e151dd 100644 --- a/src/utils/supabase/middleware.ts +++ b/src/utils/supabase/middleware.ts @@ -1,5 +1,5 @@ -import { createServerClient, type CookieOptions } from '@supabase/ssr'; -import { NextResponse, type NextRequest } from 'next/server'; +import { type CookieOptions, createServerClient } from '@supabase/ssr'; +import { type NextRequest, NextResponse } from 'next/server'; export async function updateSession(request: NextRequest) { let response = NextResponse.next({ diff --git a/src/utils/supabase/server-internal.ts b/src/utils/supabase/server-internal.ts index 18d7089..e426960 100644 --- a/src/utils/supabase/server-internal.ts +++ b/src/utils/supabase/server-internal.ts @@ -1,4 +1,4 @@ -import { createServerClient, type CookieOptions } from '@supabase/ssr'; +import { type CookieOptions, createServerClient } from '@supabase/ssr'; import { cookies } from 'next/headers'; export function createClient() { diff --git a/src/utils/supabase/server.ts b/src/utils/supabase/server.ts index ff6d040..f93f5f5 100644 --- a/src/utils/supabase/server.ts +++ b/src/utils/supabase/server.ts @@ -1,4 +1,4 @@ -import { createServerClient, type CookieOptions } from '@supabase/ssr'; +import { type CookieOptions, createServerClient } from '@supabase/ssr'; import { cookies } from 'next/headers'; export function createClient() {