Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions client/src/components/Nav/NewChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down