Feature/move list to client (#50)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-01 15:02:12 +02:00
committed by GitHub
parent c2abdaadf2
commit 668434d246
181 changed files with 2922 additions and 1959 deletions

View File

@@ -1,39 +1,15 @@
import DarkModeToggle from '@/components/dark-mode-toggle';
import withSuspense from '@/hocs/with-suspense';
import { getCurrentProjects } from '@openpanel/db';
import LayoutProjectSelector from './layout-project-selector';
interface PageLayoutProps {
title: React.ReactNode;
organizationSlug: string;
}
async function PageLayout({ title, organizationSlug }: PageLayoutProps) {
const projects = await getCurrentProjects(organizationSlug);
function PageLayout({ title }: PageLayoutProps) {
return (
<>
<div className="sticky top-0 z-20 flex h-16 flex-shrink-0 items-center justify-between border-b border-border bg-card px-4 pl-12 lg:pl-4">
<div className="sticky top-0 z-20 flex h-16 flex-shrink-0 items-center justify-between border-b border-border bg-card px-4 pl-14 lg:pl-4">
<div className="text-xl font-medium">{title}</div>
<div className="flex gap-2">
<div>
<DarkModeToggle className="hidden sm:flex" />
</div>
{projects.length > 0 && <LayoutProjectSelector projects={projects} />}
</div>
</div>
</>
);
}
const Loading = ({ title }: PageLayoutProps) => (
<>
<div className="sticky top-0 z-20 flex h-16 flex-shrink-0 items-center justify-between border-b border-border bg-card px-4 pl-12 lg:pl-4">
<div className="text-xl font-medium">{title}</div>
</div>
</>
);
export default withSuspense(PageLayout, Loading);
export default PageLayout;