diff --git a/dashboard/src/components/dashboard/KlaviyoCampaigns.jsx b/dashboard/src/components/dashboard/KlaviyoCampaigns.jsx index 4b2b568..e816597 100644 --- a/dashboard/src/components/dashboard/KlaviyoCampaigns.jsx +++ b/dashboard/src/components/dashboard/KlaviyoCampaigns.jsx @@ -16,7 +16,7 @@ import { } from "@/components/ui/select"; import { Button } from "@/components/ui/button"; import { TIME_RANGES } from "@/lib/constants"; -import { Mail, MessageSquare, ArrowUpDown } from "lucide-react"; +import { Mail, MessageSquare, ArrowUpDown, BookOpen } from "lucide-react"; import { Skeleton } from "@/components/ui/skeleton"; // Helper functions for formatting @@ -41,67 +41,67 @@ const TableSkeleton = () => ( - - - - - - {[...Array(15)].map((_, i) => ( - + @@ -112,7 +112,7 @@ const TableSkeleton = () => ( // Error alert component const ErrorAlert = ({ description }) => ( -
+
{description}
); @@ -130,8 +130,8 @@ const MetricCell = ({ if (isSMS && hideForSMS) { return (
); } @@ -141,7 +141,7 @@ const MetricCell = ({
{isMonetary ? formatCurrency(value) : formatRate(value, isSMS, hideForSMS)}
-
+
{count?.toLocaleString() || 0} {count === 1 ? "recipient" : "recipients"} {showConversionRate && totalRecipients > 0 && @@ -156,7 +156,7 @@ const KlaviyoCampaigns = ({ className }) => { const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); const [searchTerm, setSearchTerm] = useState(""); - const [selectedChannels, setSelectedChannels] = useState({ email: true, sms: true }); + const [selectedChannels, setSelectedChannels] = useState({ email: true, sms: true, blog: true }); const [selectedTimeRange, setSelectedTimeRange] = useState("last7days"); const [sortConfig, setSortConfig] = useState({ key: "send_time", @@ -222,25 +222,28 @@ const KlaviyoCampaigns = ({ className }) => { // Filter campaigns by search term and channels const filteredCampaigns = sortedCampaigns.filter( - (campaign) => - campaign?.name?.toLowerCase().includes((searchTerm || "").toLowerCase()) && - selectedChannels[campaign?.channel] + (campaign) => { + const isBlog = campaign?.name?.includes("_Blog"); + const channelType = isBlog ? "blog" : campaign?.channel; + return campaign?.name?.toLowerCase().includes((searchTerm || "").toLowerCase()) && + selectedChannels[channelType]; + } ); if (isLoading) { return ( - +
- +
- - + +
- +
@@ -252,7 +255,7 @@ const KlaviyoCampaigns = ({ className }) => { } return ( - + {error && }
@@ -277,6 +280,14 @@ const KlaviyoCampaigns = ({ className }) => { SMS +
- + + - + + - + + - + + - + + - + +
- +
- - - + + +
- - + +
- - + +
- - + +
- - + +
- - + +
-
N/A
-
-
+
N/A
+
-
- - - - - -
+ + + + + +
- {campaign.channel === 'sms' ? ( - + {campaign.name?.includes("_Blog") ? ( + + ) : campaign.channel === 'sms' ? ( + ) : ( - + )}
{campaign.name}
-
+
{campaign.subject}
-
+
{campaign.send_time ? DateTime.fromISO(campaign.send_time).toLocaleString(DateTime.DATETIME_MED) : "No date"} @@ -385,11 +398,11 @@ const KlaviyoCampaigns = ({ className }) => {

{campaign.name}

{campaign.subject}

-

+

{campaign.send_time ? DateTime.fromISO(campaign.send_time).toLocaleString(DateTime.DATETIME_MED) : "No date"}