Реализованы задачи бэклога 1-5 (1я не до конца)
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
import { MessageSquare, Clock, ArrowLeft } from 'lucide-react';
|
||||
import { useNavigate } from 'react-router';
|
||||
|
||||
interface ChatSession {
|
||||
id: string;
|
||||
title: string;
|
||||
lastMessage: string;
|
||||
timestamp: string;
|
||||
unread?: boolean;
|
||||
}
|
||||
|
||||
const chatHistory: ChatSession[] = [
|
||||
{
|
||||
id: '1',
|
||||
title: 'Продление патента',
|
||||
lastMessage: 'Спасибо за помощь! Я понял что нужно делать.',
|
||||
timestamp: 'Сегодня, 14:30',
|
||||
unread: false
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
title: 'Документы для РВП',
|
||||
lastMessage: 'Какие документы нужны для подачи на РВП?',
|
||||
timestamp: 'Вчера, 18:45',
|
||||
unread: false
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
title: 'Регистрация по месту жительства',
|
||||
lastMessage: 'HAN: Вам нужно обратиться в МФЦ с паспортом и...',
|
||||
timestamp: '20 мая, 10:15',
|
||||
unread: false
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
title: 'Оплата патента',
|
||||
lastMessage: 'Где можно оплатить патент?',
|
||||
timestamp: '18 мая, 16:20',
|
||||
unread: false
|
||||
},
|
||||
];
|
||||
|
||||
export function History() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<div className="px-4 py-4">
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<button
|
||||
onClick={() => navigate('/')}
|
||||
className="flex items-center justify-center w-9 h-9 rounded-full hover:bg-muted transition-colors"
|
||||
aria-label="Назад"
|
||||
>
|
||||
<ArrowLeft className="w-5 h-5" />
|
||||
</button>
|
||||
<div>
|
||||
<h1 className="text-xl font-medium">История общения</h1>
|
||||
<p className="text-sm text-muted-foreground">Все ваши диалоги с HAN</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{chatHistory.map((chat) => (
|
||||
<button
|
||||
key={chat.id}
|
||||
onClick={() => navigate(`/chat/${chat.id}`)}
|
||||
className="w-full bg-card border border-border rounded-lg p-4 flex items-start gap-3 hover:bg-accent/50 transition-colors text-left"
|
||||
>
|
||||
<div className="flex items-center justify-center w-10 h-10 rounded-full bg-primary/10 text-primary flex-shrink-0">
|
||||
<MessageSquare className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-medium text-sm mb-1">{chat.title}</h3>
|
||||
<p className="text-xs text-muted-foreground line-clamp-1 mb-2">
|
||||
{chat.lastMessage}
|
||||
</p>
|
||||
<div className="flex items-center gap-1 text-xs text-muted-foreground">
|
||||
<Clock className="w-3 h-3" />
|
||||
<span>{chat.timestamp}</span>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user