fix(ui): no sessions message check for siteId

This commit is contained in:
Shekar Siri 2023-06-23 15:36:38 +02:00
parent 9108dd7f04
commit 8a532f8b74
2 changed files with 42 additions and 43 deletions

View file

@ -34,7 +34,7 @@ function Overview({ match: { params } }: IProps) {
<Switch>
<Route exact strict path={[withSiteId(sessions(), siteId), withSiteId(notes(), siteId), withSiteId(bookmarks(), siteId)]}>
<div className="mb-5 w-full mx-auto" style={{ maxWidth: '1300px' }}>
<NoSessionsMessage />
<NoSessionsMessage siteId={siteId} />
<MainSearchBar />
<SessionSearch />
<div className="my-4" />

View file

@ -4,52 +4,51 @@ import { connect } from 'react-redux';
import { onboarding as onboardingRoute } from 'App/routes';
import { withRouter } from 'react-router-dom';
import * as routes from '../../../routes';
const withSiteId = routes.withSiteId;
const NoSessionsMessage = (props) => {
const {
sites,
match: {
params: { siteId },
},
} = props;
const activeSite = sites.find((s) => s.id == siteId);
const showNoSessions = !!activeSite && !activeSite.recorded;
return (
<>
{showNoSessions && (
<div>
<div
className="rounded text-sm flex items-center p-2 justify-between mb-4"
style={{ backgroundColor: 'rgba(255, 239, 239, 1)', border: 'solid thin rgba(221, 181, 181, 1)' }}
>
<div className="flex items-center w-full">
<div className="flex-shrink-0 w-8 flex justify-center">
<Icon name="info-circle" size="14" color="gray-darkest" />
</div>
<div className="ml-2 color-gray-darkest mr-auto text-base">
It might take a few minutes for first recording to appear.
<a href="https://docs.openreplay.com/en/troubleshooting/session-recordings/" className="link ml-2">
Troubleshoot
</a>
.
</div>
<Button
variant="primary"
className="bg-white h-8 hover:bg-gray-light text-base"
onClick={() => props.history.push(withSiteId(onboardingRoute('installing'), siteId))}
>
Complete Project Setup
</Button>
</div>
</div>
</div>
)}
</>
);
const {
sites,
siteId
} = props;
const activeSite = sites.find((s) => s.id === siteId);
const showNoSessions = !!activeSite && !activeSite.recorded;
return (
<>
{showNoSessions && (
<div>
<div
className='rounded text-sm flex items-center p-2 justify-between mb-4'
style={{ backgroundColor: 'rgba(255, 239, 239, 1)', border: 'solid thin rgba(221, 181, 181, 1)' }}
>
<div className='flex items-center w-full'>
<div className='flex-shrink-0 w-8 flex justify-center'>
<Icon name='info-circle' size='14' color='gray-darkest' />
</div>
<div className='ml-2 color-gray-darkest mr-auto text-base'>
It might take a few minutes for first recording to appear.
<a href='https://docs.openreplay.com/en/troubleshooting/session-recordings/' className='link ml-2'>
Troubleshoot
</a>
.
</div>
<Button
variant='primary'
className='bg-white h-8 hover:bg-gray-light text-base'
onClick={() => props.history.push(withSiteId(onboardingRoute('installing'), siteId))}
>
Complete Project Setup
</Button>
</div>
</div>
</div>
)}
</>
);
};
export default connect((state) => ({
site: state.getIn(['site', 'siteId']),
sites: state.getIn(['site', 'list']),
site: state.getIn(['site', 'siteId']),
sites: state.getIn(['site', 'list'])
}))(withRouter(NoSessionsMessage));