// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React, { useState } from 'react'; import { Box, Button, Modal, SpaceBetween, TopNavigation } from '@awsui/components-react'; import { Auth, Logger } from 'aws-amplify'; import useAppContext from '../../contexts/app'; const logger = new Logger('TopNavigation'); /* eslint-disable react/prop-types */ const SignOutModal = ({ visible, setVisible }) => { async function signOut() { try { await Auth.signOut(); logger.debug('signed out'); window.location.reload(); } catch (error) { logger.error('error signing out: ', error); } } return ( setVisible(false)} visible={visible} closeAriaLabel="Close modal" size="medium" footer={ } header="Sign Out" > Sign out of the application? ); }; const CallAnalyticsTopNavigation = () => { const { user } = useAppContext(); const userId = user?.attributes?.email || 'user'; const [isSignOutModalVisible, setIsSignOutModalVisiblesetVisible] = useState(false); return ( <>
setIsSignOutModalVisiblesetVisible(true)} > Sign out ), }, { id: 'support-group', text: 'Resources', items: [ { id: 'documentation', text: 'Blog Post', href: 'https://www.amazon.com/live-call-analytics', external: true, externalIconAriaLabel: ' (opens in new tab)', }, { id: 'source', text: 'Source Code', href: 'https://github.com/aws-samples/amazon-transcribe-live-call-analytics', external: true, externalIconAriaLabel: ' (opens in new tab)', }, ], }, ], }, ]} />
); }; export default CallAnalyticsTopNavigation;