import { getLongUrl, getUrlStats } from '@/lib/db' import Redirect from '@/components/Redirect' import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" import { Progress } from "@/components/ui/progress" import { Clock, Link, BarChart2, AlertTriangle } from 'lucide-react' export default async function RedirectPage({ params }: { params: { shortCode: string } }) { const { longUrl, expired } = getLongUrl(params.shortCode) const stats = getUrlStats(params.shortCode) if (longUrl && stats) { return ( <> ) } return (
{expired ? 'Link Expired' : 'Link Not Found'}

{expired ? 'Sorry, this short link has expired.' : 'The requested short link does not exist.'}

Report abusive content:{' '} report@example.com

) } function LandingPage({ longUrl, shortCode, visits, expiresAt }: { longUrl: string shortCode: string visits: number expiresAt: string | null }) { return (
You are being redirected You will be redirected to your destination in 5 seconds.

Short URL: {`${process.env.NEXT_PUBLIC_BASE_URL}/s/${shortCode}`}

Visits: {visits}

Destination: {longUrl}

Expires at: {expiresAt ? new Date(expiresAt).toLocaleString() : 'Never'}

Disclaimer

This link will take you to an external website. We are not responsible for the content of external sites. Please proceed with caution.

Advertisement

This could be your ad! Contact us for advertising opportunities.

Report abusive content:{' '} report@example.com

) }