🗨️ refactor: Open New Tab for Ctrl+Click or Button Combo in NewChat (#1484)

This commit is contained in:
Danny Avila 2024-01-03 19:34:41 -05:00 committed by GitHub
parent e1a529b5ae
commit 42f2353509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,15 +6,19 @@ export default function NewChat({ toggleNav }: { toggleNav: () => void }) {
const navigate = useOriginNavigate();
const localize = useLocalize();
const clickHandler = () => {
newConvo();
newConversation();
navigate('new');
toggleNav();
const clickHandler = (event: React.MouseEvent<HTMLAnchorElement>) => {
if (event.button === 0 && !event.ctrlKey) {
event.preventDefault();
newConvo();
newConversation();
navigate('new');
toggleNav();
}
};
return (
<a
href="/"
data-testid="nav-new-chat-button"
onClick={clickHandler}
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"