From 2cca68272a972c8615d63f9caeff66057eac2ecc Mon Sep 17 00:00:00 2001 From: bill Date: Mon, 10 Feb 2025 17:36:54 +0800 Subject: [PATCH] Feat: Add ChatCard #3221 --- web/src/pages/next-chat/chat-card.tsx | 50 +++++++++++++++++++++++++++ web/src/pages/next-chat/index.tsx | 23 ++++++++++-- web/src/utils/date.ts | 7 ++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 web/src/pages/next-chat/chat-card.tsx diff --git a/web/src/pages/next-chat/chat-card.tsx b/web/src/pages/next-chat/chat-card.tsx new file mode 100644 index 00000000000..aea15f4b6bf --- /dev/null +++ b/web/src/pages/next-chat/chat-card.tsx @@ -0,0 +1,50 @@ +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent } from '@/components/ui/card'; +import { IDialog } from '@/interfaces/database/chat'; +import { formatPureDate } from '@/utils/date'; +import { ChevronRight, Trash2 } from 'lucide-react'; + +interface IProps { + data: IDialog; +} + +export function ChatCard({ data }: IProps) { + return ( + + +
+ {data.icon ? ( +
+ ) : ( + + + CN + + )} +
+

{data.name}

+

An app that does things An app that does things

+
+
+ Search app +

+ {formatPureDate(data.update_time)} +

+
+
+ + +
+
+ + + ); +} diff --git a/web/src/pages/next-chat/index.tsx b/web/src/pages/next-chat/index.tsx index 1342c631e89..eb3f9146388 100644 --- a/web/src/pages/next-chat/index.tsx +++ b/web/src/pages/next-chat/index.tsx @@ -1,3 +1,22 @@ -export default function Chat() { - return
chat
; +import ListFilterBar from '@/components/list-filter-bar'; +import { useFetchNextDialogList } from '@/hooks/chat-hooks'; +import { Plus } from 'lucide-react'; +import { ChatCard } from './chat-card'; + +export default function ChatList() { + const { data: chatList } = useFetchNextDialogList(); + + return ( +
+ + + Create app + +
+ {chatList.map((x) => { + return ; + })} +
+
+ ); } diff --git a/web/src/utils/date.ts b/web/src/utils/date.ts index 5222cce97bf..8515cc29cd8 100644 --- a/web/src/utils/date.ts +++ b/web/src/utils/date.ts @@ -25,3 +25,10 @@ export function lastDay() { export function lastWeek() { return formatDate(dayjs().subtract(1, 'weeks')); } + +export function formatPureDate(date: any) { + if (!date) { + return ''; + } + return dayjs(date).format('DD/MM/YYYY'); +}