diff --git a/app/src/components/nav/AppShell.tsx b/app/src/components/nav/AppShell.tsx
index dbcfcc2..e17f319 100644
--- a/app/src/components/nav/AppShell.tsx
+++ b/app/src/components/nav/AppShell.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from "react";
+import { useState, useEffect, useRef } from "react";
import {
Heading,
VStack,
@@ -9,6 +9,7 @@ import {
Box,
Link as ChakraLink,
Flex,
+ useBreakpointValue,
} from "@chakra-ui/react";
import Head from "next/head";
import Link from "next/link";
@@ -16,7 +17,6 @@ import { BsGearFill, BsGithub, BsPersonCircle } from "react-icons/bs";
import { IoStatsChartOutline } from "react-icons/io5";
import { RiHome3Line, RiDatabase2Line, RiFlaskLine } from "react-icons/ri";
import { signIn, useSession } from "next-auth/react";
-import UserMenu from "./UserMenu";
import { env } from "~/env.mjs";
import ProjectMenu from "./ProjectMenu";
import NavSidebarOption from "./NavSidebarOption";
@@ -27,10 +27,16 @@ const Divider = () => ;
const NavSidebar = () => {
const user = useSession().data;
+ // Hack to get around initial flash, see https://github.com/chakra-ui/chakra-ui/issues/6452
+ const isMobile = useBreakpointValue({ base: true, md: false, ssr: false });
+ const renderCount = useRef(0);
+ renderCount.current++;
+
+ const displayLogo = isMobile && renderCount.current > 1;
+
return (
{
borderRightWidth={1}
borderColor="gray.300"
>
-
-
-
- OpenPipe
-
-
-
+ {displayLogo && (
+ <>
+
+
+
+ OpenPipe
+
+
+
+ >
+ )}
+
{user != null && (
<>
@@ -75,6 +86,19 @@ const NavSidebar = () => {
{env.NEXT_PUBLIC_SHOW_DATA && (
)}
+
+
+ CONFIGURATION
+
+
+
>
)}
{user === null && (
@@ -96,20 +120,7 @@ const NavSidebar = () => {
)}
-
-
- CONFIGURATION
-
-
-
- {user && }
+
{title ? `${title} | OpenPipe` : "OpenPipe"}
-
+
{children}
diff --git a/app/src/components/nav/ProjectMenu.tsx b/app/src/components/nav/ProjectMenu.tsx
index 459ac34..821f00d 100644
--- a/app/src/components/nav/ProjectMenu.tsx
+++ b/app/src/components/nav/ProjectMenu.tsx
@@ -6,16 +6,19 @@ import {
PopoverTrigger,
PopoverContent,
Flex,
- IconButton,
Icon,
Divider,
Button,
useDisclosure,
Spinner,
+ Link as ChakraLink,
+ IconButton,
+ Image,
+ Box,
} from "@chakra-ui/react";
import React, { useEffect, useState } from "react";
import Link from "next/link";
-import { BsChevronRight, BsGear, BsPlus } from "react-icons/bs";
+import { BsGear, BsPlus, BsPersonCircle } from "react-icons/bs";
import { type Project } from "@prisma/client";
import { useAppStore } from "~/state/store";
@@ -23,6 +26,7 @@ import { api } from "~/utils/api";
import NavSidebarOption from "./NavSidebarOption";
import { useHandledAsyncCallback, useSelectedProject } from "~/utils/hooks";
import { useRouter } from "next/router";
+import { useSession, signOut } from "next-auth/react";
export default function ProjectMenu() {
const router = useRouter();
@@ -49,28 +53,32 @@ export default function ProjectMenu() {
const createMutation = api.projects.create.useMutation();
const [createProject, isLoading] = useHandledAsyncCallback(async () => {
- const newProj = await createMutation.mutateAsync({ name: "New Project" });
+ const newProj = await createMutation.mutateAsync({ name: "Untitled Project" });
await utils.projects.list.invalidate();
setselectedProjectId(newProj.id);
await router.push({ pathname: "/project/settings" });
}, [createMutation, router]);
+ const user = useSession().data;
+
+ const profileImage = user?.user.image ? (
+
+ ) : (
+
+ );
+
return (
-
-
+
- PROJECT
-
-
-
+
{selectedProject?.name[0]?.toUpperCase()}
-
+
{selectedProject?.name}
-
+ {profileImage}
-
-
-
- PROJECTS
+
+
+
+ {user?.user.email}
-
+
+ Your Projects
+
+
{projects?.map((proj) => (
))}
+
+ Add project
+
+
+
+
+
+
+ {
+ signOut().catch(console.error);
+ }}
+ _hover={{ bgColor: "gray.200", textDecoration: "none" }}
+ w="full"
+ py={2}
+ px={2}
+ borderRadius={4}
+ >
+ Sign out
+
-
-
- New project
-
@@ -136,6 +178,7 @@ const ProjectOption = ({
}) => {
const setselectedProjectId = useAppStore((s) => s.setselectedProjectId);
const [gearHovered, setGearHovered] = useState(false);
+
return (
@@ -157,7 +201,14 @@ const ProjectOption = ({
as={Link}
href="/project/settings"
aria-label={`Open ${proj.name} settings`}
- icon={}
+ icon={
+
+ }
variant="ghost"
size="xs"
p={0}
diff --git a/app/src/components/nav/UserMenu.tsx b/app/src/components/nav/UserMenu.tsx
deleted file mode 100644
index 6fcf5a4..0000000
--- a/app/src/components/nav/UserMenu.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import {
- HStack,
- Icon,
- Image,
- VStack,
- Text,
- Popover,
- PopoverTrigger,
- PopoverContent,
- Link,
- type StackProps,
-} from "@chakra-ui/react";
-import { type Session } from "next-auth";
-import { signOut } from "next-auth/react";
-import { BsBoxArrowRight, BsChevronRight, BsPersonCircle } from "react-icons/bs";
-import NavSidebarOption from "./NavSidebarOption";
-
-export default function UserMenu({ user, ...rest }: { user: Session } & StackProps) {
- const profileImage = user.user.image ? (
-
- ) : (
-
- );
-
- return (
- <>
-
-
-
-
- {profileImage}
-
-
- {user.user.name}
-
-
- {/* {user.user.email} */}
-
-
-
-
-
-
-
-
- {/* sign out */}
- {
- signOut().catch(console.error);
- }}
- px={4}
- py={2}
- spacing={4}
- color="gray.500"
- fontSize="sm"
- >
-
- Sign out
-
-
-
-
- >
- );
-}