-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c323cf4
commit 610567d
Showing
22 changed files
with
556 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,19 @@ | ||
"use client"; | ||
|
||
import { makeStyles } from "@/lib/theme"; | ||
import { useSession } from "next-auth/react"; | ||
|
||
import Box from "@p4b/ui/components/Box"; | ||
import Grid from "@p4b/ui/components/Grid"; | ||
import { Loading } from "@p4b/ui/components/Loading"; | ||
import Image from "next/image"; | ||
import AuthLayout from "@p4b/ui/components/AuthLayout"; | ||
|
||
interface AuthLayoutProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const AuthLayout = (props: AuthLayoutProps) => { | ||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
const { status, data: session } = useSession(); | ||
const { children } = props; | ||
const { classes } = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Grid container className={classes.gridContainer}> | ||
<Grid xs={12} lg={6} className={classes.gridLeft}> | ||
<Box | ||
component="header" | ||
sx={{ | ||
left: 0, | ||
p: 3, | ||
position: "fixed", | ||
top: 0, | ||
width: "100%", | ||
}}> | ||
<Box | ||
component="a" | ||
href="https://www.plan4better.de/" | ||
target="_blank" | ||
sx={{ | ||
display: "inline-flex", | ||
width: 160, | ||
}}> | ||
<Image | ||
width="100" | ||
src="https://assets.plan4better.de/img/logo/plan4better_standard.svg" | ||
alt="Plan4Better Logo" | ||
/> | ||
</Box> | ||
</Box> | ||
|
||
<div className={classes.child}> | ||
<div className={classes.cardContainer}> | ||
{!status || | ||
session?.error === "RefreshAccessTokenError" || | ||
(["unauthenticated", "loading"].includes(status) && ( | ||
<div className={classes.root}> | ||
<div className={classes.loadingWrapper}> | ||
<Loading /> | ||
</div> | ||
</div> | ||
))} | ||
{children} | ||
</div> | ||
</div> | ||
</Grid> | ||
<Grid xs={12} lg={6} className={classes.gridRight}> | ||
<Box sx={{ p: 3, width: 350 }} component="div"> | ||
<Image | ||
width="100" | ||
src="https://assets.plan4better.de/img/logo/goat_white.svg" | ||
alt="Plan4Better Logo" | ||
/> | ||
</Box> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
<AuthLayout> | ||
{!status || | ||
session?.error === "RefreshAccessTokenError" || | ||
(["unauthenticated", "loading"].includes(status) && <Loading />)} | ||
{children} | ||
</AuthLayout> | ||
); | ||
}; | ||
|
||
const useStyles = makeStyles({ name: { AuthLayout } })((theme) => ({ | ||
root: { | ||
display: "flex", | ||
}, | ||
gridContainer: { | ||
flex: "1 1 auto", | ||
}, | ||
cardContainer: { | ||
display: "flex", | ||
justifyContent: "center", | ||
}, | ||
child: { | ||
width: "100%", | ||
height: "100%", | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
backgroundColor: theme.colors.useCases.surfaces.background, | ||
}, | ||
image: { | ||
width: "50%", | ||
backgroundImage: 'url("https://assets.plan4better.de/img/login/artwork_1.png")', | ||
height: "100vh", | ||
}, | ||
gridLeft: { | ||
height: "100vh", | ||
display: "flex", | ||
flexDirection: "column", | ||
backgroundColor: theme.colors.useCases.surfaces.background, | ||
}, | ||
gridRight: { | ||
alignItems: "center", | ||
background: | ||
"radial-gradient(50% 50% at 50% 50%, rgba(40,54,72,0.8) 0%, rgba(40,54,72,0.9) 100%), url(https://assets.plan4better.de/img/login/artwork_1.png) no-repeat center", | ||
backgroundSize: "cover", | ||
color: "white", | ||
display: "flex", | ||
justifyContent: "center", | ||
"& img": { | ||
maxWidth: "100%", | ||
}, | ||
}, | ||
loadingWrapper: { | ||
justifyContent: "center", | ||
marginTop: theme.spacing(4), | ||
marginBottom: theme.spacing(4), | ||
display: "flex", | ||
}, | ||
})); | ||
|
||
export default AuthLayout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,117 @@ | ||
import { redirect } from "next/navigation"; | ||
// import { redirect } from "next/navigation"; | ||
|
||
export default async function Home() { | ||
return redirect(`/home`); | ||
// export default async function Home() { | ||
// return redirect(`/home`); | ||
// } | ||
import * as React from "react"; | ||
import Box from "@mui/material/Box"; | ||
import Grid from "@mui/material/Unstable_Grid2"; | ||
import Drawer from "@mui/material/Drawer"; | ||
import Typography from "@mui/material/Typography"; | ||
import List from "@mui/material/List"; | ||
import ListItem from "@mui/material/ListItem"; | ||
import Alert from "@mui/material/Alert"; | ||
import AlertTitle from "@mui/material/AlertTitle"; | ||
import Image from "next/image"; | ||
import Card from "@mui/material/Card"; | ||
import CardActions from "@mui/material/CardActions"; | ||
import CardContent from "@mui/material/CardContent"; | ||
import Button from "@mui/material/Button"; | ||
|
||
function MediaCard({ | ||
heading, | ||
text, | ||
}: { | ||
heading: string; | ||
text: string; | ||
}) { | ||
return ( | ||
<Card> | ||
<Image | ||
alt="Random image" | ||
src="https://source.unsplash.com/random" | ||
width={640} | ||
height={480} | ||
style={{ | ||
maxWidth: "100%", | ||
height: "200px", | ||
objectFit: "cover", | ||
}} | ||
/> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
{heading} | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary"> | ||
{text} | ||
</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Button size="small">Share</Button> | ||
<Button size="small">Learn More</Button> | ||
</CardActions> | ||
</Card> | ||
); | ||
} | ||
|
||
export default function HomePage() { | ||
return ( | ||
<Box sx={{ display: "flex" }}> | ||
<div> | ||
<Alert severity="info" sx={{ mt: 2, mb: 5 }}> | ||
<AlertTitle>Hello 👋</AlertTitle> | ||
This app uses the Next.js App Router and Material UI v5. | ||
</Alert> | ||
<Grid container rowSpacing={3} columnSpacing={3}> | ||
<Grid xs={6}> | ||
<MediaCard | ||
heading="CMYK" | ||
text="The CMYK color model (also known as process color, or four color) is a subtractive color model, based on the CMY color model, used in color printing, and is also used to describe the printing process itself." | ||
/> | ||
</Grid> | ||
<Grid xs={6}> | ||
<MediaCard | ||
heading="HSL and HSV" | ||
text="HSL (for hue, saturation, lightness) and HSV (for hue, saturation, value; also known as HSB, for hue, saturation, brightness) are alternative representations of the RGB color model, designed in the 1970s by computer graphics researchers." | ||
/> | ||
</Grid> | ||
<Grid xs={6}> | ||
<MediaCard | ||
heading="RGB" | ||
text="An RGB color space is any additive color space based on the RGB color model. RGB color spaces are commonly found describing the input signal to display devices such as television screens and computer monitors." | ||
/> | ||
</Grid> | ||
<Grid xs={6}> | ||
<MediaCard | ||
heading="CIELAB" | ||
text="The CIELAB color space, also referred to as L*a*b*, was intended as a perceptually uniform space, where a given numerical change corresponds to a similar perceived change in color." | ||
/> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
<Drawer | ||
sx={{ | ||
width: 320, | ||
flexShrink: 0, | ||
"& .MuiDrawer-paper": { | ||
width: 320, | ||
boxSizing: "border-box", | ||
top: ["48px", "56px", "64px"], | ||
height: "auto", | ||
bottom: 0, | ||
}, | ||
}} | ||
variant="permanent" | ||
anchor="right" | ||
> | ||
<List sx={{ px: 2 }}> | ||
<ListItem disablePadding> | ||
<Typography variant="overline" sx={{ fontWeight: 500 }}> | ||
On this page | ||
</Typography> | ||
</ListItem> | ||
</List> | ||
</Drawer> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.