fix(dashboard): only show the first 10 projects in dropdown
This commit is contained in:
@@ -29,6 +29,7 @@ import type {
|
||||
getCurrentOrganizations,
|
||||
getProjectsByOrganizationSlug,
|
||||
} from '@openpanel/db';
|
||||
import Link from 'next/link';
|
||||
|
||||
interface LayoutProjectSelectorProps {
|
||||
projects: Awaited<ReturnType<typeof getProjectsByOrganizationSlug>>;
|
||||
@@ -86,7 +87,7 @@ export default function LayoutProjectSelector({
|
||||
<DropdownMenuContent align={align} className="w-[200px]">
|
||||
<DropdownMenuLabel>Projects</DropdownMenuLabel>
|
||||
<DropdownMenuGroup>
|
||||
{projects.map((project) => (
|
||||
{projects.slice(0, 10).map((project) => (
|
||||
<DropdownMenuItem
|
||||
key={project.id}
|
||||
onClick={() => changeProject(project.id)}
|
||||
@@ -99,7 +100,11 @@ export default function LayoutProjectSelector({
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
<DropdownMenuSeparator />
|
||||
{projects.length > 10 && (
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href={`/${organizationSlug}`}>All projects</Link>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem
|
||||
className="text-emerald-600"
|
||||
onClick={() => pushModal('AddProject')}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { LogoSquare } from '@/components/logo';
|
||||
import SettingsToggle from '@/components/settings-toggle';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { cn } from '@/utils/cn';
|
||||
import { Rotate as Hamburger } from 'hamburger-react';
|
||||
import { MenuIcon, XIcon } from 'lucide-react';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
Reference in New Issue
Block a user