Journal dashboard widgets and quick-add; rich-text quick-add dialogs. Dashboard draft sync for live edit previews; assistant bubble + API tools. Journal UX: stress slider, mood grid, query cap fix.
25 lines
697 B
TypeScript
25 lines
697 B
TypeScript
const greetingForHour = (h: number) =>
|
|
h < 5 ? "Up early" : h < 12 ? "Good morning" : h < 18 ? "Good afternoon" : "Good evening";
|
|
|
|
export function DashboardGreeting({ firstName }: { firstName: string }) {
|
|
const now = new Date();
|
|
const greeting = greetingForHour(now.getHours());
|
|
const today = now.toLocaleDateString(undefined, {
|
|
weekday: "long",
|
|
month: "long",
|
|
day: "numeric",
|
|
});
|
|
|
|
return (
|
|
<div>
|
|
<h1 className="serif text-[26px] sm:text-[30px] leading-tight tracking-tight">
|
|
{greeting}
|
|
{firstName && `, ${firstName}`}.
|
|
</h1>
|
|
<p className="muted mt-1 text-[13px]" suppressHydrationWarning>
|
|
{today}
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|