From 4b4f92facd0438bf79bb6f12d7b409f79b1cb52f Mon Sep 17 00:00:00 2001 From: Chris Van Emmerik Date: Mon, 25 Nov 2024 14:52:14 -0700 Subject: [PATCH] [PwaLayout] Create vertical/horizontal layouts. Hide app bar. --- src/components/pwa/Landing.tsx | 83 ++++++++++++++++++++++++-------- src/components/pwa/Pwa.tsx | 4 +- src/components/pwa/PwaLayout.tsx | 12 +++-- 3 files changed, 74 insertions(+), 25 deletions(-) diff --git a/src/components/pwa/Landing.tsx b/src/components/pwa/Landing.tsx index 4ddb12e..a1c4b3a 100644 --- a/src/components/pwa/Landing.tsx +++ b/src/components/pwa/Landing.tsx @@ -1,29 +1,72 @@ -import { Button, Grid, Box } from '@mui/material'; +import { Button, Box, Divider, Stack, Container, Grid } from '@mui/material'; import logo from '../../images/logo_blue.png'; import { usePwaActions } from './store'; +import useHeight from '../layout/ViewPort/hooks/useHeight'; +import useWidth from '../layout/ViewPort/hooks/useWidth'; -export default function Landing() { +const Header = () => ( + + Welcome to + MINDapps! + + + + +); + +const StartButton = () => { const { next } = usePwaActions(); return ( - - - - - Welcome to MINDapps! - - - mindapp - - - Take this quiz to find a suitable app. - - - - + + ); +}; + +const HorizontalLayout = () => { + return ( + + + +
+ mindapp + + + + Answer a few questions, and we will recommend mental health apps that meet your needs and preferences. + + + + + + + ); +}; + +const VerticalLayout = () => { + return ( + +
+ + Answer a few questions, and we will recommend mental health apps that meet your needs and preferences. - + mindapp + + + + ); +}; + +export default function Landing() { + const height = useHeight(); + const width = useWidth(); + const isLandscape = width > height && height < 500; + return {isLandscape ? : }; } diff --git a/src/components/pwa/Pwa.tsx b/src/components/pwa/Pwa.tsx index 2e709e8..57ea845 100644 --- a/src/components/pwa/Pwa.tsx +++ b/src/components/pwa/Pwa.tsx @@ -35,7 +35,7 @@ export default function Pwa() { const index = useSelector((s: AppState) => s.pwa.index); const values = useSelector((s: AppState) => s.pwa.values, stringifyEqual); - const showWelcome = index < 0 ? true : false; + const showLanding = index < 0 ? true : false; const question = index >= 0 && index <= questions.length - 1 ? questions[index] : { id: undefined, label: '', options: [], Field: () => <>, onSelect: undefined }; @@ -100,7 +100,7 @@ export default function Pwa() { return ( - {showWelcome ? ( + {showLanding ? ( ) : ( <> diff --git a/src/components/pwa/PwaLayout.tsx b/src/components/pwa/PwaLayout.tsx index 55f2fe9..c52f15b 100644 --- a/src/components/pwa/PwaLayout.tsx +++ b/src/components/pwa/PwaLayout.tsx @@ -6,6 +6,9 @@ import ScrollElementProvider from '../layout/ScrollElementProvider'; import useHeight from '../layout/ViewPort/hooks/useHeight'; import PwaAppBar from './PwaAppBar'; import { useAppTableDataInit } from '../pages/useAppTableData'; +import { useSelector } from 'react-redux'; +import { AppState } from '../../store'; +import { searchIndex } from './questions'; const useStyles = makeStyles(({ breakpoints, palette, appBarHeight }: any) => createStyles({ @@ -45,10 +48,13 @@ export function PwaLayout({ children }) { useAppTableDataInit({ trigger: true }); + const index = useSelector((s: AppState) => s.pwa.index); + const showLanding = index < 0 ? true : false; + const classes = useStyles({ leftDrawerOpen: false, fullHeight: true, - overflow: 'auto', + overflow: showLanding || index === searchIndex ? 'hidden' : 'auto', contentHeight, footerHeight: 0, appBarHeight, @@ -59,8 +65,8 @@ export function PwaLayout({ children }) {
- -
+ {!showLanding && } + {!showLanding &&
}
{children}