🪢 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
feat(ui): add support dropdown menu to replace /support page (#4983)
Marc Klingen952a5508476d
diff --git a/web/src/__e2e__/auth.spec.ts b/web/src/__e2e__/auth.spec.tsindex 8be293e67e..381113ddc9 100644--- a/web/src/__e2e__/auth.spec.ts+++ b/web/src/__e2e__/auth.spec.ts@@ -123,7 +123,7 @@ test("Unauthenticated user should not be redirected to non-relative URLs after ltest("Unauthenticated user should be redirected to relative URL after login", async ({page,}) => {- const relativeUrl = "/support";+ const relativeUrl = "/setup";await page.goto(`/auth/sign-in?targetPath=${encodeURIComponent(relativeUrl)}`,);diff --git a/web/src/components/Support.tsx b/web/src/components/Support.tsxdeleted file mode 100644index a94291c623..0000000000--- a/web/src/components/Support.tsx+++ /dev/null@@ -1,109 +0,0 @@-import { Button } from "@/src/components/ui/button";-import {- Card,- CardContent,- CardDescription,- CardFooter,- CardHeader,- CardTitle,-} from "@/src/components/ui/card";-import { chatAvailable, openChat } from "@/src/features/support-chat/chat";-import { Book, Github, Mail, MessageSquare, Slack } from "lucide-react";-import Link from "next/link";-import { SiDiscord } from "react-icons/si";--const supportChannels = [- {- icon: Book,- title: "Documentation",- description: "Find answers in the documentation.",- href: "https://docs.langfuse.com",- buttonText: "Visit Docs",- primary: true,- },- {- icon: Github,- title: "GitHub Issues",- description:- "Create an issue on Github to report bugs or request new features.",- href: "https://github.com/langfuse/langfuse/issues/new/choose",- buttonText: "Create Issue",- primary: true,- },- {- icon: Github,- title: "GitHub Support",- description: "Create a support ticket via GitHub discussions.",- href: "https://github.com/orgs/langfuse/discussions/categories/support",- buttonText: "Submit Question",- primary: true,- },- {- icon: Mail,- title: "Email",- description: "Send email to our shared inbox: [email protected]",- href: "mailto:[email protected]",- buttonText: "Send Email",- available: !chatAvailable,- },- {- icon: MessageSquare,- title: "Chat",- description: "Get support directly from the team.",- onClick: () => openChat(),- available: chatAvailable,- buttonText: "Launch Chat",- },- {- icon: SiDiscord,- title: "Discord",- description:- "Get support from community. Follow announcements to stay up to date with new features.",- href: "https://langfuse.com/discord",- buttonText: "Join Discord",- },- {- icon: Slack,- title: "Slack Connect",- description: "Get a dedicated support channel for you and your team.",- href: "mailto:[email protected]?subject=Slack%20Connect%20Request&body=I'd%20like%20to%20request%20a%20dedicated%20Slack%20Connect%20channel%20for%20me%20and%20my%20team.%0D%0A%0D%0AUsers%20(emails)%20to%20include%20besides%20mine%3A%0D%0A%0D%0A",- buttonText: "Request via Email",- },-];--export const SupportChannels = () => (- <div className="mt-10 grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">- {supportChannels- .filter((channel) => channel.available === undefined || channel.available)- .map((channel) => (- <Card key={channel.title} className="flex flex-col">- <CardHeader>- <CardTitle className="flex items-center gap-2">- <channel.icon size={20} />- {channel.title}- </CardTitle>- </CardHeader>- <CardContent className="flex-1">- <CardDescription>{channel.description}</CardDescription>- </CardContent>- <CardFooter>- {channel.href ? (- <Button- asChild- variant={channel.primary ? "default" : "secondary"}- >- <Link href={channel.href}>{channel.buttonText}</Link>- </Button>- ) : (- <Button- onClick={channel.onClick}- variant={channel.primary ? "default" : "secondary"}- >- {channel.buttonText}- </Button>- )}- </CardFooter>- </Card>- ))}- </div>-);diff --git a/web/src/components/layouts/layout.tsx b/web/src/components/layouts/layout.tsxindex e770eb2917..ec4170662b 100644--- a/web/src/components/layouts/layout.tsx+++ b/web/src/components/layouts/layout.tsx@@ -15,7 +15,7 @@ import { useUiCustomization } from "@/src/ee/features/ui-customization/useUiCustimport { hasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess";import { ClickhouseAdminToggle } from "@/src/components/layouts/ClickhouseAdminToggle";import { SidebarInset, SidebarProvider } from "@/src/components/ui/sidebar";-import { AppSidebar } from "@/src/components/app-sidebar";+import { AppSidebar } from "@/src/components/nav/app-sidebar";const signOutUser = async () => {localStorage.clear();diff --git a/web/src/components/layouts/routes.tsx b/web/src/components/layouts/routes.tsxindex e7d0efa8e2..11c6efb88a 100644--- a/web/src/components/layouts/routes.tsx+++ b/web/src/components/layouts/routes.tsx@@ -8,7 +8,6 @@ import {type LucideIcon,Settings,UsersIcon,- LibraryBig,TerminalIcon,Lightbulb,Grid2X2,@@ -20,9 +19,11 @@ import { type Entitlement } from "@/src/features/entitlements/constants/entitlemimport { type UiCustomizationOption } from "@/src/ee/features/ui-customization/useUiCustomization";import { type User } from "next-auth";import { type OrganizationScope } from "@/src/features/rbac/constants/organizationAccessRights";+import { SupportMenuDropdown } from "@/src/components/nav/support-menu-dropdown";export type Route = {title: string;+ menuNode?: ReactNode;featureFlag?: Flag;label?: string | ReactNode;projectRbacScopes?: ProjectScope[]; // array treated as OR@@ -156,19 +157,11 @@ export const ROUTES: Route[] = [icon: Settings,bottom: true,},- {- title: "Docs",- pathname: "https://langfuse.com/docs",- icon: LibraryBig,- bottom: true,- newTab: true,- customizableHref: "documentationHref",- },{title: "Support",- pathname: "/support",icon: LifeBuoy,bottom: true,- customizableHref: "supportHref",+ pathname: "", // Empty pathname since this is a dropdown+ menuNode: <SupportMenuDropdown />,},];diff --git a/web/src/components/app-sidebar.tsx b/web/src/components/nav/app-sidebar.tsxsimilarity index 87%rename from web/src/components/app-sidebar.tsxrename to web/src/components/nav/app-sidebar.tsxindex a1c0509ccb..a31f241299 100644--- a/web/src/components/app-sidebar.tsx+++ b/web/src/components/nav/app-sidebar.tsx@@ -1,8 +1,11 @@"use client";import * as React from "react";-import { NavMain, type NavMainItem } from "@/src/components/nav-main";-import { NavUser, type UserNavigationProps } from "@/src/components/nav-user";+import { NavMain, type NavMainItem } from "@/src/components/nav/nav-main";+import {+ NavUser,+ type UserNavigationProps,+} from "@/src/components/nav/nav-user";import {Sidebar,SidebarContent,@@ -15,7 +18,7 @@ import { useRouter } from "next/router";import Link from "next/link";import { Alert, AlertDescription } from "@/src/components/ui/alert";import { LangfuseLogo } from "@/src/components/LangfuseLogo";-import { SidebarNotifications } from "@/src/components/sidebar-notifications";+import { SidebarNotifications } from "@/src/components/nav/sidebar-notifications";import { UsageTracker } from "@/src/ee/features/billing/components/UsageTracker";type AppSidebarProps = {@@ -45,7 +48,7 @@ export function AppSidebar({<UsageTracker /><SidebarNotifications /></div>- <NavMain items={secondaryNavItems} showFeedbackButton />+ <NavMain items={secondaryNavItems} /></SidebarContent><SidebarFooter><NavUser {...userNavProps} />diff --git a/web/src/components/nav-main.tsx b/web/src/components/nav/nav-main.tsxsimilarity index 80%rename from web/src/components/nav-main.tsxrename to web/src/components/nav/nav-main.tsxindex 0cc8cd9143..24184a26b0 100644--- a/web/src/components/nav-main.tsx+++ b/web/src/components/nav/nav-main.tsx@@ -1,6 +1,6 @@"use client";-import { ChevronRight, MessageSquarePlus, type LucideIcon } from "lucide-react";+import { ChevronRight, type LucideIcon } from "lucide-react";import {Collapsible,@@ -20,10 +20,10 @@ import {import Link from "next/link";import { type ReactNode } from "react";import { cn } from "@/src/utils/tailwind";-import { FeedbackButtonWrapper } from "@/src/features/feedback/component/FeedbackButton";export type NavMainItem = {title: string;+ menuNode?: ReactNode;url: string;icon?: LucideIcon;isActive?: boolean;@@ -59,27 +59,11 @@ function NavItemContent({ item }: { item: NavMainItem }) {);}-export function NavMain({- items,- showFeedbackButton,-}: {- items: NavMainItem[];- showFeedbackButton?: boolean;-}) {+export function NavMain({ items }: { items: NavMainItem[] }) {const { open, setOpen } = useSidebar();return (<SidebarGroup><SidebarMenu>- {showFeedbackButton && (- <FeedbackButtonWrapper>- <SidebarMenuItem>- <SidebarMenuButton tooltip="Feedback">- <MessageSquarePlus className="h-5 w-5" aria-hidden="true" />- Feedback- </SidebarMenuButton>- </SidebarMenuItem>- </FeedbackButtonWrapper>- )}{items.map((item) =>item.items && item.items.length > 0 ? (<Collapsible@@ -133,12 +117,14 @@ export function NavMain({tooltip={item.title}isActive={item.isActive}>- <Link- href={item.url}- target={item.newTab ? "blank" : undefined}- >- <NavItemContent item={item} />- </Link>+ {item.menuNode ?? (+ <Link+ href={item.url}+ target={item.newTab ? "blank" : undefined}+ >+ <NavItemContent item={item} />+ </Link>+ )}</SidebarMenuButton></SidebarMenuItem>),diff --git a/web/src/components/nav-user.tsx b/web/src/components/nav/nav-user.tsxsimilarity index 100%rename from web/src/components/nav-user.tsxrename to web/src/components/nav/nav-user.tsxdiff --git a/web/src/components/sidebar-notifications.tsx b/web/src/components/nav/sidebar-notifications.tsxsimilarity index 99%rename from web/src/components/sidebar-notifications.tsxrename to web/src/components/nav/sidebar-notifications.tsxindex 06113e1ae9..95b958965c 100644--- a/web/src/components/sidebar-notifications.tsx+++ b/web/src/components/nav/sidebar-notifications.tsx@@ -8,7 +8,7 @@ import {} from "@/src/components/ui/card";import { useEffect, useState } from "react";import { X } from "lucide-react";-import useLocalStorage from "./useLocalStorage";+import useLocalStorage from "../useLocalStorage";import Link from "next/link";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";diff --git a/web/src/components/nav/support-menu-dropdown.tsx b/web/src/components/nav/support-menu-dropdown.tsxnew file mode 100644index 0000000000..f210c70670--- /dev/null+++ b/web/src/components/nav/support-menu-dropdown.tsx@@ -0,0 +1,178 @@+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/src/components/ui/dropdown-menu";+import {+ ArrowUpRight,+ Bug,+ Github,+ LibraryBig,+ LifeBuoy,+ Lightbulb,+ MessageCircle,+ MessageSquarePlus,+ Sparkles,+ type LucideIcon,+} from "lucide-react";+import { type ReactNode } from "react";+import {+ type UiCustomizationOption,+ useUiCustomization,+} from "@/src/ee/features/ui-customization/useUiCustomization";+import { SidebarMenuButton, useSidebar } from "@/src/components/ui/sidebar";+import {+ chatAvailable,+ chatIsVisible,+ showChat,+ hideChat,+} from "@/src/features/support-chat/chat";+import { Switch } from "@/src/components/ui/switch";+import { SiDiscord } from "react-icons/si";++type SupportMenuItem = {+ title: string;+ pathname: string;+ icon: LucideIcon | React.ElementType;+ menuNode?: ReactNode;+ customizableHref?: UiCustomizationOption;+};++export function SupportMenuDropdown() {+ const uiCustomization = useUiCustomization();++ const supportMenuItems: (SupportMenuItem | "separator")[] = [+ {+ title: "Ask AI",+ pathname: "https://langfuse.com/docs/ask-ai",+ icon: Sparkles,+ },+ ];++ if (uiCustomization?.supportHref) {+ supportMenuItems.push({+ title: "Support",+ pathname: uiCustomization.supportHref,+ icon: LifeBuoy,+ });+ } else {+ const chatVisible = chatIsVisible();+ if (chatAvailable) {+ supportMenuItems.push({+ title: "Chat",+ pathname: "#",+ menuNode: (+ <div className="flex items-center gap-2">+ <MessageCircle className="h-4 w-4" />+ <span>Chat</span>+ <Switch+ defaultChecked={chatVisible}+ onClick={(e) => e.stopPropagation()}+ onCheckedChange={(checked) => {+ if (checked) {+ showChat();+ } else {+ hideChat();+ }+ }}+ className="ml-auto"+ />+ </div>+ ),+ icon: MessageCircle,+ });+ }+ supportMenuItems.push("separator");+ supportMenuItems.push({+ title: "GitHub Support",+ pathname: "https://langfuse.com/gh-support",+ icon: Github,+ });+ supportMenuItems.push({+ title: "Discord",+ pathname: "https://langfuse.com/discord",+ icon: SiDiscord,+ });+ }++ supportMenuItems.push("separator");+ supportMenuItems.push({+ title: "Docs",+ pathname: "https://langfuse.com/docs",+ icon: LibraryBig,+ customizableHref: "documentationHref",+ });+ supportMenuItems.push("separator");++ if (uiCustomization?.feedbackHref) {+ supportMenuItems.push({+ title: "Feedback",+ pathname: uiCustomization.feedbackHref,+ icon: MessageSquarePlus,+ });+ } else {+ supportMenuItems.push(+ ...[+ {+ title: "Feature Request",+ pathname: "https://langfuse.com/ideas",+ icon: Lightbulb,+ },+ {+ title: "Report a Bug",+ pathname: "https://langfuse.com/issues",+ icon: Bug,+ },+ ],+ );+ }++ const { isMobile } = useSidebar();++ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <SidebarMenuButton>+ <LifeBuoy className="h-4 w-4" />+ Support+ </SidebarMenuButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ side={isMobile ? "bottom" : "right"}+ align="end"+ sideOffset={4}+ >+ {supportMenuItems.map((item) => {+ if (item === "separator") {+ return <DropdownMenuSeparator key="separator" />;+ }+ const url = item.customizableHref+ ? (uiCustomization?.[item.customizableHref] ?? item.pathname)+ : item.pathname;+ return (+ <DropdownMenuItem key={item.title} asChild>+ {item.menuNode ?? (+ <a+ href={url}+ target={url.startsWith("http") ? "_blank" : undefined}+ rel={+ url.startsWith("http") ? "noopener noreferrer" : undefined+ }+ className="flex cursor-pointer items-center"+ >+ <item.icon className="mr-2 h-4 w-4" />+ {item.title}+ {url.startsWith("http") && (+ <ArrowUpRight className="ml-1 h-3 w-3" />+ )}+ </a>+ )}+ </DropdownMenuItem>+ );+ })}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/web/src/features/feedback/component/FeedbackButton.tsx b/web/src/features/feedback/component/FeedbackButton.tsxindex e68bb65ac7..510cd5ae3f 100644--- a/web/src/features/feedback/component/FeedbackButton.tsx+++ b/web/src/features/feedback/component/FeedbackButton.tsx@@ -6,10 +6,11 @@ import {DialogTitle,DialogTrigger,DialogDescription,+ DialogPortal,} from "@/src/components/ui/dialog";import { useState } from "react";import Link from "next/link";-import { Bug, LifeBuoy, Sparkles } from "lucide-react";+import { Bug, Sparkles } from "lucide-react";interface FeedbackDialogProps {className?: string;@@ -28,32 +29,33 @@ export function FeedbackButtonWrapper({return (<Dialog open={open} onOpenChange={setOpen}>- <DialogTrigger className={className} asChild>+ <DialogTrigger+ className={className}+ asChild+ onClick={(e) => e.stopPropagation()}+ >{children}</DialogTrigger>- <DialogContent>- <DialogHeader>- <DialogTitle>{title}</DialogTitle>- <DialogDescription>{description}</DialogDescription>- </DialogHeader>- <div className="flex flex-row flex-wrap items-center justify-center gap-3 sm:justify-start">- <Link href="https://langfuse.com/ideas" target="_blank">- <Button variant="secondary">- <Sparkles className="mr-2 h-4 w-4" /> Submit Feature Request- </Button>- </Link>- <Link href="https://langfuse.com/issues" target="_blank">- <Button variant="secondary">- <Bug className="mr-2 h-4 w-4" /> Report a Bug- </Button>- </Link>- <Link href="/support" target="_blank">- <Button variant="outline">- <LifeBuoy className="mr-2 h-4 w-4" /> Support- </Button>- </Link>- </div>- </DialogContent>+ <DialogPortal>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ <DialogDescription>{description}</DialogDescription>+ </DialogHeader>+ <div className="flex flex-row flex-wrap items-center justify-center gap-3 sm:justify-start">+ <Link href="https://langfuse.com/ideas" target="_blank">+ <Button variant="secondary">+ <Sparkles className="mr-2 h-4 w-4" /> Submit Feature Request+ </Button>+ </Link>+ <Link href="https://langfuse.com/issues" target="_blank">+ <Button variant="secondary">+ <Bug className="mr-2 h-4 w-4" /> Report a Bug+ </Button>+ </Link>+ </div>+ </DialogContent>+ </DialogPortal></Dialog>);}diff --git a/web/src/features/organizations/components/ProjectOverview.tsx b/web/src/features/organizations/components/ProjectOverview.tsxindex 677538bb58..6f324386a9 100644--- a/web/src/features/organizations/components/ProjectOverview.tsx+++ b/web/src/features/organizations/components/ProjectOverview.tsx@@ -1,4 +1,10 @@-import { LifeBuoy, LockIcon, Settings, Users } from "lucide-react";+import {+ BookOpen,+ LockIcon,+ MessageSquareText,+ Settings,+ Users,+} from "lucide-react";import {Card,CardContent,@@ -257,9 +263,15 @@ const Onboarding = () => {</Button>)}<Button variant="secondary" asChild>- <Link href="/support">- <LifeBuoy className="mr-2 h-4 w-4" aria-hidden="true" />- Support+ <Link href="https://langfuse.com/docs" target="_blank">+ <BookOpen className="mr-2 h-4 w-4" aria-hidden="true" />+ Docs+ </Link>+ </Button>+ <Button variant="secondary" asChild>+ <Link href="https://langfuse.com/docs/ask-ai" target="_blank">+ <MessageSquareText className="mr-2 h-4 w-4" aria-hidden="true" />+ Ask AI</Link></Button></CardFooter>diff --git a/web/src/features/public-api/components/QuickstartExamples.tsx b/web/src/features/public-api/components/QuickstartExamples.tsxindex ce2c179ce5..279aa93131 100644--- a/web/src/features/public-api/components/QuickstartExamples.tsx+++ b/web/src/features/public-api/components/QuickstartExamples.tsx@@ -256,8 +256,22 @@ export const QuickstartExamples = ({>FAQ post</a>{" "}- for common resolutions or{" "}- <Link className="underline" href="/support">+ for common resolutions,{" "}+ <Link+ className="underline"+ href="https://langfuse.com/docs/ask-ai"+ target="_blank"+ rel="noopener noreferrer"+ >+ Ask AI+ </Link>{" "}+ or{" "}+ <Link+ className="underline"+ href="https://langfuse.com/support"+ target="_blank"+ rel="noopener noreferrer"+ >get support</Link>.diff --git a/web/src/features/support-chat/chat.tsx b/web/src/features/support-chat/chat.tsxindex 5ed8cb9208..4d81056f5e 100644--- a/web/src/features/support-chat/chat.tsx+++ b/web/src/features/support-chat/chat.tsx@@ -114,5 +114,9 @@ export const showChat = () => {Crisp.chat.show();}};+export const chatIsVisible = () => {+ if (!chatAvailable) return false;+ return sessionStorage.getItem("supportChatVisible") === "true";+};export const chatAvailable = !!process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID;diff --git a/web/src/pages/support.tsx b/web/src/pages/support.tsxdeleted file mode 100644index e205b37ec0..0000000000--- a/web/src/pages/support.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { SupportChannels } from "@/src/components/Support";-import Header from "@/src/components/layouts/header";-import { ScrollScreenPage } from "@/src/components/layouts/scroll-screen-page";--export default function SupportPage() {- return (- <ScrollScreenPage>- <Header title="Support" />-- <div className="flex flex-col gap-10">- <p>- We are here to help in case of questions or issues. Pick the channel- that is most convenient for you!- </p>- </div>- <SupportChannels />- </ScrollScreenPage>- );-}