aboutsummaryrefslogtreecommitdiff
path: root/apps/web/app/(dash)/header
diff options
context:
space:
mode:
authorSamrat Malisetti <[email protected]>2024-07-19 11:19:50 -0700
committerGitHub <[email protected]>2024-07-19 11:19:50 -0700
commit581ce2780ea8b8b931539adcbddacf1d322fd027 (patch)
tree4813158cd7aa3abb44c7e3884cfd4415d8b5148c /apps/web/app/(dash)/header
parentfixed mbile layout (diff)
parentDisabled sentry for now because of unreasonably large bundle size (diff)
downloadarchived-supermemory-581ce2780ea8b8b931539adcbddacf1d322fd027.tar.xz
archived-supermemory-581ce2780ea8b8b931539adcbddacf1d322fd027.zip
Merge branch 'main' into fix/mobile-layout
Diffstat (limited to 'apps/web/app/(dash)/header')
-rw-r--r--apps/web/app/(dash)/header/autoBreadCrumbs.tsx68
-rw-r--r--apps/web/app/(dash)/header/header.tsx96
-rw-r--r--apps/web/app/(dash)/header/newChatButton.tsx26
3 files changed, 95 insertions, 95 deletions
diff --git a/apps/web/app/(dash)/header/autoBreadCrumbs.tsx b/apps/web/app/(dash)/header/autoBreadCrumbs.tsx
index 5767ca6f..a823671c 100644
--- a/apps/web/app/(dash)/header/autoBreadCrumbs.tsx
+++ b/apps/web/app/(dash)/header/autoBreadCrumbs.tsx
@@ -1,47 +1,47 @@
"use client";
import {
- Breadcrumb,
- BreadcrumbItem,
- BreadcrumbLink,
- BreadcrumbList,
- BreadcrumbSeparator,
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbSeparator,
} from "@repo/ui/shadcn/breadcrumb";
import { usePathname } from "next/navigation";
import React from "react";
function AutoBreadCrumbs() {
- const pathname = usePathname();
+ const pathname = usePathname();
- console.log(pathname.split("/").filter(Boolean));
+ console.log(pathname.split("/").filter(Boolean));
- return (
- <Breadcrumb className="hidden md:block">
- <BreadcrumbList>
- {!pathname.startsWith("/home") && (
- <>
- <BreadcrumbItem>
- <BreadcrumbLink href="/">Home</BreadcrumbLink>
- </BreadcrumbItem>
- <BreadcrumbSeparator hidden={pathname.split("/").length === 1} />
- </>
- )}
- {pathname
- .split("/")
- .filter(Boolean)
- .map((path, idx, paths) => (
- <>
- <BreadcrumbItem key={path}>
- <BreadcrumbLink href={`/${paths.slice(0, idx + 1).join("/")}`}>
- {path.charAt(0).toUpperCase() + path.slice(1)}
- </BreadcrumbLink>
- </BreadcrumbItem>
- <BreadcrumbSeparator hidden={idx === paths.length - 1} />
- </>
- ))}
- </BreadcrumbList>
- </Breadcrumb>
- );
+ return (
+ <Breadcrumb className="hidden md:block">
+ <BreadcrumbList>
+ {!pathname.startsWith("/home") && (
+ <>
+ <BreadcrumbItem>
+ <BreadcrumbLink href="/">Home</BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator hidden={pathname.split("/").length === 1} />
+ </>
+ )}
+ {pathname
+ .split("/")
+ .filter(Boolean)
+ .map((path, idx, paths) => (
+ <>
+ <BreadcrumbItem key={path}>
+ <BreadcrumbLink href={`/${paths.slice(0, idx + 1).join("/")}`}>
+ {path.charAt(0).toUpperCase() + path.slice(1)}
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator hidden={idx === paths.length - 1} />
+ </>
+ ))}
+ </BreadcrumbList>
+ </Breadcrumb>
+ );
}
export default AutoBreadCrumbs;
diff --git a/apps/web/app/(dash)/header/header.tsx b/apps/web/app/(dash)/header/header.tsx
index 0fc28227..b9d400c9 100644
--- a/apps/web/app/(dash)/header/header.tsx
+++ b/apps/web/app/(dash)/header/header.tsx
@@ -8,54 +8,54 @@ import NewChatButton from "./newChatButton";
import AutoBreadCrumbs from "./autoBreadCrumbs";
async function Header() {
- const chatThreads = await getChatHistory();
-
- if (!chatThreads.success || !chatThreads.data) {
- return <div>Error fetching chat threads</div>;
- }
-
- return (
- <div className="p-4 relative z-30 h-16 flex items-center">
- <div className="w-full flex items-center justify-between">
- <div className="flex items-center gap-4">
- <Link className="" href="/home">
- <Image
- src={Logo}
- alt="SuperMemory logo"
- className="hover:brightness-125 duration-200 w-full h-full"
- />
- </Link>
-
- <AutoBreadCrumbs />
- </div>
-
- <div className="flex items-center gap-2">
- <NewChatButton />
-
- <div className="relative group">
- <button className="flex duration-200 items-center text-[#7D8994] hover:bg-[#1F2429] text-[13px] gap-2 px-3 py-2 rounded-xl">
- History
- </button>
-
- <div className="absolute p-4 hidden group-hover:block right-0 w-full md:w-[400px] max-h-[70vh] overflow-auto">
- <div className="bg-[#1F2429] rounded-xl p-2 flex flex-col shadow-lg">
- {chatThreads.data.map((thread) => (
- <Link
- prefetch={false}
- href={`/chat/${thread.id}`}
- key={thread.id}
- className="p-2 rounded-md hover:bg-secondary"
- >
- {thread.firstMessage}
- </Link>
- ))}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- );
+ const chatThreads = await getChatHistory();
+
+ if (!chatThreads.success || !chatThreads.data) {
+ return <div>Error fetching chat threads</div>;
+ }
+
+ return (
+ <div className="p-4 relative z-30 h-16 flex items-center">
+ <div className="w-full flex items-center justify-between">
+ <div className="flex items-center gap-4">
+ <Link className="" href="/home">
+ <Image
+ src={Logo}
+ alt="SuperMemory logo"
+ className="hover:brightness-125 duration-200 w-full h-full"
+ />
+ </Link>
+
+ <AutoBreadCrumbs />
+ </div>
+
+ <div className="flex items-center gap-2">
+ <NewChatButton />
+
+ <div className="relative group">
+ <button className="flex duration-200 items-center text-[#7D8994] hover:bg-[#1F2429] text-[13px] gap-2 px-3 py-2 rounded-xl">
+ History
+ </button>
+
+ <div className="absolute p-4 hidden group-hover:block right-0 w-full md:w-[400px] max-h-[70vh] overflow-auto">
+ <div className="bg-[#1F2429] rounded-xl p-2 flex flex-col shadow-lg">
+ {chatThreads.data.map((thread) => (
+ <Link
+ prefetch={false}
+ href={`/chat/${thread.id}`}
+ key={thread.id}
+ className="p-2 rounded-md hover:bg-secondary"
+ >
+ {thread.firstMessage}
+ </Link>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
}
export default Header;
diff --git a/apps/web/app/(dash)/header/newChatButton.tsx b/apps/web/app/(dash)/header/newChatButton.tsx
index 0e9e1c5a..a634ab41 100644
--- a/apps/web/app/(dash)/header/newChatButton.tsx
+++ b/apps/web/app/(dash)/header/newChatButton.tsx
@@ -7,21 +7,21 @@ import { usePathname } from "next/navigation";
import React from "react";
function NewChatButton() {
- const path = usePathname();
+ const path = usePathname();
- if (path.startsWith("/chat")) {
- return (
- <Link
- href="/home"
- className="flex duration-200 items-center text-[#7D8994] hover:bg-[#1F2429] text-[13px] gap-2 px-3 py-2 rounded-xl"
- >
- <Image src={ChatIcon} alt="Chat icon" className="w-5" />
- Start new chat
- </Link>
- );
- }
+ if (path.startsWith("/chat")) {
+ return (
+ <Link
+ href="/home"
+ className="flex duration-200 items-center text-[#7D8994] hover:bg-[#1F2429] text-[13px] gap-2 px-3 py-2 rounded-xl"
+ >
+ <Image src={ChatIcon} alt="Chat icon" className="w-5" />
+ Start new chat
+ </Link>
+ );
+ }
- return null;
+ return null;
}
export default NewChatButton;