Skip to content

Commit

Permalink
error solved at database connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekHegde2000 committed Nov 24, 2023
1 parent 0df2686 commit 4137267
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 30 deletions.
128 changes: 128 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"clsx": "^2.0.0",
"eslint-config-prettier": "^9.0.0",
"lucide-react": "^0.290.0",
"mongodb": "^6.3.0",
"next": "14.0.0",
"next-themes": "^0.2.1",
"openai": "^4.14.1",
Expand Down
7 changes: 3 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ datasource db {
url = env("DATABASE_URL")
}


model Note {
id String @id @default(auto()) @map("_id") @db.ObjectId
id String @id @default(auto()) @map("_id") @db.ObjectId
title String
content String?
userId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("notes")
}
@@map("notes")
}
1 change: 0 additions & 1 deletion public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/vercel.svg

This file was deleted.

46 changes: 27 additions & 19 deletions src/app/notes/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
"use client";

import logo from "@/assets/logo.png";
import AddNoteDialog from "@/components/AddNoteDialog";
import { Button } from "@/components/ui/button";
import { UserButton } from "@clerk/nextjs";
import { Plus } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";

export default function NavBar() {
const [showAddNoteDialog, setShowAddNoteDialog] = useState(false);

return (
<div className="p-4 shadow">
<div className="m-auto flex max-w-7xl flex-wrap items-center justify-between gap-3">
<Link href="/notes" className="flex items-center gap-1">
<Image src={logo} alt="FlowBrain logo" width={40} height={40} />
<span className="font-bold">FlowBrain</span>
</Link>
<div className="flex items-center gap-2">
<UserButton
afterSignOutUrl="/"
appearance={{
elements: { avatarBox: { width: "2.5rem", height: "2.5rem" } },
}}
/>
<Button>
<Plus size={20} className="mr-2" />
Add Note
</Button>
<>
<div className="p-4 shadow">
<div className="m-auto flex max-w-7xl flex-wrap items-center justify-between gap-3">
<Link href="/notes" className="flex items-center gap-1">
<Image src={logo} alt="FlowBrain logo" width={40} height={40} />
<span className="font-bold">FlowBrain</span>
</Link>
<div className="flex items-center gap-2">
<UserButton
afterSignOutUrl="/"
appearance={{
elements: { avatarBox: { width: "2.5rem", height: "2.5rem" } },
}}
/>
<Button onClick={() => setShowAddNoteDialog(true)}>
<Plus size={20} className="mr-2" />
Add Note
</Button>
</div>
</div>
</div>
</div>
<AddNoteDialog open={showAddNoteDialog} setOpen={setShowAddNoteDialog} />
</>
);
}

14 changes: 11 additions & 3 deletions src/app/notes/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import prisma from "@/lib/db/prisma";
import { auth } from "@clerk/nextjs";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Ai - Notes",
title: "FlowBrain - Notes",
};

export default function NotesPage() {
return <div>Here will be your notes</div>;
export default async function NotesPage() {
const { userId } = auth();

if (!userId) throw Error("userId undefined");

const allNotes = await prisma.note.findMany({ where: { userId } });

return <div>{JSON.stringify(allNotes)}</div>;
}
2 changes: 1 addition & 1 deletion src/app/sign-in/[[...sign-in]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SignIn } from "@clerk/nextjs";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "AI-noteTaker - Sign In",
title: "FlowBrain - Sign In",
};

export default function SignInPage() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/sign-up/[[...sign-up]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SignUp } from "@clerk/nextjs";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "AI-noteTaker - Sign Up",
title: "FlowBrain - Sign Up",
};

export default function SignUpPage() {
Expand Down
19 changes: 19 additions & 0 deletions src/components/ui/loading-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Loader2 } from "lucide-react";
import { Button, ButtonProps } from "./button";

type LoadingButtonProps = {
loading: boolean;
} & ButtonProps;

export default function LoadingButton({
children,
loading,
...props
}: LoadingButtonProps) {
return (
<Button {...props} disabled={props.disabled || loading}>
{loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
{children}
</Button>
);
}

0 comments on commit 4137267

Please sign in to comment.