Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTypeScript from "eslint-config-next/typescript";
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";

Expand Down
127 changes: 4 additions & 123 deletions src/app/(marketing)/components/MarketingNavbar.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,36 @@
"use client";

import { ChevronDown, ChevronRight } from "lucide-react";
import Image from "next/image";
import { useState } from "react";
import { Link } from "@/components/Link";
import { urlFor } from "@/sanity/lib/image";
import { Badge } from "@/shadcn/ui/badge";
import { Button } from "@/shadcn/ui/button";
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/shadcn/ui/navigation-menu";
import { cn } from "@/shadcn/utils";
import type { CurrentUser } from "@/authTypes";

interface Solution {
_id: string;
title: string;
subtitle: string;
status: "active" | "archived" | "coming-soon";
slug: { current: string };
position: number;
icon: string;
}

interface NavItem {
label: string;
href: string;
}

const NAV_ITEMS: NavItem[] = [
{ label: "Solutions", href: "/solutions" },
{ label: "Docs", href: "/docs" },
{ label: "News", href: "/news" },
{ label: "About", href: "/about" },
];

export const MarketingNavbar = ({
currentUser,
solutions,
}: {
currentUser: CurrentUser | null;
solutions: Solution[];
}) => {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const [isSolutionsOpen, setIsSolutionsOpen] = useState(false);

return (
<>
Expand All @@ -67,7 +49,7 @@ export const MarketingNavbar = ({

{/* Desktop Navigation */}
<div className="hidden md:flex items-center gap-6 mx-auto justify-center p-4 ">
<DesktopNavbar solutions={solutions} />
<DesktopNavbar />
</div>

{/* Mobile Menu Button */}
Expand Down Expand Up @@ -119,61 +101,7 @@ export const MarketingNavbar = ({
onClick={(e) => e.stopPropagation()}
>
<div className="flex flex-col space-y-4">
{/* Solutions Accordion */}
<div>
<button
onClick={() => setIsSolutionsOpen(!isSolutionsOpen)}
className="flex items-center justify-between w-full text-lg font-medium py-2 border-b border-gray-100"
>
Solutions
{isSolutionsOpen ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</button>
{isSolutionsOpen && (
<div className="space-y-2 mt-2">
{solutions.length > 0 ? (
solutions
.sort((a, b) => a.position - b.position)
.map((solution) => (
<Link
key={solution._id}
href={`/solutions/${solution.slug?.current || solution._id}`}
className="text-base py-2 pl-2 border-b border-gray-100 flex gap-1"
onClick={() => setIsMobileMenuOpen(false)}
>
<Image
src={urlFor(solution.icon).url()}
alt={solution.title}
className="w-4 h-4 mr-2 mt-1 opacity-50"
width={20}
height={20}
/>
<div className="flex flex-col">
<div className="font-medium">
{solution.title}&nbsp;
{solution.status === "coming-soon" && (
<Badge variant="secondary">Coming soon</Badge>
)}
</div>
<div className="text-sm text-neutral-500">
{solution.subtitle}
</div>
</div>
</Link>
))
) : (
<div className="text-sm text-neutral-500 pl-4">
No solutions available
</div>
)}
</div>
)}
</div>

{/* Other Navigation Items */}
{/* Navigation Items */}
{NAV_ITEMS.map((item) => (
<Link
key={item.href}
Expand All @@ -195,57 +123,10 @@ export const MarketingNavbar = ({
);
};

const DesktopNavbar = ({ solutions }: { solutions: Solution[] }) => {
const DesktopNavbar = () => {
return (
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Solutions</NavigationMenuTrigger>
<NavigationMenuContent className="border-0 shadow-lg">
<ul className="grid w-[436px] gap-2 p-2">
{solutions.length > 0 ? (
solutions
.sort((a, b) => a.position - b.position)
.map((solution) => (
<li
key={solution._id}
className="cursor-pointer hover:bg-neutral-100 p-2 rounded-sm"
>
<NavigationMenuLink asChild>
<Link
href={`/solutions/${solution.slug?.current || solution._id}`}
className="flex gap-1"
>
<Image
src={urlFor(solution.icon).url()}
alt={solution.title}
className="w-4 h-4 mr-2 mt-1 opacity-50"
width={20}
height={20}
/>
<div className="flex flex-col">
<div className="font-medium">
{solution.title}&nbsp;
{solution.status === "coming-soon" && (
<Badge variant="secondary">Coming soon</Badge>
)}
</div>
<div className="text-muted-foreground text-sm">
{solution.subtitle}
</div>
</div>
</Link>
</NavigationMenuLink>
</li>
))
) : (
<li className="text-sm text-muted-foreground">
No solutions available
</li>
)}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
{NAV_ITEMS.map((item) => (
<NavigationMenuLink
key={item.href}
Expand Down
9 changes: 1 addition & 8 deletions src/app/(marketing)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,17 @@ import Container from "@/components/layout/Container";
import { Link } from "@/components/Link";
import CTA from "@/components/marketing/CTA";
import Prose from "@/components/Prose";
import { client } from "@/sanity/lib/client";
import { MarketingNavbar } from "./components/MarketingNavbar";

export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
const solutions = await client.fetch(
`*[_type == "solutions"] | order(position asc)`,
);
const serverSession = await getServerSession();
return (
<>
<MarketingNavbar
currentUser={serverSession.currentUser}
solutions={solutions}
/>
<MarketingNavbar currentUser={serverSession.currentUser} />

{children}

Expand Down
7 changes: 5 additions & 2 deletions src/app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Image from "next/image";
import { Link } from "@/components/Link";
import HomepageFeatureSectionVideos from "@/components/marketing/HomepageFeatureSectionVideos";
import HomepageFeatures from "@/components/marketing/HomepageFeatures";
import HomepageSolutionsSection from "@/components/marketing/HomepageSolutionsSection";
import { Button } from "@/shadcn/ui/button";

export default function HomePage() {
Expand Down Expand Up @@ -46,7 +47,9 @@ export default function HomePage() {
</div>
</div>

<HomepageFeatureSectionVideos />
<HomepageFeatures />

<HomepageSolutionsSection />
</>
);
}
Loading
Loading