-
Notifications
You must be signed in to change notification settings - Fork 237
chore(compass-assistant): fix content overflow and resizing of drawer COMPASS-9882 COMPASS-9883 COMPASS-9888 #7373
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
Changes from all commits
eca8b2c
2aed7de
d15d664
561b2fd
ba989a5
33d9047
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ type AssistantActionsContextType = { | |
connectionInfo: ConnectionInfo; | ||
error: Error; | ||
}) => void; | ||
clearChat?: () => void; | ||
clearChat?: () => Promise<void>; | ||
tellMoreAboutInsight?: (context: ProactiveInsightsContext) => void; | ||
ensureOptInAndSend?: ( | ||
message: SendMessage, | ||
|
@@ -98,7 +98,7 @@ export const AssistantActionsContext = | |
interpretExplainPlan: () => {}, | ||
interpretConnectionError: () => {}, | ||
tellMoreAboutInsight: () => {}, | ||
clearChat: () => {}, | ||
clearChat: async () => {}, | ||
ensureOptInAndSend: async () => {}, | ||
}); | ||
|
||
|
@@ -215,7 +215,9 @@ export const AssistantProvider: React.FunctionComponent< | |
'performance insights', | ||
buildProactiveInsightsPrompt | ||
), | ||
clearChat: () => { | ||
clearChat: async () => { | ||
await chat.stop(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drive-by, we do not want to continue streaming after clearing |
||
chat.clearError(); | ||
chat.messages = chat.messages.filter( | ||
(message) => message.metadata?.isPermanent | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,8 @@ const messageFeedFixesStyles = css({ | |
display: 'flex', | ||
flexDirection: 'column-reverse', | ||
overflowY: 'auto', | ||
width: '100%', | ||
wordBreak: 'break-word', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if we should move this to much more targeted elements so that we don't have to turn it off again on things one by one as we find them. Like make sure it is only message text and code blocks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's one of the things that's actually better applied globally and then we set exceptions accordingly. In most cases we'd prefer breaking instead of overflowing with a scrollbar for example |
||
flex: 1, | ||
padding: spacing[400], | ||
gap: spacing[400], | ||
|
@@ -161,6 +163,12 @@ const disclaimerTextStyles = css({ | |
fontSize: 'inherit', | ||
}, | ||
}); | ||
// On small screens, many components end up breaking words which we don't want. | ||
// This is a general temporary fix for all components that we want to prevent from wrapping. | ||
const noWrapFixesStyles = css({ | ||
whiteSpace: 'nowrap', | ||
}); | ||
|
||
/** TODO(COMPASS-9751): This should be handled by Leafygreen's disclaimers update */ | ||
const inputBarStyleFixes = css({ | ||
width: '100%', | ||
|
@@ -400,9 +408,15 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
onSubmitFeedback={(event, state) => | ||
handleFeedback({ message, state }) | ||
} | ||
className={noWrapFixesStyles} | ||
/> | ||
)} | ||
{sources.length > 0 && ( | ||
<Message.Links | ||
className={noWrapFixesStyles} | ||
links={sources} | ||
/> | ||
)} | ||
{sources.length > 0 && <Message.Links links={sources} />} | ||
</Message> | ||
); | ||
})} | ||
|
@@ -423,7 +437,7 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
size="large" | ||
style={{ color: palette.green.dark1 }} | ||
/> | ||
<span>MongoDB Assistant.</span> | ||
<span>MongoDB Assistant</span> | ||
</h4> | ||
<p className={welcomeTextStyles}> | ||
Welcome to the MongoDB Assistant! | ||
|
@@ -446,6 +460,7 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
<DisclaimerText className={disclaimerTextStyles}> | ||
AI can make mistakes. Review for accuracy.{' '} | ||
<Link | ||
className={noWrapFixesStyles} | ||
hideExternalIcon={false} | ||
href={GEN_AI_FAQ_LINK} | ||
target="_blank" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should note that translate -10% is a bit of a hack but at least it's relative to content