import { motion } from "framer-motion"; import { Plus, Send } from "lucide-react"; import Link from "next/link"; import React from "react"; import { Badge, Card, Empty, Skeleton } from "../../components"; import { Dashboard } from "../../layouts"; import { useCampaigns } from "../../lib/hooks/campaigns"; /** * */ export default function Index() { const { data: campaigns } = useCampaigns(); return ( <> New } > {campaigns ? ( campaigns.length > 0 ? ( <>
{campaigns.map((c) => { return ( <>

{c.subject}

Quick Stats

{c.status === "DELIVERED" ? ( <>

{c.emails.length > 0 ? Math.round((c.emails.filter((e) => e.status === "OPENED").length / c.emails.length) * 100) : 0} %

{c.tasks.length > 0 && (

{c.tasks.length}

)} ) : ( <>

Awaiting delivery

)}

Properties

{c.status === "DRAFT" ? ( Draft ) : ( 0 ? "info" : "success"}> {c.tasks.length > 0 ? "Sending" : "Delivered"} )}

{c.status !== "DRAFT" && c.tasks.length === 0 && (

{new Date(c.delivered!).toLocaleTimeString()}

{new Date(c.delivered!).toDateString()}

)}
{c.status === "DELIVERED" ? ( <> ) : ( <> )} {c.status === "DELIVERED" ? "View" : "Edit"}
); })}
) : ( ) ) : ( )}
); }