// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback, useState, ReactElement } from 'react'; import { LocalizerType } from '../../types/Util'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; import { ChatSessionRefreshedDialog } from './ChatSessionRefreshedDialog'; type PropsHousekeepingType = { i18n: LocalizerType; }; export type PropsActionsType = { contactSupport: () => unknown; }; export type PropsType = PropsHousekeepingType & PropsActionsType; export function ChatSessionRefreshedNotification( props: PropsType ): ReactElement { const { contactSupport, i18n } = props; const [isDialogOpen, setIsDialogOpen] = useState(false); const openDialog = useCallback(() => { setIsDialogOpen(true); }, [setIsDialogOpen]); const closeDialog = useCallback(() => { setIsDialogOpen(false); }, [setIsDialogOpen]); const wrappedContactSupport = useCallback(() => { setIsDialogOpen(false); contactSupport(); }, [contactSupport, setIsDialogOpen]); return ( <> {i18n('ChatRefresh--learnMore')} } icon="session-refresh" /> {isDialogOpen ? ( ) : null} ); }