2023-04-22 21:49:31 +03:00
|
|
|
import { Tag, Tooltip, Avatar } from 'antd';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { FC } from 'react';
|
2022-11-05 06:04:13 +03:00
|
|
|
import cn from 'classnames';
|
2023-01-10 03:09:13 +03:00
|
|
|
import dynamic from 'next/dynamic';
|
2023-01-22 10:19:17 +03:00
|
|
|
import Link from 'next/link';
|
2022-09-07 10:00:28 +03:00
|
|
|
import styles from './Header.module.scss';
|
2022-04-28 19:54:33 +03:00
|
|
|
|
2023-01-10 03:09:13 +03:00
|
|
|
// Lazy loaded components
|
|
|
|
|
2023-01-11 03:39:12 +03:00
|
|
|
const UserDropdown = dynamic(
|
|
|
|
() => import('../../common/UserDropdown/UserDropdown').then(mod => mod.UserDropdown),
|
|
|
|
{
|
|
|
|
ssr: false,
|
|
|
|
},
|
2023-01-10 03:09:13 +03:00
|
|
|
);
|
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
export type HeaderComponentProps = {
|
2022-05-08 10:41:47 +03:00
|
|
|
name: string;
|
2022-05-26 21:08:37 +03:00
|
|
|
chatAvailable: boolean;
|
2022-09-11 06:03:58 +03:00
|
|
|
chatDisabled: boolean;
|
2023-01-22 10:19:17 +03:00
|
|
|
online: boolean;
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2022-04-28 19:54:33 +03:00
|
|
|
|
2023-02-23 05:39:37 +03:00
|
|
|
export const Header: FC<HeaderComponentProps> = ({ name, chatAvailable, chatDisabled, online }) => (
|
2023-01-10 12:09:39 +03:00
|
|
|
<header className={cn([`${styles.header}`], 'global-header')}>
|
2023-01-30 03:31:52 +03:00
|
|
|
{online ? (
|
2023-01-22 10:19:17 +03:00
|
|
|
<Link href="#player" className={styles.skipLink}>
|
|
|
|
Skip to player
|
|
|
|
</Link>
|
2023-01-30 03:31:52 +03:00
|
|
|
) : (
|
|
|
|
<Link href="#offline-message" className={styles.skipLink}>
|
|
|
|
Skip to offline message
|
|
|
|
</Link>
|
2023-01-22 10:19:17 +03:00
|
|
|
)}
|
|
|
|
<Link href="#skip-to-content" className={styles.skipLink}>
|
|
|
|
Skip to page content
|
|
|
|
</Link>
|
|
|
|
<Link href="#footer" className={styles.skipLink}>
|
|
|
|
Skip to footer
|
|
|
|
</Link>
|
2022-12-29 21:14:12 +03:00
|
|
|
<div className={styles.logo}>
|
2022-12-25 03:45:45 +03:00
|
|
|
<div id="header-logo" className={styles.logoImage}>
|
2023-04-22 21:49:31 +03:00
|
|
|
<Avatar src="/logo" size="large" shape="circle" className={styles.avatar} />
|
2022-12-09 01:16:05 +03:00
|
|
|
</div>
|
2023-01-25 06:43:17 +03:00
|
|
|
<h1 className={styles.title} id="global-header-text">
|
2022-12-25 03:45:45 +03:00
|
|
|
{name}
|
|
|
|
</h1>
|
2022-09-07 10:00:28 +03:00
|
|
|
</div>
|
2022-09-11 06:03:58 +03:00
|
|
|
{chatAvailable && !chatDisabled && <UserDropdown />}
|
|
|
|
{!chatAvailable && !chatDisabled && (
|
2022-09-07 10:00:28 +03:00
|
|
|
<Tooltip title="Chat is available when the stream is live." placement="left">
|
2023-02-20 08:01:01 +03:00
|
|
|
<Tag className={styles.offlineTag}>Chat offline</Tag>
|
2022-09-07 10:00:28 +03:00
|
|
|
</Tooltip>
|
|
|
|
)}
|
2023-01-10 12:09:39 +03:00
|
|
|
</header>
|
2022-09-07 10:00:28 +03:00
|
|
|
);
|
|
|
|
export default Header;
|