Skip to content

Commit 95ddec6

Browse files
committed
chore: fix check, add whiteSpace: 'pre-wrap' for nicer placeholder formatting
1 parent 9fc210d commit 95ddec6

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

package-lock.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-assistant/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"use-sync-external-store": "^1.5.0"
6060
},
6161
"devDependencies": {
62-
"react-dom": "^17.0.2",
6362
"throttleit": "^2.1.0",
6463
"@mongodb-js/eslint-config-compass": "^1.4.5",
6564
"@mongodb-js/mocha-config-compass": "^1.7.0",

packages/compass-assistant/src/assistant-chat.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback, useState } from 'react';
22
import type { UIMessage } from './@ai-sdk/react/use-chat';
33

4-
interface AsisstantChatProps {
4+
interface AssistantChatProps {
55
messages: UIMessage[];
66
onSendMessage?: (message: string) => void;
77
}
@@ -10,7 +10,7 @@ interface AsisstantChatProps {
1010
* This component is currently using placeholders as Leafygreen UI updates are not available yet.
1111
* Before release, we will replace this with the actual Leafygreen chat components.
1212
*/
13-
export const AsisstantChat: React.FunctionComponent<AsisstantChatProps> = ({
13+
export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
1414
messages,
1515
onSendMessage,
1616
}) => {
@@ -60,6 +60,7 @@ export const AsisstantChat: React.FunctionComponent<AsisstantChatProps> = ({
6060
alignSelf: message.role === 'user' ? 'flex-end' : 'flex-start',
6161
maxWidth: '80%',
6262
wordWrap: 'break-word',
63+
whiteSpace: 'pre-wrap',
6364
}}
6465
>
6566
{message.parts

packages/compass-assistant/src/assistant-provider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DrawerSection } from '@mongodb-js/compass-components';
22
import React, { type PropsWithChildren, useCallback, useRef } from 'react';
33
import { type UIMessage, useChat } from './@ai-sdk/react/use-chat';
44
import type { Chat } from './@ai-sdk/react/chat.react';
5-
import { AsisstantChat } from './assistant-chat';
5+
import { AssistantChat } from './assistant-chat';
66
import { usePreference } from 'compass-preferences-model/provider';
77

88
export const ASSISTANT_DRAWER_ID = 'compass-assistant-drawer';
@@ -53,7 +53,7 @@ export const AssistantProvider: React.FunctionComponent<
5353
label="MongoDB Assistant"
5454
glyph="Sparkle"
5555
>
56-
<AsisstantChat
56+
<AssistantChat
5757
messages={messages}
5858
onSendMessage={handleMessageSend}
5959
/>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
22
import { render } from '@mongodb-js/testing-library-compass';
33
import { CompassAssistantProvider } from './index';
4+
import { expect } from 'chai';
45

56
describe('Compass Assistant', function () {
67
const CompassAssistant = CompassAssistantProvider.withMockServices({});
78

89
it('renders a Plugin', function () {
9-
render(<CompassAssistant></CompassAssistant>);
10+
expect(() => render(<CompassAssistant></CompassAssistant>)).to.not.throw;
1011
});
1112
});

0 commit comments

Comments
 (0)