Skip to content

Commit

Permalink
Merge pull request #128 from sendbird/feat/string-set
Browse files Browse the repository at this point in the history
feat: enable stringSet customization
  • Loading branch information
AhyoungRyu authored Mar 22, 2024
2 parents f6e63f8 + b58d856 commit 0df3f92
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ const customConfigs = {
// but setting this option to `true` will keep it open at all times.
autoOpen: true / false,
configureSession: memoizedConfigureSession,
// Available stringSet can be found at https://github.com/sendbird/sendbird-uikit-react/blob/main/src/ui/Label/stringSet.ts
stringSet: {{
MESSAGE_INPUT__PLACE_HOLDER: 'Type a message',
// ...
}}
customRefreshComponent: {
icon: 'Your SVG icon',
style: {
Expand All @@ -311,6 +316,7 @@ const App = () => {
<ChatAiWidget
userId={USER_ID}
configureSession={customConfigs.configureSession}
stringSet={customConfigs.stringSet}
customRefreshComponent={customConfigs.customRefreshComponent}
instantConnect={customConfigs.instantConnect}
autoOpen={customConfigs.autoOpen}
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const App = (props: Props) => {
instantConnect={props.instantConnect}
customRefreshComponent={props.customRefreshComponent}
configureSession={props.configureSession}
stringSet={props.stringSet}
enableSourceMessage={props.enableSourceMessage}
enableEmojiFeedback={props.enableEmojiFeedback}
enableMention={props.enableMention}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const SBComponent = () => {
configureSession,
enableMention,
customUserAgentParam,
stringSet,
} = useConstantState();

assert(
Expand Down Expand Up @@ -80,6 +81,7 @@ const SBComponent = () => {
isMentionEnabled={enableMention}
theme={theme}
colorSet={customColorSet}
stringSet={stringSet}
uikitOptions={{
groupChannel: {
input: {
Expand Down
2 changes: 2 additions & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SendbirdChat, { SessionHandler } from '@sendbird/chat';
import { type SendbirdGroupChat } from '@sendbird/chat/groupChannel';
import { type SendbirdOpenChat } from '@sendbird/chat/openChannel';
import { type StringSet } from '@sendbird/uikit-react/types/ui/Label/stringSet';
import React from 'react';

import { ReactComponent as RefreshIcon } from './icons/refresh-icon.svg';
Expand Down Expand Up @@ -96,6 +97,7 @@ export interface Constant {
enableMention: boolean;
enableMobileView: boolean;
firstMessageData: FirstMessageItem[];
stringSet: Partial<StringSet> | undefined;
}

export interface SuggestedReply {
Expand Down
1 change: 1 addition & 0 deletions src/context/ConstantContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const ConstantStateProvider = (props: ProviderProps) => {
},
customUserAgentParam: props.customUserAgentParam,
configureSession: props.configureSession,
stringSet: props.stringSet,
enableSourceMessage:
props.enableSourceMessage ?? initialState.enableSourceMessage,
enableEmojiFeedback:
Expand Down

0 comments on commit 0df3f92

Please sign in to comment.