diff --git a/apps/nextjs/package.json b/apps/nextjs/package.json index 3abfd6c5..5506b988 100644 --- a/apps/nextjs/package.json +++ b/apps/nextjs/package.json @@ -26,16 +26,12 @@ "@acme/logging": "workspace:*", "@acme/search-params": "workspace:*", "@acme/ui": "workspace:*", - "@hookform/resolvers": "3.9.1", "@t3-oss/env-nextjs": "0.11.1", - "date-fns": "4.1.0", - "lucide-react": "0.468.0", - "multimatch": "7.0.0", + "lucide-react": "0.469.0", "next": "15.1.2", "next-intl": "3.26.2", "react": "19.0.0", "react-dom": "19.0.0", - "react-hook-form": "7.54.1", "zod": "3.24.1" }, "devDependencies": { diff --git a/apps/nextjs/src/components/date-formatter.tsx b/apps/nextjs/src/components/date-formatter.tsx deleted file mode 100644 index 438d875a..00000000 --- a/apps/nextjs/src/components/date-formatter.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import type { FormatOptions } from "date-fns" -import React from "react" -import { format } from "date-fns" - -export default function FormattedDate({ - date, - formatStr, - options, -}: { - date: string | number | DateType - formatStr: string - options?: FormatOptions -}) { - const formattedDate = format(date, formatStr, options) - return

{formattedDate}

-} diff --git a/apps/nextjs/src/components/navigation.tsx b/apps/nextjs/src/components/navigation.tsx deleted file mode 100644 index e83f5e6c..00000000 --- a/apps/nextjs/src/components/navigation.tsx +++ /dev/null @@ -1,340 +0,0 @@ -"use client" - -import type { LucideIcon } from "lucide-react" -import type { LinkProps } from "next/link" -import { useState } from "react" -import { resolveHref } from "next/dist/client/resolve-href" -import { usePathname } from "next/navigation" -import Router from "next/router" -import { ChevronsUpDown, ExternalLinkIcon, LayoutDashboardIcon } from "lucide-react" -import multimatch from "multimatch" - -import type { AuthResponse } from "@acme/auth" -import { Link } from "@acme/locales/react" -import { cn } from "@acme/ui" -import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@acme/ui/collapsible" - -interface NavigationElement { - type: "navigation" - items: (LinkElement | CollapsibleElement | GroupElement)[] - hidden?: boolean | ((user: AuthResponse["user"] | null) => boolean) -} - -interface DividerElement { - type: "divider" - hidden?: boolean | ((user: AuthResponse["user"] | null) => boolean) -} - -interface GroupElement { - type: "group" - name: string - hidden?: boolean | ((user: AuthResponse["user"] | null) => boolean) -} - -interface LinkElement { - type: "link" - name: string - href: LinkProps["href"] | ((user: AuthResponse["user"] | null) => LinkProps["href"]) - icon?: LucideIcon - external?: boolean - hidden?: boolean | ((user: AuthResponse["user"] | null) => boolean) -} - -interface CollapsibleElement { - type: "collapsible" - name: string - icon?: LucideIcon - hidden?: boolean | ((user: AuthResponse["user"] | null) => boolean) - children: Omit< - CollapsibleElement & { - external?: boolean - href: LinkProps["href"] | ((user: AuthResponse["user"] | null) => LinkProps["href"]) - }, - "icon" | "children" | "type" - >[] -} - -interface BaseItemProps { - mobile?: boolean - onOpenChange?: (open: boolean) => void - className?: string - user: AuthResponse["user"] | null -} -interface NavigationItemProps extends BaseItemProps { - item: LinkElement -} - -interface CollapsibleItemProps extends BaseItemProps { - item: CollapsibleElement -} - -interface MobileLinkProps extends LinkProps { - onOpenChange?: (open: boolean) => void - children: React.ReactNode - className?: string -} - -export type SidebarNavigation = DividerElement | NavigationElement - -function isActive(currentPath: string | string[], checkPath: string | string[]) { - return multimatch(currentPath, checkPath).length > 0 -} - -const elements: SidebarNavigation[] = [ - { - type: "navigation", - items: [ - { - type: "link", - name: "Dashboard", - href: "/", - icon: LayoutDashboardIcon, - }, - ], - }, -] - -function MobileLink({ href, onOpenChange, className, children }: MobileLinkProps) { - return ( - { - onOpenChange?.(false) - }} - className={cn(className)} - > - {children} - - ) -} - -function NavigationItem({ - item, - mobile = false, - onOpenChange, - className, - user, -}: NavigationItemProps) { - const pathname = usePathname() - - const linkUrl = typeof item.href === "function" ? item.href(user) : item.href - const resolvedUrl = resolveHref(Router, linkUrl) - - const current = - ((pathname.startsWith(resolvedUrl) || - pathname.startsWith(`/de${resolvedUrl}`) || - pathname.startsWith(`/en${resolvedUrl}`)) && - linkUrl !== "/") || - (pathname === "/" && linkUrl === "/") || - (pathname === "/de" && linkUrl === "/") || - (pathname === "/en" && linkUrl === "/") - const isHidden = typeof item.hidden === "function" ? item.hidden(user) : (item.hidden ?? false) - - if (isHidden) { - return null - } - - return mobile ? ( - - {item.icon && - ) : ( - - {item.icon &&