2023-10-10 15:04:44 -04:00
|
|
|
import { useNavigate } from 'react-router-dom';
|
2023-09-18 12:55:51 -04:00
|
|
|
import { useLocalize, useConversation } from '~/hooks';
|
2023-02-06 13:27:28 -05:00
|
|
|
|
|
|
|
|
export default function NewChat() {
|
2023-09-18 12:55:51 -04:00
|
|
|
const { newConversation } = useConversation();
|
2023-10-10 15:04:44 -04:00
|
|
|
const navigate = useNavigate();
|
2023-08-14 17:51:03 +02:00
|
|
|
const localize = useLocalize();
|
2023-02-07 16:22:35 -05:00
|
|
|
|
|
|
|
|
const clickHandler = () => {
|
2023-03-28 20:36:21 +08:00
|
|
|
newConversation();
|
2023-10-10 15:04:44 -04:00
|
|
|
navigate('/chat/new');
|
2023-02-07 16:22:35 -05:00
|
|
|
};
|
|
|
|
|
|
2023-02-06 13:27:28 -05:00
|
|
|
return (
|
2023-02-07 16:22:35 -05:00
|
|
|
<a
|
2023-10-09 15:10:23 -04:00
|
|
|
data-testid="new-chat-button"
|
2023-02-07 16:22:35 -05:00
|
|
|
onClick={clickHandler}
|
2023-08-05 19:54:56 +05:30
|
|
|
className="flex h-11 flex-shrink-0 flex-grow cursor-pointer items-center gap-3 rounded-md border border-white/20 px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-500/10"
|
2023-02-07 16:22:35 -05:00
|
|
|
>
|
2023-02-06 13:27:28 -05:00
|
|
|
<svg
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
fill="none"
|
|
|
|
|
strokeWidth="2"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
strokeLinejoin="round"
|
|
|
|
|
className="h-4 w-4"
|
|
|
|
|
height="1em"
|
|
|
|
|
width="1em"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
>
|
2023-05-18 11:09:31 -07:00
|
|
|
<line x1="12" y1="5" x2="12" y2="19" />
|
|
|
|
|
<line x1="5" y1="12" x2="19" y2="12" />
|
2023-02-06 13:27:28 -05:00
|
|
|
</svg>
|
2023-08-14 17:51:03 +02:00
|
|
|
{localize('com_ui_new_chat')}
|
2023-02-06 13:27:28 -05:00
|
|
|
</a>
|
|
|
|
|
);
|
|
|
|
|
}
|