diff --git a/package.json b/package.json index 466b688..f2fab82 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ }, "dependencies": { "@clerk/nextjs": "^6.5.1", + "@emoji-mart/data": "^1.2.1", + "@emoji-mart/react": "^1.1.1", "@libsql/client": "^0.14.0", "@nivo/bar": "^0.88.0", "@nivo/core": "^0.88.0", @@ -20,6 +22,7 @@ "@radix-ui/react-dialog": "^1.1.3", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-label": "^2.1.0", + "@radix-ui/react-popover": "^1.1.4", "@radix-ui/react-progress": "^1.1.0", "@radix-ui/react-radio-group": "^1.2.1", "@radix-ui/react-scroll-area": "^1.2.1", @@ -27,6 +30,7 @@ "@radix-ui/react-separator": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-tabs": "^1.1.1", + "@radix-ui/react-toast": "^1.2.4", "@radix-ui/react-tooltip": "^1.1.4", "ably": "^2.6.0", "class-variance-authority": "^0.7.1", @@ -36,10 +40,13 @@ "dotenv": "^16.4.5", "drizzle-orm": "^0.36.4", "embla-carousel-react": "^8.5.1", + "emoji-mart": "^5.6.0", "framer-motion": "^11.15.0", "jotai": "^2.10.3", "lodash.debounce": "^4.0.8", "lucide-react": "^0.462.0", + "moment": "^2.30.1", + "moment-timezone": "^0.5.46", "next": "14.2.16", "next-themes": "^0.4.4", "react": "^18", diff --git a/src/app/(dashboard)/chat/page.tsx b/src/app/(dashboard)/chat/page.tsx index da11c09..71df3e0 100644 --- a/src/app/(dashboard)/chat/page.tsx +++ b/src/app/(dashboard)/chat/page.tsx @@ -1,7 +1,41 @@ import { ChatScreen } from "@/src/components/dashboard/Chat"; +import { SelectChat } from "@/src/db/schema"; +import { GetChatBySlugWithMessagesAction, GetUserChatsAction } from "@/src/server-actions/Chat/Chat"; -export default function ChatPage() { - return +interface ChatPageProps { + searchParams:{ + active_chat?: string + } +} + +export default async function ChatPage({ searchParams }: ChatPageProps) { + let currentChat : SelectChat | undefined = undefined + let allChats : SelectChat[] = [] + let selectedCurrectChatSlug = null + + const chatsRes = await GetUserChatsAction() + if(chatsRes?.success && chatsRes?.data){ + allChats = chatsRes.data + } + + if( allChats.length > 0 ){ + + if(searchParams.active_chat){ + selectedCurrectChatSlug = searchParams.active_chat + }else{ + selectedCurrectChatSlug = allChats[0].chat_slug + } + + const currentChatRes = await GetChatBySlugWithMessagesAction(selectedCurrectChatSlug) + if(currentChatRes.success){ + currentChat = currentChatRes.data + } + } + + + return ( + + ) } diff --git a/src/app/(dashboard)/dashboard/page.tsx b/src/app/(dashboard)/dashboard/page.tsx index 75b417c..51db812 100644 --- a/src/app/(dashboard)/dashboard/page.tsx +++ b/src/app/(dashboard)/dashboard/page.tsx @@ -1,4 +1,4 @@ -import { AnalyticsDashboard } from '@/src/components/dashboard/AnalyticsDashboard' +import AnalyticsDashboard from '@/src/components/dashboard/AnalyticsDashboard' import React from 'react' const page = () => { diff --git a/src/app/(dashboard)/layout.tsx b/src/app/(dashboard)/layout.tsx index cb8ac14..f9fc7b4 100644 --- a/src/app/(dashboard)/layout.tsx +++ b/src/app/(dashboard)/layout.tsx @@ -12,7 +12,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
-
+
{children}
diff --git a/src/app/(dashboard)/posts/page.tsx b/src/app/(dashboard)/posts/page.tsx index d566cc2..b1ef0e5 100644 --- a/src/app/(dashboard)/posts/page.tsx +++ b/src/app/(dashboard)/posts/page.tsx @@ -2,12 +2,8 @@ import { useState } from "react" import PostFeed from "@/src/components/dashboard/post-feed" -import { - Post, - PostFile, - PostPoll -} from "@/src/components/dashboard/Posts/types/posts-types" import CreatePostForm from "@/src/components/dashboard/create-post-form" +import { Post, PostFile, PostPoll } from "@/src/components/dashboard/posts/types/posts-types" const samplePosts: (Post | PostFile | PostPoll)[] = [ { diff --git a/src/app/(home)/layout.tsx b/src/app/(home)/layout.tsx index a55b18a..064e173 100644 --- a/src/app/(home)/layout.tsx +++ b/src/app/(home)/layout.tsx @@ -10,9 +10,9 @@ const PublicLayout = ({ children }: { children: ReactNode }) => { return ( <>
-
- {children} -
+
+ {children} +