Fix websites check.

This commit is contained in:
Mike Cao 2020-11-06 17:43:04 -08:00
parent 52456429f6
commit 1e8c1d0d18
3 changed files with 6 additions and 4 deletions

View File

@ -29,7 +29,7 @@ const TYPE_ICONS = {
[TYPE_EVENT]: <Bolt />, [TYPE_EVENT]: <Bolt />,
}; };
export default function RealtimeLog({ data, websites }) { export default function RealtimeLog({ data, websites, websiteId }) {
const intl = useIntl(); const intl = useIntl();
const [locale] = useLocale(); const [locale] = useLocale();
const countryNames = useCountryNames(locale); const countryNames = useCountryNames(locale);
@ -161,7 +161,9 @@ export default function RealtimeLog({ data, websites }) {
<Icon className={styles.icon} icon={getIcon(row)} /> <Icon className={styles.icon} icon={getIcon(row)} />
{getDetail(row)} {getDetail(row)}
</div> </div>
{websites.length > 0 && <div className={styles.website}>{getWebsite(row)?.domain}</div>} {!websiteId && websites.length > 1 && (
<div className={styles.website}>{getWebsite(row)?.domain}</div>
)}
</div> </div>
); );
}; };

View File

@ -64,7 +64,7 @@ export default function RealtimeViews({ websiteId, data, websites }) {
pageviews pageviews
.reduce((arr, { url, website_id }) => { .reduce((arr, { url, website_id }) => {
if (url?.startsWith('/')) { if (url?.startsWith('/')) {
if (!websiteId && websites.length > 0) { if (!websiteId && websites.length > 1) {
url = `${getDomain(website_id)}${url}`; url = `${getDomain(website_id)}${url}`;
} }
const row = arr.find(({ x }) => x === url); const row = arr.find(({ x }) => x === url);

View File

@ -135,7 +135,7 @@ export default function RealtimeDashboard() {
<RealtimeViews websiteId={websiteId} data={realtimeData} websites={websites} /> <RealtimeViews websiteId={websiteId} data={realtimeData} websites={websites} />
</GridColumn> </GridColumn>
<GridColumn xs={12} lg={8}> <GridColumn xs={12} lg={8}>
<RealtimeLog data={realtimeData} websites={websites} /> <RealtimeLog websiteId={websiteId} data={realtimeData} websites={websites} />
</GridColumn> </GridColumn>
</GridRow> </GridRow>
<GridRow> <GridRow>