diff --git a/components/common/UpdateNotice.js b/components/common/UpdateNotice.js index bc27215e..8bba1694 100644 --- a/components/common/UpdateNotice.js +++ b/components/common/UpdateNotice.js @@ -6,15 +6,10 @@ import { setItem } from 'lib/web'; import { REPO_URL, VERSION_CHECK } from 'lib/constants'; import Button from './Button'; import styles from './UpdateNotice.module.css'; -import useUser from 'hooks/useUser'; -import useConfig from 'hooks/useConfig'; export default function UpdateNotice() { - const { user } = useUser(); - const { updatesDisabled } = useConfig(); const { latest, checked, hasUpdate, releaseUrl } = useStore(); const [dismissed, setDismissed] = useState(false); - const allowCheck = user?.is_admin && !updatesDisabled; const updateCheck = useCallback(() => { setItem(VERSION_CHECK, { version: latest, time: Date.now() }); @@ -32,12 +27,12 @@ export default function UpdateNotice() { } useEffect(() => { - if (!checked && allowCheck) { + if (!checked) { checkVersion(); } }, [checked]); - if (!hasUpdate || dismissed || !allowCheck) { + if (!hasUpdate || dismissed) { return null; } diff --git a/components/layout/Header.js b/components/layout/Header.js index 0d36429d..c6942ef5 100644 --- a/components/layout/Header.js +++ b/components/layout/Header.js @@ -8,22 +8,26 @@ import ThemeButton from 'components/settings/ThemeButton'; import HamburgerButton from 'components/common/HamburgerButton'; import UpdateNotice from 'components/common/UpdateNotice'; import UserButton from 'components/settings/UserButton'; -import useUser from 'hooks/useUser'; import { HOMEPAGE_URL } from 'lib/constants'; +import useConfig from '/hooks/useConfig'; +import useUser from 'hooks/useUser'; import Logo from 'assets/logo.svg'; import styles from './Header.module.css'; export default function Header() { const { user } = useUser(); const { pathname } = useRouter(); + const { updatesDisabled } = useConfig(); + const isSharePage = pathname.includes('/share/'); + const allowUpdate = user?.is_admin && !updatesDisabled && !isSharePage; return ( <> - + {allowUpdate && }
} size="large" className={styles.logo} /> - umami + umami
{user && (