Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dashboard welcomes user by their name #375

Merged
merged 3 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading