Skip to content
Open
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
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ services:
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/cms?schema=public
- NEXT_WEBPACK_USEPOLLING=1
- NEXT_PUBLIC_BASE_URL_LOCAL=http://localhost:3000
- NEXTAUTH_URL=http://localhost:3000
- NEXTAUTH_SECRET=NEXTAUTH_SECRET
- JWT_SECRET=JWT_SECRET
- ADMIN_SECRET=ADMIN_SECRET
- LOCAL_CMS_PROVIDER=true
ports:
- '3000:3000'
- '5555:5555'
Expand Down
27 changes: 14 additions & 13 deletions src/components/Greeting.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
'use client';

export const Greeting = () => {
// Get the current hour
import { useEffect, useState } from 'react';

const getGreeting = () => {
const currentHour = new Date().getHours();
if (currentHour >= 4 && currentHour < 12) return 'Good Morning';
if (currentHour >= 12 && currentHour < 17) return 'Good Afternoon';
if (currentHour >= 17 && currentHour <= 20) return 'Good Evening';
return 'Happy to see you back!';
};

export const Greeting = () => {
const [greeting, setGreeting] = useState('');

// Determine the appropriate greeting based on the time of day
let greeting;
if (currentHour >= 4 && currentHour < 12) {
greeting = 'Good Morning';
} else if (currentHour >= 12 && currentHour < 17) {
greeting = 'Good Afternoon';
} else if (currentHour >= 17 && currentHour <= 20) {
greeting = 'Good Evening';
} else {
greeting = 'Happy to see you back!';
}
useEffect(() => {
setGreeting(getGreeting());
}, []);

return greeting;
};