diff --git a/app/chat/layout.tsx b/app/chat/layout.tsx index 6f8bf07..d4f2bd8 100644 --- a/app/chat/layout.tsx +++ b/app/chat/layout.tsx @@ -5,9 +5,6 @@ import { headers } from "next/headers"; import { getUserChats } from "@/lib/data/chat"; import { redirect } from "next/navigation"; -// Sidebar width configuration matching the original ChatInterface -const SIDEBAR_WIDTH = "300px"; - export default async function ChatLayout({ children, }: { @@ -26,25 +23,16 @@ export default async function ChatLayout({ const initialChats = await getUserChats(session.user.id); return ( - +
-
- -
+ {children} diff --git a/app/chat/loading.tsx b/app/chat/loading.tsx index fcde29a..686671d 100644 --- a/app/chat/loading.tsx +++ b/app/chat/loading.tsx @@ -3,34 +3,44 @@ import { Skeleton } from "@/components/ui/skeleton"; export default function Loading() { return (
-
-
- -
-
- - - - -
-
-
-
- -
-
-
- - +
+
+
+
+ + +
+
-
- - +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - + +
+ + +
+ +
diff --git a/app/favicon.ico b/app/favicon.ico deleted file mode 100644 index 718d6fe..0000000 Binary files a/app/favicon.ico and /dev/null differ diff --git a/app/layout.tsx b/app/layout.tsx index 40a4e57..7dd0052 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,7 @@ import type React from "react"; import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; import { ThemeProvider } from "@/components/theme-provider"; +import { TooltipProvider } from "@/components/ui/tooltip"; import "./globals.css"; import { Toaster } from "@/components/ui/sonner"; @@ -13,21 +14,9 @@ export const metadata: Metadata = { description: "Intelligent chatbot with document understanding capabilities", generator: "Next.js", icons: { - icon: [ - { - url: "/icon-light-32x32.png", - media: "(prefers-color-scheme: light)", - }, - { - url: "/icon-dark-32x32.png", - media: "(prefers-color-scheme: dark)", - }, - { - url: "/icon.svg", - type: "image/svg+xml", - }, - ], - apple: "/apple-icon.png", + icon: "/icon.png", + shortcut: "/icon.png", + apple: "/icon.png", }, }; @@ -45,7 +34,7 @@ export default function RootLayout({ enableSystem disableTransitionOnChange > - {children} + {children} diff --git a/components/chat-area.tsx b/components/chat-area.tsx index 109b804..4488433 100644 --- a/components/chat-area.tsx +++ b/components/chat-area.tsx @@ -8,8 +8,15 @@ import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Separator } from "@/components/ui/separator"; +import { SidebarTrigger } from "@/components/ui/sidebar"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { cn } from "@/lib/utils"; +import { + formatChatLongDate, + formatChatTime, + getStableDayKey, + parseTimestampToMs, +} from "@/lib/date-format"; // Import shared types import type { Chat as ChatModel, Message } from "@/lib/types"; import { @@ -19,29 +26,6 @@ import { } from "@/lib/actions/chat"; import { toast } from "sonner"; -const STABLE_LOCALE = "en-IN"; -const STABLE_TIME_ZONE = "Asia/Kolkata"; - -const stableTimeFormatter = new Intl.DateTimeFormat(STABLE_LOCALE, { - hour: "2-digit", - minute: "2-digit", - timeZone: STABLE_TIME_ZONE, -}); - -const stableDateFormatter = new Intl.DateTimeFormat(STABLE_LOCALE, { - year: "numeric", - month: "long", - day: "numeric", - timeZone: STABLE_TIME_ZONE, -}); - -const stableDayKeyFormatter = new Intl.DateTimeFormat(STABLE_LOCALE, { - year: "numeric", - month: "2-digit", - day: "2-digit", - timeZone: STABLE_TIME_ZONE, -}); - interface ChatAreaProps { currentChat: ChatModel | undefined; messages: Message[]; @@ -84,32 +68,6 @@ export function ChatArea({ nameParts.length > 1 ? nameParts[nameParts.length - 1][0] : ""; const userInitials = `${firstInitial}${lastInitial}`.toUpperCase(); - const parseTimestamp = (timestamp: string): number | null => { - const ms = Date.parse(timestamp); - return Number.isNaN(ms) ? null : ms; - }; - - const getStableDayKey = (timestamp: number): string => { - const parts = stableDayKeyFormatter.formatToParts(new Date(timestamp)); - const year = parts.find((part) => part.type === "year")?.value; - const month = parts.find((part) => part.type === "month")?.value; - const day = parts.find((part) => part.type === "day")?.value; - - if (!year || !month || !day) { - return ""; - } - - return `${year}-${month}-${day}`; - }; - - const formatTime = (timestamp: number): string => { - return stableTimeFormatter.format(new Date(timestamp)); - }; - - const formatLongDate = (timestamp: number): string => { - return stableDateFormatter.format(new Date(timestamp)); - }; - useEffect(() => { const container = messagesContainerRef.current; if (!container) return; @@ -260,15 +218,18 @@ export function ChatArea({
-
-

- {currentChat.title} -

-

- {currentChat.documentCount === 0 - ? "No documents uploaded" - : `${currentChat.documentCount} ${currentChat.documentCount === 1 ? "document" : "documents"} uploaded`} -

+
+ +
+

+ {currentChat.title} +

+

+ {currentChat.documentCount === 0 + ? "No documents uploaded" + : `${currentChat.documentCount} ${currentChat.documentCount === 1 ? "document" : "documents"} uploaded`} +

+