diff --git a/packages/app-root/src/components/PageFooter.js b/packages/app-root/src/components/PageFooter.js index 84982f21a32..5f82892b747 100644 --- a/packages/app-root/src/components/PageFooter.js +++ b/packages/app-root/src/components/PageFooter.js @@ -1,13 +1,17 @@ 'use client' +import AdminCheckbox from '@zooniverse/react-components/AdminCheckbox' import ZooFooter from '@zooniverse/react-components/ZooFooter' -import { usePanoptesUser } from '../hooks' +import { useAdminMode, usePanoptesUser } from '../hooks' export default function PageFooter() { // we'll need the user in order to detect admin mode. - const { data: user } = usePanoptesUser() + const { data: user, isLoading } = usePanoptesUser() + const { adminMode, toggleAdmin } = useAdminMode(user) return ( - + : null} + /> ) } \ No newline at end of file diff --git a/packages/app-root/src/components/PageHeader.js b/packages/app-root/src/components/PageHeader.js index 2ffc97a7d4a..7fbf01ffbf8 100644 --- a/packages/app-root/src/components/PageHeader.js +++ b/packages/app-root/src/components/PageHeader.js @@ -2,6 +2,7 @@ import ZooHeader from '@zooniverse/react-components/ZooHeader' import { + useAdminMode, usePanoptesUser, useUnreadMessages, useUnreadNotifications @@ -11,9 +12,11 @@ export default function PageHeader() { const { data: user } = usePanoptesUser() const { data: unreadMessages }= useUnreadMessages(user) const { data: unreadNotifications }= useUnreadNotifications(user) + const { adminMode, toggleAdmin } = useAdminMode(user) return ( { + document.body.style.border = '' + document.body.style.borderImage = '' + console.log(document.body.style) + } + }, [adminMode]) + + function toggleAdmin() { + let newAdminState = !adminState + setAdminState(newAdminState) + if (newAdminState) { + localStorage?.setItem('adminFlag', true) + } else { + localStorage?.removeItem('adminFlag') + } + } + + return { adminMode, toggleAdmin } +} \ No newline at end of file