diff --git a/app/(auth)/dashboard/page.tsx b/app/(auth)/dashboard/page.tsx index 88728fb..f1ce5db 100644 --- a/app/(auth)/dashboard/page.tsx +++ b/app/(auth)/dashboard/page.tsx @@ -1,15 +1,68 @@ +import EventInfoQuickView from '@/components/EventInfoQuickView' +import GuestBookQuickView from '@/components/GuestBookQuickView' +import { prisma } from '@/lib/prisma' import { queries } from '@/lib/queries' +import { getServerSession } from 'next-auth' import Link from 'next/link' import React from 'react' export default async function DashboardPage() { - const events = await queries.fetchEvents() + const events = await queries.fetchEvents(); + const guestBookEntries = await queries.fetchGuestBookEntries(5); + const session = await getServerSession() + + const user = await prisma.user.findUnique({ + where: { email: session?.user.email } + }) // console.log(events) return ( -
-

Dashboard

-
+
+
+
+
+

Hello, {user?.username}

+
+
Overview
+
+
+
+
+

Your Events

+ +
+
+ {events.map((item) => ( + + ))} +
+
+ + View all + +
+
+
+

Guest Book

+ + View All + +
+
+ {guestBookEntries.map(entry => ( + + ))} +
+
+
+ {/*

Your Events

{events.map((item) => ( @@ -30,7 +83,7 @@ export default async function DashboardPage() { > See all events -
+
*/}
) } diff --git a/app/(auth)/user/[username]/page.tsx b/app/(auth)/user/[username]/page.tsx index 2725f60..706834d 100644 --- a/app/(auth)/user/[username]/page.tsx +++ b/app/(auth)/user/[username]/page.tsx @@ -8,13 +8,13 @@ export default async function UserPage({ params }: { params: { username: string const username = raw.startsWith('@') ? raw.slice(1) : raw const user = await prisma.user.findUnique({ - where: { username }, - select: { - id: true, - email: true, - name: true, - role: true, - createdAt: true, + where: { username }, + select: { + id: true, + email: true, + name: true, + role: true, + createdAt: true, }, }) diff --git a/app/globals.css b/app/globals.css index 7f532d6..f51b3e3 100644 --- a/app/globals.css +++ b/app/globals.css @@ -2,7 +2,61 @@ @theme { --color-background: #fff5eb; - --color-text: #141d31; + + --color-brand-text-50: rgb(15, 13, 10); + --color-brand-text-100: rgb(30, 27, 21); + --color-brand-text-200: rgb(60, 53, 42); + --color-brand-text-300: rgb(90, 80, 63); + --color-brand-text-400: rgb(120, 106, 84); + --color-brand-text-500: rgb(150, 133, 105); + --color-brand-text-600: rgb(171, 157, 135); + --color-brand-text-700: rgb(192, 182, 165); + --color-brand-text-800: rgb(213, 206, 195); + --color-brand-text-900: rgb(234, 231, 225); + --color-brand-text-950: rgb(245, 243, 240); + + --color-brand-background-50: rgb(9, 14, 17); + --color-brand-background-100: rgb(18, 28, 33); + --color-brand-background-200: rgb(36, 56, 66); + --color-brand-background-300: rgb(54, 84, 99); + --color-brand-background-400: rgb(71, 112, 133); + --color-brand-background-500: rgb(89, 140, 166); + --color-brand-background-600: rgb(122, 163, 184); + --color-brand-background-700: rgb(156, 186, 201); + --color-brand-background-800: rgb(189, 209, 219); + --color-brand-background-900: rgb(222, 232, 237); + --color-brand-background-950: rgb(238, 244, 246); + + --color-brand-primary-50: rgb(7, 11, 18); + --color-brand-primary-100: rgb(15, 22, 36); + --color-brand-primary-200: rgb(29, 44, 73); + --color-brand-primary-300: rgb(44, 67, 109); + --color-brand-primary-400: rgb(58, 89, 146); + --color-brand-primary-500: rgb(73, 111, 182); + --color-brand-primary-600: rgb(109, 140, 197); + --color-brand-primary-700: rgb(146, 169, 211); + --color-brand-primary-800: rgb(182, 197, 226); + --color-brand-primary-900: rgb(219, 226, 240); + --color-brand-primary-950: rgb(237, 241, 248); +/* + --color-brand-secondary-50: rgb(9, 17, 9); + --color-brand-secondary-100: rgb(18, 33, 18); + --color-brand-secondary-200: rgb(35, 67, 36); + --color-brand-secondary-300: rgb(53, 100, 54); + --color-brand-secondary-400: rgb(70, 134, 72); + --color-brand-secondary-500: rgb(88, 167, 91); + --color-brand-secondary-600: rgb(121, 185, 123); + --color-brand-secondary-700: rgb(155, 202, 156); + --color-brand-secondary-800: rgb(188, 220, 189); + --color-brand-secondary-900: rgb(222, 237, 222); + --color-brand-secondary-950: rgb(238, 246, 239); */ + + --color-brand-text: rgb(87, 77, 61); + --color-brand-background: rgb(242, 246, 248); + --color-brand-primary:rgb(134, 159, 207); + /* --color-brand-secondary: #8ac18c; + --color-brand-accent: #e9e154; */ + } /* @theme light { @@ -13,4 +67,12 @@ @theme dark { --color-background: #141d31; --color-text: #fff5eb; -} */ \ No newline at end of file +} */ + +.btn { + @apply border px-4 py-2 rounded-lg hover:cursor-pointer transition-colors duration-300 +} + +.btn-primary{ + @apply bg-brand-primary text-brand-background border-0 hover:bg-brand-primary-500 transition-colors duration-300 +} \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index eaeefaa..9aac048 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -15,7 +15,7 @@ export default async function RootLayout({ return ( {children} diff --git a/bun.lockb b/bun.lockb index c2ebbb0..c8b4c5d 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/EventInfoQuickView.tsx b/components/EventInfoQuickView.tsx new file mode 100644 index 0000000..dd2d5ef --- /dev/null +++ b/components/EventInfoQuickView.tsx @@ -0,0 +1,15 @@ +import Link from 'next/link' +import React from 'react' + +export default function EventInfoQuickView(props: EventProps) { + return ( + +
+

{props.name}

+

Date: {props.date ? props.date.toDateString() : 'null'}

+

Location: {props.location ? props.location : 'null'}

+

Created By: {props.creator.username}

+
+ + ) +} diff --git a/components/GuestBookList.tsx b/components/GuestBookList.tsx index 00ab3de..2428e1b 100644 --- a/components/GuestBookList.tsx +++ b/components/GuestBookList.tsx @@ -13,7 +13,7 @@ interface GuestBookEntry { notes?: string | null } -export default function GuestBookList({ entries }: { entries: GuestBookEntry[] }) { +export default function GuestBookList({ entries, view }: { entries: GuestBookEntry[], view: 'TABLE' | 'CARD' }) { const [editingEntry, setEditingEntry] = useState(null) function handleModalClose() { @@ -59,51 +59,57 @@ export default function GuestBookList({ entries }: { entries: GuestBookEntry[] } return (
-
- - - - - - - - - - - - {entries.map(entry => ( - - - - - - + {view === 'TABLE' ? ( +
+
NameEmailPhoneAddressNotes
{entry.fName + ' ' + entry.lName} (Side: {entry.side}){entry.email || 'N/A'}{entry.phone || 'N/A'}{entry.address || 'N/A'}{entry.notes || 'N/A'}
+ + + + + + + + + + {entries.map(entry => ( + setEditingEntry(entry)} + > + + + + + + + ))} + +
NameEmailPhoneAddressNotes
{entry.fName + ' ' + entry.lName} (Side: {entry.side}){entry.email || 'N/A'}{entry.phone || 'N/A'}{entry.address || 'N/A'}{entry.notes || 'N/A'}
+
+ ) : ( +
+
+ {entries.map(entry => ( +
+

{entry.fName} {entry.lName}

+

Side: {entry.side}

+

Email: {entry.email || 'N/A'}

+

Phone: {entry.phone || 'N/A'}

+

Address: {entry.address || 'N/A'}

+

Notes: {entry.notes || 'N/A'}

+ +
))} - - -
-
- {entries.map(entry => ( -
-

{entry.fName} {entry.lName}

-

Side: {entry.side}

-

Email: {entry.email || 'N/A'}

-

Phone: {entry.phone || 'N/A'}

-

Address: {entry.address || 'N/A'}

-

Notes: {entry.notes || 'N/A'}

-
- ))} -
+
+ )} {editingEntry && ( ('TABLE') async function handleAddGuest(data: { fName: string @@ -48,11 +51,21 @@ export default function GuestBookPageClient({ entries }: { entries: GuestBookEnt return (
-

Guest Book

+
+

Guest Book

+
+ + +
+
- + (false); + + const handleOpenView = () => setIsOpen(true); + const handleCloseView = () => setIsOpen(false); + + return ( + <> +
+

{props.fName + " " + props.lName}

+

Added on: {new Date(props.createdAt).toDateString()}

+
+ + +
+
+

Guest Details

+ +
+ +
+

Name: {props.fName} {props.lName}

+

Side: {props.side}

+

Email: {props.email || 'N/A'}

+

Phone: {props.phone || 'N/A'}

+

Address: {props.address || 'N/A'}

+

Notes: {props.notes || 'None'}

+

Created: {new Date(props.createdAt).toLocaleString()}

+
+
+
+ + ) +} diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 66cc537..28c10d0 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -11,7 +11,7 @@ export default function Navbar() { if (!session?.user) return null return ( -