Skip to content

Commit

Permalink
Add debug panel to preview
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed May 20, 2024
1 parent 9cfd492 commit 50b93ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/smart-forms-app/src/features/viewer/ViewerLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import ViewerNav from './ViewerNav/ViewerNav.tsx';

import type { PrintComponentRefContextType } from '../../types/printComponentRefContext.type.ts';
import GenericHeader from '../../components/Header/GenericHeader.tsx';
import RendererDebugFooter from '../renderer/components/RendererDebugFooter/RendererDebugFooter.tsx';
import useDebugMode from '../../hooks/useDebugMode.ts';

export const PrintComponentRefContext = createContext<PrintComponentRefContextType>({
componentRef: null,
Expand All @@ -37,6 +39,8 @@ function ViewerLayout() {

const [componentRef, setComponentRef] = useState<MutableRefObject<null> | null>(null);

const { debugModeEnabled } = useDebugMode();

return (
<PrintComponentRefContext.Provider value={{ componentRef, setComponentRef }}>
<StyledRoot>
Expand All @@ -45,6 +49,9 @@ function ViewerLayout() {

<Main>
<Outlet />

{/* Debug footer */}
{debugModeEnabled ? <RendererDebugFooter /> : null}
</Main>
<BackToTopButton>
<Fab size="medium" sx={{ backgroundColor: 'pale.primary' }}>
Expand Down

0 comments on commit 50b93ba

Please sign in to comment.