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 (
<>
{expired ? 'Sorry, this short link has expired.' : 'The requested short link does not exist.'}
Report abusive content:{' '} report@example.com
Short URL: {`${process.env.NEXT_PUBLIC_BASE_URL}/s/${shortCode}`}
Visits: {visits}
Destination: {longUrl}
Expires at: {expiresAt ? new Date(expiresAt).toLocaleString() : 'Never'}
This link will take you to an external website. We are not responsible for the content of external sites. Please proceed with caution.
This could be your ad! Contact us for advertising opportunities.
Report abusive content:{' '} report@example.com