2020-08-18 07:51:32 +00:00
|
|
|
import React from 'react';
|
2020-09-06 00:27:01 +00:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2020-09-16 02:16:05 +00:00
|
|
|
import Link from 'components/common/Link';
|
2020-08-18 07:51:32 +00:00
|
|
|
import PageHeader from 'components/layout/PageHeader';
|
2020-09-18 05:52:20 +00:00
|
|
|
import RefreshButton from 'components/common/RefreshButton';
|
|
|
|
|
import ButtonLayout from 'components/layout/ButtonLayout';
|
2020-10-21 13:44:43 +00:00
|
|
|
import Favicon from 'components/common/Favicon';
|
2020-08-18 07:51:32 +00:00
|
|
|
import ActiveUsers from './ActiveUsers';
|
|
|
|
|
import Arrow from 'assets/arrow-right.svg';
|
|
|
|
|
import styles from './WebsiteHeader.module.css';
|
|
|
|
|
|
2020-10-21 13:44:43 +00:00
|
|
|
export default function WebsiteHeader({ websiteId, title, domain, showLink = false }) {
|
2021-01-21 03:11:36 +00:00
|
|
|
const header = showLink ? (
|
2021-02-02 07:00:12 +00:00
|
|
|
<>
|
2021-01-20 20:13:30 +00:00
|
|
|
<Favicon domain={domain} />
|
2021-02-02 07:00:12 +00:00
|
|
|
<Link href="/website/[...id]" as={`/website/${websiteId}/${title}`}>
|
|
|
|
|
{title}
|
|
|
|
|
</Link>
|
|
|
|
|
</>
|
2021-01-20 20:13:30 +00:00
|
|
|
) : (
|
|
|
|
|
<div>
|
|
|
|
|
<Favicon domain={domain} />
|
|
|
|
|
{title}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
2020-08-18 07:51:32 +00:00
|
|
|
return (
|
|
|
|
|
<PageHeader>
|
2021-01-21 03:11:36 +00:00
|
|
|
<div className={styles.title}>{header}</div>
|
2020-10-11 09:29:55 +00:00
|
|
|
<ActiveUsers className={styles.active} websiteId={websiteId} />
|
2020-09-22 04:34:55 +00:00
|
|
|
<ButtonLayout align="right">
|
2020-08-31 21:11:30 +00:00
|
|
|
<RefreshButton websiteId={websiteId} />
|
2020-08-31 10:53:39 +00:00
|
|
|
{showLink && (
|
2020-09-16 02:16:05 +00:00
|
|
|
<Link
|
|
|
|
|
href="/website/[...id]"
|
|
|
|
|
as={`/website/${websiteId}/${title}`}
|
|
|
|
|
className={styles.link}
|
2020-09-26 06:38:28 +00:00
|
|
|
icon={<Arrow />}
|
|
|
|
|
size="small"
|
|
|
|
|
iconRight
|
2020-08-31 10:53:39 +00:00
|
|
|
>
|
2020-10-13 05:53:59 +00:00
|
|
|
<FormattedMessage id="label.view-details" defaultMessage="View details" />
|
2020-09-16 02:16:05 +00:00
|
|
|
</Link>
|
2020-08-31 10:53:39 +00:00
|
|
|
)}
|
|
|
|
|
</ButtonLayout>
|
2020-08-18 07:51:32 +00:00
|
|
|
</PageHeader>
|
|
|
|
|
);
|
|
|
|
|
}
|