From e26069abfa1ea2437d37d7ec805964a9d53456da Mon Sep 17 00:00:00 2001 From: NotII <46204250+NotII@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:24:43 +0000 Subject: [PATCH] FIX --- components/dashboard/NewChatForm.tsx | 11 ++++++++++- components/dashboard/content.tsx | 2 -- components/tables/order-table.tsx | 27 ++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/components/dashboard/NewChatForm.tsx b/components/dashboard/NewChatForm.tsx index 6225cf2..1f55d02 100644 --- a/components/dashboard/NewChatForm.tsx +++ b/components/dashboard/NewChatForm.tsx @@ -1,7 +1,7 @@ "use client" import React, { useState, useEffect } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -14,12 +14,21 @@ import { getCookie } from "@/lib/client-utils"; export default function NewChatForm() { const router = useRouter(); + const searchParams = useSearchParams(); const [buyerId, setBuyerId] = useState(""); const [initialMessage, setInitialMessage] = useState(""); const [loading, setLoading] = useState(false); const [vendorStores, setVendorStores] = useState<{ _id: string, name: string }[]>([]); const [selectedStore, setSelectedStore] = useState(""); + // Parse URL parameters for buyerId + useEffect(() => { + const buyerIdParam = searchParams.get('buyerId'); + if (buyerIdParam) { + setBuyerId(buyerIdParam); + } + }, [searchParams]); + // Fetch vendor stores useEffect(() => { const fetchVendorStores = async () => { diff --git a/components/dashboard/content.tsx b/components/dashboard/content.tsx index 9a53cd4..57ff5a3 100644 --- a/components/dashboard/content.tsx +++ b/components/dashboard/content.tsx @@ -9,8 +9,6 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com import { ShoppingCart } from "lucide-react" import { ArrowUpCircle, CreditCard, DollarSign, Users } from "lucide-react" import { Skeleton } from "@/components/ui/skeleton" -import { OrderStats as DashboardOrderStats } from "@/components/dashboard/order-stats" -import OrderStatsData from "@/types/orderStats" interface ContentProps { username: string diff --git a/components/tables/order-table.tsx b/components/tables/order-table.tsx index 4f0b84e..9dd2c7f 100644 --- a/components/tables/order-table.tsx +++ b/components/tables/order-table.tsx @@ -27,6 +27,7 @@ import { ChevronRight, ArrowUpDown, Truck, + MessageCircle } from "lucide-react"; import Link from "next/link"; import { clientFetch } from '@/lib/client-utils'; @@ -51,6 +52,7 @@ interface Order { totalPrice: number; orderDate: Date; telegramUsername?: string; + telegramBuyerId?: string; } type SortableColumns = "orderId" | "totalPrice" | "status" | "orderDate"; @@ -411,11 +413,26 @@ export default function OrderTable() { {order.telegramUsername ? `@${order.telegramUsername}` : "-"} - +
+ + + {(order.telegramBuyerId || order.telegramUsername) && ( + + )} +
);