-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: Quality-of-Life Chat/Edit-Message Enhancements (#5194)
* fix: rendering error for mermaid flowchart syntax * feat: add submit button ref and enable submit on Ctrl+Enter in EditMessage component * feat: add save button and keyboard shortcuts for saving and canceling in EditMessage component * feat: collapse chat on max height * refactor: implement scrollable detection for textarea on key down events and initial render * feat: add regenerate button for error handling in HoverButtons, closes #3658 * feat: add functionality to edit latest user message with the up arrow key when the input is empty
- Loading branch information
1 parent
b01c744
commit 8aa1e73
Showing
22 changed files
with
242 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { Minimize2 } from 'lucide-react'; | ||
import { TooltipAnchor } from '~/components/ui'; | ||
import { useLocalize } from '~/hooks'; | ||
import { cn } from '~/utils'; | ||
|
||
const CollapseChat = ({ | ||
isScrollable, | ||
isCollapsed, | ||
setIsCollapsed, | ||
}: { | ||
isScrollable: boolean; | ||
isCollapsed: boolean; | ||
setIsCollapsed: React.Dispatch<React.SetStateAction<boolean>>; | ||
}) => { | ||
const localize = useLocalize(); | ||
if (!isScrollable) { | ||
return null; | ||
} | ||
|
||
if (isCollapsed) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<TooltipAnchor | ||
role="button" | ||
description={localize('com_ui_collapse_chat')} | ||
aria-label={localize('com_ui_collapse_chat')} | ||
onClick={() => setIsCollapsed(true)} | ||
className={cn( | ||
'absolute right-2 top-2 z-10 size-[35px] rounded-full p-2 transition-colors', | ||
'hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-opacity-50', | ||
)} | ||
> | ||
<Minimize2 className="h-full w-full" /> | ||
</TooltipAnchor> | ||
); | ||
}; | ||
|
||
export default CollapseChat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.