Skip to content

Commit

Permalink
feat: add a thread welcome string (#1024)
Browse files Browse the repository at this point in the history
Co-Authored-By: Rapha <[email protected]>
  • Loading branch information
Yonom and raphaguasta authored Oct 18, 2024
1 parent c38a018 commit e31be19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/react/src/ui/thread-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export type StringsConfig = {
tooltip?: string | undefined;
};
};
welcome?: {
message?: string | undefined;
};
userMessage?: {
edit?: {
tooltip?: string | undefined;
Expand Down
10 changes: 7 additions & 3 deletions packages/react/src/ui/thread-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ const ThreadWelcomeMessage = forwardRef<
ThreadWelcomeMessage.Element,
ThreadWelcomeMessage.Props
>(({ message: messageProp, ...rest }, ref) => {
const { welcome: { message = "How can I help you today?" } = {} } =
useThreadConfig();
const {
welcome: { message } = {},
strings: {
welcome: { message: defaultMessage = "How can I help you today?" } = {},
} = {},
} = useThreadConfig();
return (
<ThreadWelcomeMessageStyled {...rest} ref={ref}>
{messageProp ?? message}
{messageProp ?? message ?? defaultMessage}
</ThreadWelcomeMessageStyled>
);
});
Expand Down

0 comments on commit e31be19

Please sign in to comment.