diff --git a/dashboard/src/components/dashboard/ProductGrid.jsx b/dashboard/src/components/dashboard/ProductGrid.jsx
index 51d067d..5721733 100644
--- a/dashboard/src/components/dashboard/ProductGrid.jsx
+++ b/dashboard/src/components/dashboard/ProductGrid.jsx
@@ -19,28 +19,13 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Input } from "@/components/ui/input";
-import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
-import {
- DropdownMenu,
- DropdownMenuCheckboxItem,
- DropdownMenuContent,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu";
-import {
- TIME_RANGES,
- formatDateForInput,
- parseDateFromInput,
-} from "@/lib/constants";
+import { TIME_RANGES } from "@/lib/constants";
import { cn } from "@/lib/utils";
import { Skeleton } from "@/components/ui/skeleton";
const ProductGrid = ({
timeRange = "today",
- startDate,
- endDate,
onTimeRangeChange,
title = "Top Products",
description
@@ -49,10 +34,6 @@ const ProductGrid = ({
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [selectedTimeRange, setSelectedTimeRange] = useState(timeRange);
- const [customDateRange, setCustomDateRange] = useState({
- startDate: formatDateForInput(startDate) || "",
- endDate: formatDateForInput(endDate) || "",
- });
const [sorting, setSorting] = useState({
column: "totalQuantity",
direction: "desc",
@@ -61,27 +42,15 @@ const ProductGrid = ({
useEffect(() => {
fetchProducts();
- }, [selectedTimeRange, customDateRange.startDate, customDateRange.endDate]);
+ }, [selectedTimeRange]);
const fetchProducts = async () => {
try {
setLoading(true);
setError(null);
- const params =
- selectedTimeRange === "custom"
- ? {
- startDate: parseDateFromInput(
- customDateRange.startDate
- )?.toISOString(),
- endDate: parseDateFromInput(
- customDateRange.endDate
- )?.toISOString(),
- }
- : { timeRange: selectedTimeRange };
-
const response = await axios.get("/api/klaviyo/events/products", {
- params,
+ params: { timeRange: selectedTimeRange },
});
setProducts(response.data.stats.products.list || []);
} catch (error) {
@@ -224,48 +193,8 @@ const ProductGrid = ({
{range.label}
))}
-