Skip to content

Commit

Permalink
feat: dashboard welcomes user by their name (#375)
Browse files Browse the repository at this point in the history
* feat: add welcome name

* refactor: move welcome msg to comp
  • Loading branch information
dickeyy authored Aug 10, 2024
1 parent c8dba6c commit ef43f41
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
24 changes: 24 additions & 0 deletions src/app/(dashboard)/app/_components/welcome-message.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="space-y-3">
<h1 className="text-4xl font-semibold">
Good afternoon,{' '}
{user.firstName ?? user.emailAddresses[0]?.emailAddress.split('@')[0]}!
</h1>
<p className="max-w-prose text-balance text-sm leading-6 text-foreground-muted">
“The final wisdom of life requires not the annulment of incongruity but
the achievement of serenity within and above it.” - Reinhold Niebuhr
</p>
</div>
);
}
11 changes: 3 additions & 8 deletions src/app/(dashboard)/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { WelcomeMessage } from './_components/welcome-message';

export default function DashboardHome() {
return (
<div className="flex flex-1">
<div className="flex-1">
<div className="space-y-3">
<h1 className="text-4xl font-semibold">Good afternoon, Ahmed!</h1>
<p className="max-w-prose text-balance text-sm leading-6 text-foreground-muted">
“The final wisdom of life requires not the annulment of incongruity
but the achievement of serenity within and above it.” - Reinhold
Niebuhr
</p>
</div>
<WelcomeMessage />
<div>More content</div>
</div>
<div className="min-w-[280px] rounded-lg border p-4">Right side</div>
Expand Down

0 comments on commit ef43f41

Please sign in to comment.