feat: subscription upgrade-only flow, discount codes, proration, enterprise inquiry form, payment history invoices page, fix mobile sidebar close on navigate
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar";
|
||||
|
||||
import type { Icon } from "@/lib/icons";
|
||||
@@ -145,6 +146,10 @@ const navGroups: NavGroup[] = [
|
||||
url: "/settings/billing",
|
||||
icon: CreditCard,
|
||||
minRole: "owner" as ShellRole,
|
||||
items: [
|
||||
{ title: "Plan & Yükseltme", url: "/settings/billing" },
|
||||
{ title: "Faturalar", url: "/settings/billing/invoices" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -162,6 +167,9 @@ export function AppSidebar({
|
||||
pendingMatchCount?: number;
|
||||
role?: ShellRole;
|
||||
}) {
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
const closeMobile = () => { if (isMobile) setOpenMobile(false) };
|
||||
|
||||
const groups = navGroups
|
||||
.map((group) => ({
|
||||
...group,
|
||||
@@ -184,7 +192,7 @@ export function AppSidebar({
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton size="lg" asChild>
|
||||
<Link href="/dashboard">
|
||||
<Link href="/dashboard" onClick={closeMobile}>
|
||||
{company.logoUrl ? (
|
||||
<div className="bg-background flex aspect-square size-8 items-center justify-center overflow-hidden rounded-lg border">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
SidebarMenuSub,
|
||||
SidebarMenuSubButton,
|
||||
SidebarMenuSubItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar"
|
||||
|
||||
export function NavMain({
|
||||
@@ -39,6 +40,8 @@ export function NavMain({
|
||||
}[]
|
||||
}) {
|
||||
const pathname = usePathname()
|
||||
const { isMobile, setOpenMobile } = useSidebar()
|
||||
const closeMobile = () => { if (isMobile) setOpenMobile(false) }
|
||||
|
||||
// Returns the url of the best-matching subitem (longest prefix wins).
|
||||
// Handles detail pages: /customers/123 correctly activates the /customers subitem
|
||||
@@ -89,6 +92,7 @@ export function NavMain({
|
||||
<SidebarMenuSubButton asChild className="cursor-pointer" isActive={activeSubUrl === subItem.url}>
|
||||
<Link
|
||||
href={subItem.url}
|
||||
onClick={closeMobile}
|
||||
target={(item.title === "Auth Pages" || item.title === "Errors") ? "_blank" : undefined}
|
||||
rel={(item.title === "Auth Pages" || item.title === "Errors") ? "noopener noreferrer" : undefined}
|
||||
>
|
||||
@@ -108,7 +112,7 @@ export function NavMain({
|
||||
)
|
||||
})() : (
|
||||
<SidebarMenuButton asChild tooltip={item.title} className="cursor-pointer" isActive={pathname === item.url || pathname.startsWith(item.url + "/")}>
|
||||
<Link href={item.url}>
|
||||
<Link href={item.url} onClick={closeMobile}>
|
||||
{item.icon && <item.icon />}
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
|
||||
@@ -37,7 +37,8 @@ export function NavUser({
|
||||
}: {
|
||||
user: { name: string; email: string };
|
||||
}) {
|
||||
const { isMobile } = useSidebar();
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
const closeMobile = () => { if (isMobile) setOpenMobile(false) };
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleSignOut = () => {
|
||||
@@ -85,19 +86,19 @@ export function NavUser({
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuGroup>
|
||||
<DropdownMenuItem asChild className="cursor-pointer">
|
||||
<Link href="/settings/account">
|
||||
<Link href="/settings/account" onClick={closeMobile}>
|
||||
<UserCircle />
|
||||
Profil
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild className="cursor-pointer">
|
||||
<Link href="/settings/billing">
|
||||
<Link href="/settings/billing" onClick={closeMobile}>
|
||||
<CreditCard />
|
||||
Plan & Faturalama
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild className="cursor-pointer">
|
||||
<Link href="/settings/notifications">
|
||||
<Link href="/settings/notifications" onClick={closeMobile}>
|
||||
<BellSimple />
|
||||
Bildirimler
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user