Skip to content

Commit

Permalink
fix: welcome message greeting in user's time
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Oct 6, 2024
1 parent 9adc309 commit 85d6bc2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/app/(dashboard)/app/_components/welcome-message.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { auth, currentUser } from '@clerk/nextjs/server';
'use client';

export async function WelcomeMessage() {
const { redirectToSignIn } = auth();
import { Skeleton } from '@/primitives/skeleton';
import { useUser } from '@clerk/nextjs';

const user = await currentUser();
export function WelcomeMessage() {
const { isLoaded, user } = useUser();

if (!user) {
return redirectToSignIn();
if (!isLoaded || !user) {
return (
<div className="space-y-3">
<Skeleton className="h-10 w-2/5" />
<div className="flex flex-col gap-2">
<Skeleton className="h-5 w-1/2" />
<Skeleton className="h-5 w-1/2" />
</div>
</div>
);
}

const currentHour = new Date().getHours();
Expand Down

0 comments on commit 85d6bc2

Please sign in to comment.