Feat: Add Sessions component #3221 (#4865)

### What problem does this PR solve?

Feat: Add Sessions component #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-02-11 13:11:15 +08:00
committed by GitHub
parent 0d3ed37b48
commit f34b913bd8
11 changed files with 130 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { IDialog } from '@/interfaces/database/chat';
import { formatPureDate } from '@/utils/date';
import { ChevronRight, Trash2 } from 'lucide-react';
@ -10,6 +11,8 @@ interface IProps {
}
export function ChatCard({ data }: IProps) {
const { navigateToChat } = useNavigatePage();
return (
<Card className="bg-colors-background-inverse-weak border-colors-outline-neutral-standard">
<CardContent className="p-4">
@ -36,7 +39,7 @@ export function ChatCard({ data }: IProps) {
</p>
</div>
<div className="space-x-2">
<Button variant="icon" size="icon">
<Button variant="icon" size="icon" onClick={navigateToChat}>
<ChevronRight className="h-6 w-6" />
</Button>
<Button variant="icon" size="icon">

View File

@ -0,0 +1,3 @@
export function AppSettings() {
return <section className="p-6 w-[400px] max-w-[20%]">app-settings</section>;
}

View File

@ -0,0 +1,3 @@
export function ChatBox() {
return <section className="border-x flex-1">ChatBox</section>;
}

View File

@ -0,0 +1,31 @@
import { PageHeader } from '@/components/page-header';
import { Button } from '@/components/ui/button';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { EllipsisVertical } from 'lucide-react';
import { AppSettings } from './app-settings';
import { ChatBox } from './chat-box';
import { Sessions } from './sessions';
export default function Chat() {
const { navigateToChatList } = useNavigatePage();
return (
<section className="h-full flex flex-col">
<PageHeader back={navigateToChatList} title="Chat app 01">
<div className="flex items-center gap-2">
<Button variant={'icon'} size={'icon'}>
<EllipsisVertical />
</Button>
<Button variant={'tertiary'} size={'sm'}>
Publish
</Button>
</div>
</PageHeader>
<div className="flex flex-1">
<Sessions></Sessions>
<ChatBox></ChatBox>
<AppSettings></AppSettings>
</div>
</section>
);
}

View File

@ -0,0 +1,38 @@
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { EllipsisVertical, Plus } from 'lucide-react';
function SessionCard() {
return (
<Card className="bg-colors-background-inverse-weak border-colors-outline-neutral-standard">
<CardContent className="px-3 py-2 flex justify-between items-center">
xxx
<Button variant={'icon'} size={'icon'}>
<EllipsisVertical />
</Button>
</CardContent>
</Card>
);
}
export function Sessions() {
const sessionList = new Array(10).fill(1);
return (
<section className="p-6 w-[400px] max-w-[20%]">
<div className="flex justify-between items-center mb-4">
<span className="text-colors-text-neutral-strong text-2xl font-bold">
Sessions
</span>
<Button variant={'icon'} size={'icon'}>
<Plus></Plus>
</Button>
</div>
<div className="space-y-4">
{sessionList.map((x) => (
<SessionCard key={x.id}></SessionCard>
))}
</div>
</section>
);
}

View File

@ -1,6 +1,5 @@
import { Button } from '@/components/ui/button';
import { PageHeader } from '@/components/page-header';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { ArrowLeft } from 'lucide-react';
import { Outlet } from 'umi';
import { SideBar } from './sidebar';
@ -9,7 +8,7 @@ export default function ProfileSetting() {
return (
<div className="flex flex-col w-full h-screen bg-background text-foreground">
<header className="flex items-center border-b">
{/* <header className="flex items-center border-b">
<div className="flex items-center border-r p-1.5">
<Button variant="ghost" size="icon" onClick={navigateToHome}>
<ArrowLeft className="w-5 h-5" />
@ -20,7 +19,9 @@ export default function ProfileSetting() {
Profile & settings
</h1>
</div>
</header>
</header> */}
<PageHeader title="Profile & settings" back={navigateToHome}></PageHeader>
<div className="flex flex-1 bg-muted/50">
<SideBar></SideBar>