Skip to content

Commit

Permalink
Merge pull request #77 from sendbird/fix/auto-open
Browse files Browse the repository at this point in the history
Fix autoOpen & betaMark behavior
  • Loading branch information
AhyoungRyu authored Feb 7, 2024
2 parents e3dba9e + 441772f commit cdfe6d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/components/ChatAiWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export interface Props extends Partial<Constant> {
}

const ChatAiWidget = (props: Props) => {
const [isOpen, setIsOpen] = useState<boolean>(props.autoOpen ?? false);
const { autoOpen = true } = props;
const [isOpen, setIsOpen] = useState<boolean>(autoOpen ?? false);
const timer = useRef<NodeJS.Timeout | null>(null);
const buttonClickHandler = () => {
if (timer.current !== null) {
Expand All @@ -121,7 +122,7 @@ const ChatAiWidget = (props: Props) => {
};

useEffect(() => {
if (getCookie('chatbot').length === 0) {
if (getCookie('chatbot').length === 0 && autoOpen) {
timer.current = setTimeout(() => setIsOpen(() => true), 1000);
setCookie('chatbot');
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/CustomChannelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ export default function CustomChannelHeader(props: Props) {
width="34px"
/>
<Title>{botUser?.nickname || channel.name}</Title>
{!isMobile && (betaMark || customBetaMarkText) && (
<BetaLogo>{customBetaMarkText}</BetaLogo>
)}
{!isMobile && betaMark && <BetaLogo>{customBetaMarkText}</BetaLogo>}
</SubContainer>
<RenewButtonContainer>
<RenewButtonForWidgetDemo onClick={onClickRenewButton}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/StartingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ export function StartingPage(props: Props) {
? `I'm ${botNickName}`
: startingPageContent.headerContent.headerOne}
</HeaderOne>
{(betaMark || customBetaMarkText) && (
{betaMark ? (
<BetaLogo style={{ marginBottom: '3px' }}>
{customBetaMarkText}
</BetaLogo>
)}
) : null}
</HeaderOneContainer>
<HeaderTwo>{startingPageContent.headerContent.headerTwo}</HeaderTwo>
</TitleContainer>
Expand Down

0 comments on commit cdfe6d0

Please sign in to comment.