added header for handlers

This commit is contained in:
Zai Shi 2024-04-15 11:03:14 +02:00
parent 06bba497ed
commit ead2ce23c3
4 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { Stack } from "@mui/joy";
import ProjectsPageClient from "./page-client";
import { Header } from "./header";
import { Header } from '@/components/header';
export const metadata = {
title: "Projects",

View File

@ -0,0 +1,15 @@
import React from 'react';
import { Header } from '@/components/header';
import { Box, Stack } from '@mui/joy';
export default function Layout(props: { children: React.ReactNode }) {
const headerHeight = 50;
return (
<Stack direction="column" height='100vh' overflow='hidden'>
<Header headerHeight={headerHeight} />
<Box height={'100%'} overflow='auto'>
{props.children}
</Box>
</Stack>
);
}

View File

@ -5,6 +5,7 @@ import { RxPerson, RxEnter, RxSun, RxShadow } from "react-icons/rx";
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
import { SECONDARY_FONT_COLORS } from "../utils/constants";
import UserAvatar from "./user-avatar";
import { useRouter } from "next/navigation";
function Item(props: { text: string, icon: React.ReactNode, onClick: () => void | Promise<void> }) {
return (
@ -28,6 +29,7 @@ export default function UserButton({
const { colorMode, setColorMode } = useDesign();
const user = useUser();
const app = useStackApp();
const router = useRouter();
const textStyles = {
textOverflow: 'ellipsis',
@ -61,7 +63,7 @@ export default function UserButton({
<DropdownMenuSeparator />
<Item
text="Account settings"
onClick={() => app.redirectToAccountSettings()}
onClick={() => runAsynchronously(router.push(app.urls.accountSettings))}
icon={<RxPerson size={22} color={SECONDARY_FONT_COLORS[colorMode]} />}
/>
{showColorMode && <Item