Skip to content

Commit

Permalink
Merge branch 'formbricks:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruwang authored Jan 19, 2024
2 parents 4f1f54f + d90d461 commit f804190
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 51 deletions.
56 changes: 10 additions & 46 deletions app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,27 @@
import { redirect } from "next/navigation";
import { redirect } from "next/navigation"

import { authOptions } from "@/lib/auth";
import { db } from "@/lib/db";
import { getCurrentUser } from "@/lib/session";
import { EmptyPlaceholder } from "@/components/empty-placeholder";
import { DashboardHeader } from "@/components/header";
import { PostItem } from "@/components/post-item";
import { DashboardShell } from "@/components/shell";
import { Button } from "@/components/ui/button";
import { authOptions } from "@/lib/auth"
import { getCurrentUser } from "@/lib/session"
import { Button } from "@/components/ui/button"
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"

export const metadata = {
title: "Dashboard",
};
}

export default async function DashboardPage() {
const user = await getCurrentUser();
const user = await getCurrentUser()

if (!user) {
redirect(authOptions?.pages?.signIn || "/login");
redirect(authOptions?.pages?.signIn || "/login")
}

const posts = await db.post.findMany({
where: {
authorId: user.id,
},
select: {
id: true,
title: true,
published: true,
createdAt: true,
},
orderBy: {
updatedAt: "desc",
},
});

return (
<DashboardShell>
<DashboardHeader heading="Posts" text="Create and manage posts.">
<Button>Create</Button>
</DashboardHeader>
<div>
{posts?.length ? (
<div className="divide-y divide-border rounded-md border">
{posts.map((post) => (
<PostItem key={post.id} post={post} />
))}
</div>
) : (
<EmptyPlaceholder>
<EmptyPlaceholder.Icon name="post" className="" />
<EmptyPlaceholder.Title>No posts created</EmptyPlaceholder.Title>
<EmptyPlaceholder.Description>
You don&apos;t have any posts yet. Start creating content.
</EmptyPlaceholder.Description>
<Button variant="outline">Create</Button>
</EmptyPlaceholder>
)}
</div>
</DashboardShell>
);
)
}
Binary file modified app/favicon.ico
Binary file not shown.
5 changes: 0 additions & 5 deletions config/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FileTextIcon, Settings2Icon } from "lucide-react";
import { DashboardConfig } from "types";

export const dashboardConfig: DashboardConfig = {
Expand All @@ -14,10 +13,6 @@ export const dashboardConfig: DashboardConfig = {
},
],
sidebarNav: [
{
title: "Posts",
href: "/dashboard",
},
{
title: "Settings",
href: "/dashboard/settings",
Expand Down

0 comments on commit f804190

Please sign in to comment.