Skip to content

Commit 869544f

Browse files
committed
chore(ai-chat-log): typedocs
1 parent 21ff802 commit 869544f

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

packages/paste-core/components/ai-chat-log/stories/scrollableSidePanel.stories.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
SidePanelHeader,
3333
SidePanelPushContentWrapper,
3434
} from "@twilio-paste/side-panel";
35-
3635
import * as React from "react";
3736

3837
import {
@@ -169,7 +168,7 @@ export const SidePanelScroll: StoryFn = () => {
169168
<AIChatMessageAuthor aria-label="AI said">Good Bot</AIChatMessageAuthor>
170169
<AIChatMessageBody>
171170
This is an indicator that the message was filtered (blocked) by Twilio or by the carrier. This may be done
172-
by Twilio for violating Twilio's{" "}
171+
by Twilio for violating Twilio&aposs{" "}
173172
<Anchor href="https://www.twilio.com/en-us/legal/messaging-policy" showExternal>
174173
Messaging Policy
175174
</Anchor>{" "}
@@ -203,7 +202,7 @@ export const SidePanelScroll: StoryFn = () => {
203202
setMounted(true);
204203
}, []);
205204

206-
const scrollToChatEnd = () => {
205+
const scrollToChatEnd = (): void => {
207206
const scrollPosition: any = scrollerRef.current;
208207
const scrollHeight: any = loggerRef.current;
209208
scrollPosition?.scrollTo({ top: scrollHeight.scrollHeight, behavior: "smooth" });
@@ -221,12 +220,12 @@ export const SidePanelScroll: StoryFn = () => {
221220
});
222221
};
223222

224-
const onAnimationEnd = () => {
223+
const onAnimationEnd = (): void => {
225224
setIsAnimating(false);
226225
scrollToChatEnd();
227226
};
228227

229-
const onAnimationStart = () => {
228+
const onAnimationStart = (): void => {
230229
setIsAnimating(true);
231230
};
232231

@@ -239,20 +238,20 @@ export const SidePanelScroll: StoryFn = () => {
239238
}, [isAnimating]);
240239

241240
// eslint-disable-next-line storybook/prefer-pascal-case
242-
const createNewMessage = (message: any, forceBot?: boolean): Omit<AIChat, "id"> => {
243-
const messageDirection = forceBot ? "bot" : getRandomInt(2) === 1 ? "user" : "bot";
241+
const createNewMessage = (newMessage: any, forceBot?: boolean): Omit<AIChat, "id"> => {
242+
const messageDirection = getRandomInt(2) === 1 && !forceBot ? "user" : "bot";
244243

245244
return {
246245
variant: messageDirection,
247246
content:
248247
messageDirection === "user" ? (
249248
<AIChatMessage variant="user">
250249
<AIChatMessageAuthor aria-label="You said at 2:39pm">Gibby Radki</AIChatMessageAuthor>
251-
<AIChatMessageBody>{message}</AIChatMessageBody>
250+
<AIChatMessageBody>{newMessage}</AIChatMessageBody>
252251
</AIChatMessage>
253252
) : (
254253
<AIChatMessage variant="bot">
255-
<BotMessage message={message} onAnimationEnd={onAnimationEnd} onAnimationStart={onAnimationStart} />
254+
<BotMessage message={newMessage} onAnimationEnd={onAnimationEnd} onAnimationStart={onAnimationStart} />
256255
</AIChatMessage>
257256
),
258257
};
@@ -263,7 +262,7 @@ export const SidePanelScroll: StoryFn = () => {
263262
push(createNewMessage(message));
264263
};
265264

266-
const pushLargeBotMessage = () => {
265+
const pushLargeBotMessage = (): void => {
267266
push(
268267
createNewMessage(
269268
<>

packages/paste-core/components/ai-chat-log/type-docs.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3695,10 +3695,11 @@
36953695
"externalProp": true
36963696
},
36973697
"onAnimationEnd": {
3698-
"type": "AnimationEventHandler<HTMLDivElement>",
3699-
"defaultValue": null,
3698+
"type": "() => void",
3699+
"defaultValue": false,
37003700
"required": false,
3701-
"externalProp": true
3701+
"externalProp": false,
3702+
"description": "A callback when the animation is complete"
37023703
},
37033704
"onAnimationEndCapture": {
37043705
"type": "AnimationEventHandler<HTMLDivElement>",
@@ -3719,10 +3720,11 @@
37193720
"externalProp": true
37203721
},
37213722
"onAnimationStart": {
3722-
"type": "AnimationEventHandler<HTMLDivElement>",
3723-
"defaultValue": null,
3723+
"type": "() => void",
3724+
"defaultValue": false,
37243725
"required": false,
3725-
"externalProp": true
3726+
"externalProp": false,
3727+
"description": "A callback when the animation is started"
37263728
},
37273729
"onAnimationStartCapture": {
37283730
"type": "AnimationEventHandler<HTMLDivElement>",

0 commit comments

Comments
 (0)