-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
error solved at database connection string
- Loading branch information
1 parent
0df2686
commit 4137267
Showing
10 changed files
with
191 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> | ||
</> | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |