🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
Add header title to most pages (#70)
Md. Tonoy Akando28b0cb571cdc
diff --git a/src/components/layouts/layout.tsx b/src/components/layouts/layout.tsxindex 8a2b3dc5ee..c63d61744c 100644--- a/src/components/layouts/layout.tsx+++ b/src/components/layouts/layout.tsx@@ -1,25 +1,12 @@+import { ROUTES } from "@/src/components/layouts/routes";import { Fragment, type PropsWithChildren, useState } from "react";import { Dialog, Menu, Transition } from "@headlessui/react";-import {- Bars3Icon,- Cog6ToothIcon,- DocumentDuplicateIcon,- HomeIcon,- UsersIcon,- XMarkIcon,-} from "@heroicons/react/24/outline";+import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";import Link from "next/link";import { useRouter } from "next/router";import clsx from "clsx";-import {- BarChart3,- Code,- HelpingHand,- Info,- LineChart,- MessageSquarePlus,-} from "lucide-react";+import { Code, MessageSquarePlus, Info } from "lucide-react";import { signOut, useSession } from "next-auth/react";import { ChevronDownIcon } from "@heroicons/react/20/solid";import { cn } from "@/src/utils/tailwind";@@ -32,6 +19,7 @@ import { api } from "@/src/utils/api";import { NewProjectButton } from "@/src/features/projects/components/NewProjectButton";import { FeedbackButtonWrapper } from "@/src/features/feedback/component/FeedbackButton";import { Button } from "@/src/components/ui/button";+import Head from "next/head";import { env } from "@/src/env.mjs";const userNavigation = [@@ -51,54 +39,22 @@ export default function Layout(props: PropsWithChildren) {const [sidebarOpen, setSidebarOpen] = useState(false);const router = useRouter();const projectId = router.query.projectId as string | undefined;- const navigation = [- { name: "Dashboard", pathname: `/project/[projectId]`, icon: HomeIcon },- {- name: "Analytics (alpha)",- pathname: `/project/[projectId]/analytics`,- icon: BarChart3,- },- {- name: "Traces",- pathname: `/project/[projectId]/traces`,- icon: UsersIcon,- },- {- name: "Generations",- pathname: `/project/[projectId]/generations`,- icon: DocumentDuplicateIcon,- },- {- name: "Scores",- pathname: `/project/[projectId]/scores`,- icon: LineChart,- },- {- name: "Users",- pathname: `/project/[projectId]/users`,- icon: UsersIcon,- },- {- name: "Settings",- pathname: "/project/[projectId]/settings",- icon: Cog6ToothIcon,- },- {- name: "Talk to founder",- pathname: "https://cal.com/marc-kl/langfuse-cloud",- icon: HelpingHand,- },- ]- .filter((nav) => projectId || !nav.pathname.includes("[projectId]"))- .map((nav) => ({- ...nav,- href: nav.pathname.replace("[projectId]", projectId ?? ""),+ const navigation = ROUTES.filter(+ ({ pathname }) => projectId || !pathname.includes("[projectId]")+ )+ .map(({ pathname, ...rest }) => ({+ pathname,+ href: pathname.replace("[projectId]", projectId ?? ""),+ ...rest,}))- .map((params) => ({- ...params,- current: router.pathname === params.pathname,+ .map(({ pathname, ...rest }) => ({+ pathname,+ current: router.pathname === pathname,+ ...rest,}));+ const currentPathName = navigation.find(({ current }) => current)?.name;+const session = useSession();const projects = api.projects.all.useQuery(undefined, {@@ -148,6 +104,11 @@ export default function Layout(props: PropsWithChildren) {return (<>+ <Head>+ <title>+ {currentPathName ? `${currentPathName} | Langfuse` : "Langfuse"}+ </title>+ </Head><div><Transition.Root show={sidebarOpen} as={Fragment}><Dialogdiff --git a/src/components/layouts/routes.ts b/src/components/layouts/routes.tsnew file mode 100644index 0000000000..a9e88abd8d--- /dev/null+++ b/src/components/layouts/routes.ts@@ -0,0 +1,54 @@+import {+ Cog6ToothIcon,+ DocumentDuplicateIcon,+} from "@heroicons/react/20/solid";+import {+ BarChart3,+ HelpingHand,+ HomeIcon,+ LineChart,+ UsersIcon,+} from "lucide-react";++export const ROUTES = [+ {+ name: "Dashboard",+ pathname: `/project/[projectId]`,+ icon: HomeIcon,+ },+ {+ name: "Analytics (alpha)",+ pathname: `/project/[projectId]/analytics`,+ icon: BarChart3,+ },+ {+ name: "Traces",+ pathname: `/project/[projectId]/traces`,+ icon: UsersIcon,+ },+ {+ name: "Generations",+ pathname: `/project/[projectId]/generations`,+ icon: DocumentDuplicateIcon,+ },+ {+ name: "Scores",+ pathname: `/project/[projectId]/scores`,+ icon: LineChart,+ },+ {+ name: "Users",+ pathname: `/project/[projectId]/users`,+ icon: UsersIcon,+ },+ {+ name: "Settings",+ pathname: "/project/[projectId]/settings",+ icon: Cog6ToothIcon,+ },+ {+ name: "Talk to founder",+ pathname: "https://cal.com/marc-kl/langfuse-cloud",+ icon: HelpingHand,+ },+];diff --git a/src/pages/auth/sign-in.tsx b/src/pages/auth/sign-in.tsxindex a9baa6b423..09b0176eb2 100644--- a/src/pages/auth/sign-in.tsx+++ b/src/pages/auth/sign-in.tsx@@ -1,8 +1,4 @@-import { signIn } from "next-auth/react";-import Link from "next/link";-import * as z from "zod";-import { zodResolver } from "@hookform/resolvers/zod";-import { useForm } from "react-hook-form";+import { Button } from "@/src/components/ui/button";import {Form,FormControl,@@ -12,7 +8,12 @@ import {FormMessage,} from "@/src/components/ui/form";import { Input } from "@/src/components/ui/input";-import { Button } from "@/src/components/ui/button";+import { zodResolver } from "@hookform/resolvers/zod";+import { signIn } from "next-auth/react";+import Head from "next/head";+import Link from "next/link";+import { useForm } from "react-hook-form";+import * as z from "zod";const formSchema = z.object({email: z.string().email(),@@ -40,6 +41,9 @@ export default function SignIn() {return (<>+ <Head>+ <title>Sign in | Langfuse</title>+ </Head><div className="flex min-h-full flex-1 flex-col justify-center py-12 sm:px-6 lg:px-8"><div className="sm:mx-auto sm:w-full sm:max-w-md"><span className="block text-center font-mono text-4xl font-bold">diff --git a/src/pages/auth/sign-up.tsx b/src/pages/auth/sign-up.tsxindex 7987888768..88412e392d 100644--- a/src/pages/auth/sign-up.tsx+++ b/src/pages/auth/sign-up.tsx@@ -1,8 +1,4 @@-import { signIn } from "next-auth/react";-import Link from "next/link";-import type * as z from "zod";-import { zodResolver } from "@hookform/resolvers/zod";-import { useForm } from "react-hook-form";+import { Button } from "@/src/components/ui/button";import {Form,FormControl,@@ -12,8 +8,13 @@ import {FormMessage,} from "@/src/components/ui/form";import { Input } from "@/src/components/ui/input";-import { Button } from "@/src/components/ui/button";import { signupSchema } from "@/src/features/auth/lib/signupSchema";+import { zodResolver } from "@hookform/resolvers/zod";+import { signIn } from "next-auth/react";+import Head from "next/head";+import Link from "next/link";+import { useForm } from "react-hook-form";+import type * as z from "zod";import { env } from "@/src/env.mjs";export default function SignIn() {@@ -53,6 +54,14 @@ export default function SignIn() {return (<>+ <Head>+ <title>Sign up | Langfuse</title>+ <meta+ name="description"+ content="Create an account, no credit card required."+ key="desc"+ />+ </Head><div className="flex flex-1 flex-col py-6 sm:min-h-full sm:justify-center sm:px-6 sm:py-12 lg:px-8"><div className="sm:mx-auto sm:w-full sm:max-w-md"><span className="block text-center font-mono text-4xl font-bold">