2022-12-27 01:57:59 +01:00
|
|
|
import HamburgerButton from 'components/common/HamburgerButton';
|
|
|
|
import UpdateNotice from 'components/common/UpdateNotice';
|
2023-02-04 17:59:52 +01:00
|
|
|
import LanguageButton from 'components/input/LanguageButton';
|
|
|
|
import ThemeButton from 'components/input/ThemeButton';
|
|
|
|
import UserButton from 'components/input/UserButton';
|
2022-08-29 05:20:54 +02:00
|
|
|
import useConfig from 'hooks/useConfig';
|
2022-08-09 23:58:27 +02:00
|
|
|
import useUser from 'hooks/useUser';
|
2022-12-27 01:57:59 +01:00
|
|
|
import { useRouter } from 'next/router';
|
2023-01-19 00:05:39 +01:00
|
|
|
import { Column, Row } from 'react-basics';
|
2023-02-04 17:59:52 +01:00
|
|
|
import SettingsButton from '../input/SettingsButton';
|
2022-12-27 01:57:59 +01:00
|
|
|
import styles from './Header.module.css';
|
2023-01-19 00:05:39 +01:00
|
|
|
import classNames from 'classnames';
|
2020-07-24 04:56:55 +02:00
|
|
|
|
2023-01-19 00:05:39 +01:00
|
|
|
export default function Header({ className }) {
|
2023-01-31 06:44:07 +01:00
|
|
|
const { user } = useUser();
|
2022-03-17 06:57:40 +01:00
|
|
|
const { pathname } = useRouter();
|
2022-10-28 01:42:57 +02:00
|
|
|
const { updatesDisabled, adminDisabled } = useConfig();
|
2022-08-09 23:58:27 +02:00
|
|
|
const isSharePage = pathname.includes('/share/');
|
2022-10-10 22:42:18 +02:00
|
|
|
const allowUpdate = user?.isAdmin && !updatesDisabled && !isSharePage;
|
2020-08-05 07:45:05 +02:00
|
|
|
|
2020-07-24 04:56:55 +02:00
|
|
|
return (
|
2022-03-01 03:39:37 +01:00
|
|
|
<>
|
2022-08-09 23:58:27 +02:00
|
|
|
{allowUpdate && <UpdateNotice />}
|
2023-01-19 00:05:39 +01:00
|
|
|
<header className={classNames(styles.header, className)}>
|
2022-12-10 23:26:52 +01:00
|
|
|
<Row>
|
2023-01-19 00:05:39 +01:00
|
|
|
<Column className={styles.title}></Column>
|
2022-12-10 23:26:52 +01:00
|
|
|
<HamburgerButton />
|
|
|
|
<Column className={styles.buttons}>
|
|
|
|
<ThemeButton />
|
|
|
|
<LanguageButton menuAlign="right" />
|
|
|
|
<SettingsButton />
|
|
|
|
{user && !adminDisabled && <UserButton />}
|
|
|
|
</Column>
|
|
|
|
</Row>
|
2022-03-01 03:39:37 +01:00
|
|
|
</header>
|
|
|
|
</>
|
2020-07-24 04:56:55 +02:00
|
|
|
);
|
|
|
|
}
|