Refactored update notice. Fixes #2124.

This commit is contained in:
Mike Cao 2023-07-27 14:47:41 -07:00
parent ba9ddcac38
commit f35d0f65dc
4 changed files with 15 additions and 13 deletions

View file

@ -11,17 +11,14 @@ import styles from './AppLayout.module.css';
export 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} data-app-version={CURRENT_VERSION}>
{allowUpdate && <UpdateNotice />}
<UpdateNotice user={user} config={config} />
<Head>
<title>{title ? `${title} | umami` : 'umami'}</title>
</Head>