From ef43f41f9c9ee00ae2111aa101b9bba9307ddf00 Mon Sep 17 00:00:00 2001 From: Kyle Dickey <41174949+dickeyy@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:11:27 -0600 Subject: [PATCH] feat: dashboard welcomes user by their name (#375) * feat: add welcome name * refactor: move welcome msg to comp --- .../app/_components/welcome-message.tsx | 24 +++++++++++++++++++ src/app/(dashboard)/app/page.tsx | 11 +++------ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 src/app/(dashboard)/app/_components/welcome-message.tsx diff --git a/src/app/(dashboard)/app/_components/welcome-message.tsx b/src/app/(dashboard)/app/_components/welcome-message.tsx new file mode 100644 index 00000000..d23008ae --- /dev/null +++ b/src/app/(dashboard)/app/_components/welcome-message.tsx @@ -0,0 +1,24 @@ +'use client'; + +import { useUser } from '@clerk/nextjs'; + +export function WelcomeMessage() { + const { user } = useUser(); + + if (user === null || user === undefined) { + return null; + } + + return ( +
+

+ Good afternoon,{' '} + {user.firstName ?? user.emailAddresses[0]?.emailAddress.split('@')[0]}! +

+

+ “The final wisdom of life requires not the annulment of incongruity but + the achievement of serenity within and above it.” - Reinhold Niebuhr +

+
+ ); +} diff --git a/src/app/(dashboard)/app/page.tsx b/src/app/(dashboard)/app/page.tsx index 04a45731..20adafe6 100644 --- a/src/app/(dashboard)/app/page.tsx +++ b/src/app/(dashboard)/app/page.tsx @@ -1,15 +1,10 @@ +import { WelcomeMessage } from './_components/welcome-message'; + export default function DashboardHome() { return (
-
-

Good afternoon, Ahmed!

-

- “The final wisdom of life requires not the annulment of incongruity - but the achievement of serenity within and above it.” - Reinhold - Niebuhr -

-
+
More content
Right side