umami/components/metrics/WebsiteHeader.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-08-18 09:51:32 +02:00
import React from 'react';
2020-09-06 02:27:01 +02:00
import { FormattedMessage } from 'react-intl';
2020-08-18 09:51:32 +02:00
import { useRouter } from 'next/router';
import PageHeader from 'components/layout/PageHeader';
import Button from 'components/common/Button';
import ActiveUsers from './ActiveUsers';
import Arrow from 'assets/arrow-right.svg';
import styles from './WebsiteHeader.module.css';
import RefreshButton from '../common/RefreshButton';
import ButtonLayout from '../layout/ButtonLayout';
2020-08-18 09:51:32 +02:00
2020-08-31 23:11:30 +02:00
export default function WebsiteHeader({ websiteId, title, showLink = false }) {
2020-08-18 09:51:32 +02:00
const router = useRouter();
return (
<PageHeader>
<div className={styles.title}>{title}</div>
2020-08-18 09:51:32 +02:00
<ActiveUsers className={styles.active} websiteId={websiteId} />
<ButtonLayout>
2020-08-31 23:11:30 +02:00
<RefreshButton websiteId={websiteId} />
{showLink && (
<Button
icon={<Arrow />}
onClick={() =>
2020-09-02 18:56:29 +02:00
router.push('/website/[...id]', `/website/${websiteId}/${title}`, {
shallow: true,
})
}
size="small"
>
2020-09-06 02:27:01 +02:00
<div>
<FormattedMessage id="button.view-details" defaultMessage="View details" />
</div>
</Button>
)}
</ButtonLayout>
2020-08-18 09:51:32 +02:00
</PageHeader>
);
}