diff --git a/apps/dashboard/next-env.d.ts b/apps/dashboard/next-env.d.ts index c4b7818fbb..9edff1c7ca 100644 --- a/apps/dashboard/next-env.d.ts +++ b/apps/dashboard/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/dashboard/src/app/(dashboard)/layout.tsx b/apps/dashboard/src/app/(dashboard)/layout.tsx index 204ff0178b..a203abd694 100644 --- a/apps/dashboard/src/app/(dashboard)/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/layout.tsx @@ -1,6 +1,9 @@ import { AppSidebar } from "@/components/nav/app-sidebar"; -import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server"; +import { + SidebarInset, + SidebarProvider, +} from "@openstatus/ui/components/ui/sidebar"; import { cookies } from "next/headers"; export default async function Layout({ diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/layout.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/layout.tsx index 1650056317..14492579b0 100644 --- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/layout.tsx @@ -1,5 +1,5 @@ -import { SidebarProvider } from "@/components/ui/sidebar"; import { getQueryClient, trpc } from "@/lib/trpc/server"; +import { SidebarProvider } from "@openstatus/ui/components/ui/sidebar"; import { Sidebar } from "../sidebar"; export default async function Layout({ diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/layout.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/layout.tsx index 2ea65b6376..12e2b6b8b1 100644 --- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/layout.tsx @@ -1,4 +1,4 @@ -import { SidebarProvider } from "@/components/ui/sidebar"; +import { SidebarProvider } from "@openstatus/ui/components/ui/sidebar"; import { Sidebar } from "../sidebar"; export default function Layout({ children }: { children: React.ReactNode }) { diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx index 31746935a3..0d0e58a5ed 100644 --- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx @@ -1,5 +1,5 @@ -import { SidebarProvider } from "@/components/ui/sidebar"; import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server"; +import { SidebarProvider } from "@openstatus/ui/components/ui/sidebar"; import { Sidebar } from "../sidebar"; export default async function Layout({ diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/layout.tsx index 1d7d747a82..94ee94a05a 100644 --- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/layout.tsx @@ -1,5 +1,5 @@ -import { SidebarProvider } from "@/components/ui/sidebar"; import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server"; +import { SidebarProvider } from "@openstatus/ui/components/ui/sidebar"; import { Sidebar } from "../sidebar"; export default async function Layout({ diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/layout.tsx index 9c927696cd..0916ab65d6 100644 --- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/layout.tsx @@ -1,5 +1,5 @@ -import { SidebarProvider } from "@/components/ui/sidebar"; import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server"; +import { SidebarProvider } from "@openstatus/ui/components/ui/sidebar"; import { Sidebar } from "../sidebar"; export default async function Layout({ diff --git a/apps/dashboard/src/components/nav/app-sidebar.tsx b/apps/dashboard/src/components/nav/app-sidebar.tsx index 37ad6b9c7f..597483085d 100644 --- a/apps/dashboard/src/components/nav/app-sidebar.tsx +++ b/apps/dashboard/src/components/nav/app-sidebar.tsx @@ -26,7 +26,7 @@ import { SidebarRail, SidebarTrigger, useSidebar, -} from "@/components/ui/sidebar"; +} from "@openstatus/ui/components/ui/sidebar"; import { Tooltip, TooltipContent, diff --git a/apps/dashboard/src/components/nav/nav-banner-checklist.tsx b/apps/dashboard/src/components/nav/nav-banner-checklist.tsx index ffe1443814..8d81727a64 100644 --- a/apps/dashboard/src/components/nav/nav-banner-checklist.tsx +++ b/apps/dashboard/src/components/nav/nav-banner-checklist.tsx @@ -1,14 +1,14 @@ "use client"; import { Link } from "@/components/common/link"; +import { useTRPC } from "@/lib/trpc/client"; import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuItem, -} from "@/components/ui/sidebar"; -import { useTRPC } from "@/lib/trpc/client"; +} from "@openstatus/ui/components/ui/sidebar"; import { useQuery } from "@tanstack/react-query"; import { CircleCheck, CircleDashed, X } from "lucide-react"; diff --git a/apps/dashboard/src/components/nav/nav-banner-upgrade.tsx b/apps/dashboard/src/components/nav/nav-banner-upgrade.tsx index b3d4a74e19..f00e9fe9a2 100644 --- a/apps/dashboard/src/components/nav/nav-banner-upgrade.tsx +++ b/apps/dashboard/src/components/nav/nav-banner-upgrade.tsx @@ -1,5 +1,6 @@ "use client"; +import { useTRPC } from "@/lib/trpc/client"; import { SidebarGroup, SidebarGroupLabel, @@ -7,8 +8,7 @@ import { SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, -} from "@/components/ui/sidebar"; -import { useTRPC } from "@/lib/trpc/client"; +} from "@openstatus/ui/components/ui/sidebar"; import { useQuery } from "@tanstack/react-query"; import { Rocket, X } from "lucide-react"; import { useState } from "react"; diff --git a/apps/dashboard/src/components/nav/nav-help.tsx b/apps/dashboard/src/components/nav/nav-help.tsx index 08e7ce1d9c..ab77189174 100644 --- a/apps/dashboard/src/components/nav/nav-help.tsx +++ b/apps/dashboard/src/components/nav/nav-help.tsx @@ -1,14 +1,6 @@ "use client"; import { FormDialogSupportContact } from "@/components/forms/support-contact/dialog"; -import { - SidebarGroup, - SidebarGroupContent, - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, -} from "@/components/ui/sidebar"; -import { useSidebar } from "@/components/ui/sidebar"; import { DiscordIcon } from "@openstatus/icons"; import { GitHubIcon } from "@openstatus/icons"; import { @@ -18,6 +10,14 @@ import { DropdownMenuLabel, DropdownMenuTrigger, } from "@openstatus/ui/components/ui/dropdown-menu"; +import { + SidebarGroup, + SidebarGroupContent, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@openstatus/ui/components/ui/sidebar"; import { Book, Braces, diff --git a/apps/dashboard/src/components/nav/nav-main.tsx b/apps/dashboard/src/components/nav/nav-main.tsx index 577ca7d425..960ed6ab5a 100644 --- a/apps/dashboard/src/components/nav/nav-main.tsx +++ b/apps/dashboard/src/components/nav/nav-main.tsx @@ -2,6 +2,11 @@ import { ChevronRight, type LucideIcon } from "lucide-react"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@openstatus/ui/components/ui/collapsible"; import { SidebarGroup, SidebarGroupLabel, @@ -11,13 +16,8 @@ import { SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, -} from "@/components/ui/sidebar"; -import { useSidebar } from "@/components/ui/sidebar"; -import { - Collapsible, - CollapsibleContent, - CollapsibleTrigger, -} from "@openstatus/ui/components/ui/collapsible"; + useSidebar, +} from "@openstatus/ui/components/ui/sidebar"; import Link from "next/link"; export function NavMain({ items, diff --git a/apps/dashboard/src/components/nav/nav-monitors.tsx b/apps/dashboard/src/components/nav/nav-monitors.tsx index f02a411c01..560c4c6d2b 100644 --- a/apps/dashboard/src/components/nav/nav-monitors.tsx +++ b/apps/dashboard/src/components/nav/nav-monitors.tsx @@ -7,6 +7,8 @@ import { MoreHorizontal, Plus } from "lucide-react"; import { ExportCodeDialog } from "@/components/dialogs/export-code"; import { UpgradeDialog } from "@/components/dialogs/upgrade"; import { QuickActions } from "@/components/dropdowns/quick-actions"; +import { getActions } from "@/data/monitors.client"; +import { useTRPC } from "@/lib/trpc/client"; import { SidebarGroup, SidebarGroupLabel, @@ -16,9 +18,7 @@ import { SidebarMenuItem, SidebarMenuSkeleton, useSidebar, -} from "@/components/ui/sidebar"; -import { getActions } from "@/data/monitors.client"; -import { useTRPC } from "@/lib/trpc/client"; +} from "@openstatus/ui/components/ui/sidebar"; import { Skeleton } from "@openstatus/ui/components/ui/skeleton"; import { Tooltip, diff --git a/apps/dashboard/src/components/nav/nav-overview.tsx b/apps/dashboard/src/components/nav/nav-overview.tsx index 2e3dc157ec..eb865943f8 100644 --- a/apps/dashboard/src/components/nav/nav-overview.tsx +++ b/apps/dashboard/src/components/nav/nav-overview.tsx @@ -9,7 +9,7 @@ import { SidebarMenuButton, SidebarMenuItem, useSidebar, -} from "@/components/ui/sidebar"; +} from "@openstatus/ui/components/ui/sidebar"; import Link from "next/link"; import { usePathname } from "next/navigation"; diff --git a/apps/dashboard/src/components/nav/nav-status-pages.tsx b/apps/dashboard/src/components/nav/nav-status-pages.tsx index 7878025231..4f2a1d8828 100644 --- a/apps/dashboard/src/components/nav/nav-status-pages.tsx +++ b/apps/dashboard/src/components/nav/nav-status-pages.tsx @@ -3,6 +3,7 @@ import { MoreHorizontal, Plus } from "lucide-react"; import { QuickActions } from "@/components/dropdowns/quick-actions"; +import { getActions } from "@/data/status-pages.client"; import { SidebarGroup, SidebarGroupLabel, @@ -12,8 +13,7 @@ import { SidebarMenuItem, SidebarMenuSkeleton, useSidebar, -} from "@/components/ui/sidebar"; -import { getActions } from "@/data/status-pages.client"; +} from "@openstatus/ui/components/ui/sidebar"; import { Tooltip, TooltipContent, diff --git a/apps/dashboard/src/components/nav/nav-user.tsx b/apps/dashboard/src/components/nav/nav-user.tsx index 1f908febbe..8ff6c7b96c 100644 --- a/apps/dashboard/src/components/nav/nav-user.tsx +++ b/apps/dashboard/src/components/nav/nav-user.tsx @@ -11,12 +11,6 @@ import { User, } from "lucide-react"; -import { - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, - useSidebar, -} from "@/components/ui/sidebar"; import { useTRPC } from "@/lib/trpc/client"; import { Avatar, @@ -36,6 +30,12 @@ import { DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@openstatus/ui/components/ui/dropdown-menu"; +import { + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@openstatus/ui/components/ui/sidebar"; import { useQuery } from "@tanstack/react-query"; import { signOut } from "next-auth/react"; import { useTheme } from "next-themes"; diff --git a/apps/dashboard/src/components/nav/sidebar-metadata.tsx b/apps/dashboard/src/components/nav/sidebar-metadata.tsx index 0b434710ee..ea44667d38 100644 --- a/apps/dashboard/src/components/nav/sidebar-metadata.tsx +++ b/apps/dashboard/src/components/nav/sidebar-metadata.tsx @@ -5,16 +5,16 @@ import { EmptyStateContainer, EmptyStateDescription, } from "@/components/content/empty-state"; -import { - SidebarGroup, - SidebarGroupContent, - SidebarGroupLabel, -} from "@/components/ui/sidebar"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@openstatus/ui/components/ui/collapsible"; +import { + SidebarGroup, + SidebarGroupContent, + SidebarGroupLabel, +} from "@openstatus/ui/components/ui/sidebar"; import { Table, TableBody, diff --git a/apps/dashboard/src/components/nav/sidebar-right.tsx b/apps/dashboard/src/components/nav/sidebar-right.tsx index 3129436d22..980f7c2fdf 100644 --- a/apps/dashboard/src/components/nav/sidebar-right.tsx +++ b/apps/dashboard/src/components/nav/sidebar-right.tsx @@ -2,6 +2,7 @@ import * as React from "react"; +import { Button } from "@openstatus/ui/components/ui/button"; import { Sidebar, SidebarContent, @@ -13,8 +14,7 @@ import { SidebarProvider, SidebarSeparator, useSidebar, -} from "@/components/ui/sidebar"; -import { Button } from "@openstatus/ui/components/ui/button"; +} from "@openstatus/ui/components/ui/sidebar"; import { Tooltip, TooltipContent, diff --git a/apps/dashboard/src/components/nav/workspace-switcher.tsx b/apps/dashboard/src/components/nav/workspace-switcher.tsx index 11df3661ad..ff5afeb3a0 100644 --- a/apps/dashboard/src/components/nav/workspace-switcher.tsx +++ b/apps/dashboard/src/components/nav/workspace-switcher.tsx @@ -2,12 +2,6 @@ import { ChevronsUpDown, Plus } from "lucide-react"; -import { - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, - useSidebar, -} from "@/components/ui/sidebar"; import { useTRPC } from "@/lib/trpc/client"; import { DropdownMenu, @@ -17,6 +11,12 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@openstatus/ui/components/ui/dropdown-menu"; +import { + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@openstatus/ui/components/ui/sidebar"; import { useQuery } from "@tanstack/react-query"; import { Link } from "../common/link"; diff --git a/apps/dashboard/src/components/ui/sidebar.tsx b/apps/dashboard/src/components/ui/sidebar.tsx deleted file mode 100644 index 7652282903..0000000000 --- a/apps/dashboard/src/components/ui/sidebar.tsx +++ /dev/null @@ -1,731 +0,0 @@ -"use client"; - -import { Slot } from "@radix-ui/react-slot"; -import { type VariantProps, cva } from "class-variance-authority"; -import { PanelLeftIcon } from "lucide-react"; -import * as React from "react"; - -import { Button } from "@openstatus/ui/components/ui/button"; -import { Input } from "@openstatus/ui/components/ui/input"; -import { Separator } from "@openstatus/ui/components/ui/separator"; -import { - Sheet, - SheetContent, - SheetDescription, - SheetHeader, - SheetTitle, -} from "@openstatus/ui/components/ui/sheet"; -import { Skeleton } from "@openstatus/ui/components/ui/skeleton"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@openstatus/ui/components/ui/tooltip"; -import { useIsMobile } from "@openstatus/ui/hooks/use-mobile"; -import { cn } from "@openstatus/ui/lib/utils"; - -const SIDEBAR_COOKIE_NAME = "sidebar_state"; -const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; -const SIDEBAR_WIDTH = "16rem"; -const SIDEBAR_WIDTH_MOBILE = "18rem"; -const SIDEBAR_WIDTH_ICON = "3rem"; -const SIDEBAR_KEYBOARD_SHORTCUT = "b"; - -type SidebarContextProps = { - state: "expanded" | "collapsed"; - open: boolean; - setOpen: (open: boolean) => void; - openMobile: boolean; - setOpenMobile: (open: boolean) => void; - isMobile: boolean; - toggleSidebar: () => void; -}; - -const SidebarContext = React.createContext(null); - -function useSidebar() { - const context = React.useContext(SidebarContext); - if (!context) { - throw new Error("useSidebar must be used within a SidebarProvider."); - } - - return context; -} - -function SidebarProvider({ - defaultOpen = true, - open: openProp, - onOpenChange: setOpenProp, - className, - style, - children, - cookieName, - ...props -}: React.ComponentProps<"div"> & { - defaultOpen?: boolean; - open?: boolean; - onOpenChange?: (open: boolean) => void; - // NOTE: change from default shadcn sidebar - cookieName?: string; -}) { - const isMobile = useIsMobile(); - const [openMobile, setOpenMobile] = React.useState(false); - - // This is the internal state of the sidebar. - // We use openProp and setOpenProp for control from outside the component. - const [_open, _setOpen] = React.useState(defaultOpen); - const open = openProp ?? _open; - const setOpen = React.useCallback( - (value: boolean | ((value: boolean) => boolean)) => { - const openState = typeof value === "function" ? value(open) : value; - if (setOpenProp) { - setOpenProp(openState); - } else { - _setOpen(openState); - } - - // This sets the cookie to keep the sidebar state. - document.cookie = `${cookieName ?? SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`; - }, - [setOpenProp, open, cookieName], - ); - - // Helper to toggle the sidebar. - // biome-ignore lint/correctness/useExhaustiveDependencies: - const toggleSidebar = React.useCallback(() => { - return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open); - }, [isMobile, setOpen, setOpenMobile]); - - // Adds a keyboard shortcut to toggle the sidebar. - React.useEffect(() => { - const handleKeyDown = (event: KeyboardEvent) => { - if ( - event.key === SIDEBAR_KEYBOARD_SHORTCUT && - (event.metaKey || event.ctrlKey) - ) { - event.preventDefault(); - toggleSidebar(); - } - }; - - window.addEventListener("keydown", handleKeyDown); - return () => window.removeEventListener("keydown", handleKeyDown); - }, [toggleSidebar]); - - // We add a state so that we can do data-state="expanded" or "collapsed". - // This makes it easier to style the sidebar with Tailwind classes. - const state = open ? "expanded" : "collapsed"; - - // biome-ignore lint/correctness/useExhaustiveDependencies: - const contextValue = React.useMemo( - () => ({ - state, - open, - setOpen, - isMobile, - openMobile, - setOpenMobile, - toggleSidebar, - }), - [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar], - ); - - return ( - - - - {children} - - - - ); -} - -function Sidebar({ - side = "left", - variant = "sidebar", - collapsible = "offcanvas", - className, - children, - ...props -}: React.ComponentProps<"div"> & { - side?: "left" | "right"; - variant?: "sidebar" | "floating" | "inset"; - collapsible?: "offcanvas" | "icon" | "none"; -}) { - const { isMobile, state, openMobile, setOpenMobile } = useSidebar(); - - if (collapsible === "none") { - return ( - - {children} - - ); - } - - if (isMobile) { - return ( - - - - Sidebar - Displays the mobile sidebar. - - {children} - - - ); - } - - return ( - - {/* This is what handles the sidebar gap on desktop */} - - - - {children} - - - - ); -} - -function SidebarTrigger({ - className, - onClick, - ...props -}: React.ComponentProps) { - const { toggleSidebar } = useSidebar(); - - return ( - { - onClick?.(event); - toggleSidebar(); - }} - {...props} - > - - Toggle Sidebar - - ); -} - -function SidebarRail({ className, ...props }: React.ComponentProps<"button">) { - const { toggleSidebar } = useSidebar(); - - return ( - - ); -} - -function SidebarInset({ className, ...props }: React.ComponentProps<"main">) { - return ( - - ); -} - -function SidebarInput({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarSeparator({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function SidebarContent({ className, ...props }: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarGroupLabel({ - className, - asChild = false, - ...props -}: React.ComponentProps<"div"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "div"; - - return ( - svg]:size-4 [&>svg]:shrink-0", - "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", - className, - )} - {...props} - /> - ); -} - -function SidebarGroupAction({ - className, - asChild = false, - ...props -}: React.ComponentProps<"button"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "button"; - - return ( - svg]:size-4 [&>svg]:shrink-0", - // Increases the hit area of the button on mobile. - "after:-inset-2 after:absolute md:after:hidden", - "group-data-[collapsible=icon]:hidden", - className, - )} - {...props} - /> - ); -} - -function SidebarGroupContent({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) { - return ( - - ); -} - -function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) { - return ( - - ); -} - -const sidebarMenuButtonVariants = cva( - "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", - { - variants: { - variant: { - default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", - outline: - "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]", - }, - size: { - default: "h-8 text-sm", - sm: "h-7 text-xs", - lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - -function SidebarMenuButton({ - asChild = false, - isActive = false, - variant = "default", - size = "default", - tooltip, - className, - ...props -}: React.ComponentProps<"button"> & { - asChild?: boolean; - isActive?: boolean; - tooltip?: string | React.ComponentProps; -} & VariantProps) { - const Comp = asChild ? Slot : "button"; - const { isMobile, state } = useSidebar(); - - const button = ( - - ); - - if (!tooltip) { - return button; - } - - if (typeof tooltip === "string") { - tooltip = { - children: tooltip, - }; - } - - return ( - - {button} - - - ); -} - -function SidebarMenuAction({ - className, - asChild = false, - showOnHover = false, - ...props -}: React.ComponentProps<"button"> & { - asChild?: boolean; - showOnHover?: boolean; -}) { - const Comp = asChild ? Slot : "button"; - - return ( - svg]:size-4 [&>svg]:shrink-0", - // Increases the hit area of the button on mobile. - "after:-inset-2 after:absolute md:after:hidden", - "peer-data-[size=sm]/menu-button:top-1", - "peer-data-[size=default]/menu-button:top-1.5", - "peer-data-[size=lg]/menu-button:top-2.5", - "group-data-[collapsible=icon]:hidden", - showOnHover && - "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0", - className, - )} - {...props} - /> - ); -} - -function SidebarMenuBadge({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( - - ); -} - -function SidebarMenuSkeleton({ - className, - showIcon = false, - ...props -}: React.ComponentProps<"div"> & { - showIcon?: boolean; -}) { - // Random width between 50 to 90%. - const width = React.useMemo(() => { - return `${Math.floor(Math.random() * 40) + 50}%`; - }, []); - - return ( - - {showIcon && ( - - )} - - - ); -} - -function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) { - return ( - - ); -} - -function SidebarMenuSubItem({ - className, - ...props -}: React.ComponentProps<"li">) { - return ( - - ); -} - -function SidebarMenuSubButton({ - asChild = false, - size = "md", - isActive = false, - className, - ...props -}: React.ComponentProps<"a"> & { - asChild?: boolean; - size?: "sm" | "md"; - isActive?: boolean; -}) { - const Comp = asChild ? Slot : "a"; - - return ( - span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", - "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", - size === "sm" && "text-xs", - size === "md" && "text-sm", - "group-data-[collapsible=icon]:hidden", - className, - )} - {...props} - /> - ); -} - -export { - Sidebar, - SidebarContent, - SidebarFooter, - SidebarGroup, - SidebarGroupAction, - SidebarGroupContent, - SidebarGroupLabel, - SidebarHeader, - SidebarInput, - SidebarInset, - SidebarMenu, - SidebarMenuAction, - SidebarMenuBadge, - SidebarMenuButton, - SidebarMenuItem, - SidebarMenuSkeleton, - SidebarMenuSub, - SidebarMenuSubButton, - SidebarMenuSubItem, - SidebarProvider, - SidebarRail, - SidebarSeparator, - SidebarTrigger, - useSidebar, -}; diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts index c4b7818fbb..9edff1c7ca 100644 --- a/apps/web/next-env.d.ts +++ b/apps/web/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/web/package.json b/apps/web/package.json index bf29d61932..ef1a1ab2f8 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -41,7 +41,6 @@ "@openstatus/ui": "workspace:*", "@openstatus/upstash": "workspace:*", "@openstatus/utils": "workspace:*", - "@radix-ui/react-slot": "1.2.3", "@sentry/nextjs": "10.31.0", "@stripe/stripe-js": "2.1.6", "@t3-oss/env-nextjs": "0.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15c56da8ff..90ce848714 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -874,9 +874,6 @@ importers: '@openstatus/utils': specifier: workspace:* version: link:../../packages/utils - '@radix-ui/react-slot': - specifier: 1.2.3 - version: 1.2.3(@types/react@19.2.2)(react@19.2.3) '@sentry/nextjs': specifier: 10.31.0 version: 10.31.0(@opentelemetry/context-async-hooks@2.2.0(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.2.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(next@16.1.6(@opentelemetry/api@1.9.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3))(react@19.2.3)(webpack@5.103.0)