feat: add 2FA, secure cookies and publishing tools
This commit is contained in:
@@ -2,11 +2,15 @@ import React, { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Sidebar } from './Sidebar';
|
||||
import { MobileBack, MobileTabBar } from './MobileNavigation';
|
||||
import { useAuth } from '../../context/AuthContext';
|
||||
import { useIsMobile } from '../../hooks/useMediaQuery';
|
||||
import { paths } from '../../lib/routes';
|
||||
|
||||
export const AppShell: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const location = useLocation();
|
||||
const isMobile = useIsMobile();
|
||||
const { user, stopImpersonation } = useAuth();
|
||||
const impersonating = Boolean(user?.impersonatedBy);
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
@@ -16,6 +20,10 @@ export const AppShell: React.FC<{ children: React.ReactNode }> = ({ children })
|
||||
|
||||
return (
|
||||
<>
|
||||
{impersonating && <div className="impersonation-banner" role="status">
|
||||
<span>Você está vendo a plataforma como <b>{user?.name}</b>.</span>
|
||||
<button type="button" onClick={async () => { if (await stopImpersonation()) window.location.assign(paths.admin); }}>Sair da impersonação</button>
|
||||
</div>}
|
||||
{!isMobile && <Sidebar />}
|
||||
{isMobile && <MobileBack />}
|
||||
{/* Keyed by path: the arrival animation only plays when navigating to a new page. */}
|
||||
|
||||
Reference in New Issue
Block a user