Middleware and login updates
This commit is contained in:
parent
484e8689a4
commit
4517241ead
23 changed files with 144 additions and 112 deletions
|
|
@ -24,6 +24,7 @@ import { useRouter } from "next/router";
|
|||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import LinkLogo from "public/link-logo-small.png";
|
||||
import { useSession } from "next-auth/react";
|
||||
|
||||
const openWidth = 270;
|
||||
const closedWidth = 100;
|
||||
|
|
@ -152,7 +153,8 @@ interface SidebarProps {
|
|||
|
||||
export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
|
||||
const { pathname } = useRouter();
|
||||
const [username, setUsername] = useState("Nicholas Smith");
|
||||
const { data: session } = useSession()
|
||||
const username = session?.user?.name || "User"
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
|
|
@ -273,9 +275,9 @@ export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
|
|||
{open
|
||||
? username
|
||||
: username
|
||||
.split(" ")
|
||||
.map((name) => name.substring(0, 1))
|
||||
.join("")}
|
||||
.split(" ")
|
||||
.map((name) => name.substring(0, 1))
|
||||
.join("")}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
|
|
@ -384,10 +386,10 @@ export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
|
|||
/>
|
||||
<MenuItem
|
||||
name="New Ticket UI"
|
||||
href="/tickets/181"
|
||||
href="/tickets/2"
|
||||
Icon={SettingsIcon}
|
||||
iconSize={0}
|
||||
selected={pathname.endsWith("/tickets/181")}
|
||||
selected={pathname.endsWith("/tickets/2")}
|
||||
open={open}
|
||||
/>
|
||||
</List>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue