mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Fix update notice.
This commit is contained in:
parent
82f0bc3d2b
commit
5262d19c8b
6 changed files with 52 additions and 31 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { Container } from 'react-basics';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import NavBar from 'components/layout/NavBar';
|
||||
import UpdateNotice from 'components/common/UpdateNotice';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import useConfig from 'hooks/useConfig';
|
||||
import { UI_LAYOUT_BODY } from 'lib/constants';
|
||||
|
|
@ -9,13 +11,17 @@ import styles from './AppLayout.module.css';
|
|||
export default function AppLayout({ title, children }) {
|
||||
const { user } = useRequireLogin();
|
||||
const config = useConfig();
|
||||
const { pathname } = useRouter();
|
||||
|
||||
if (!user || !config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const allowUpdate = user?.isAdmin && !config?.updatesDisabled && !pathname.includes('/share/');
|
||||
|
||||
return (
|
||||
<div className={styles.layout}>
|
||||
{allowUpdate && <UpdateNotice />}
|
||||
<Head>
|
||||
<title>{title ? `${title} | umami` : 'umami'}</title>
|
||||
</Head>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue